From patchwork Tue Mar 5 08:59:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 230E4C54798 for ; Tue, 5 Mar 2024 09:00:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C5106B00A1; Tue, 5 Mar 2024 03:59:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14D656B00A2; Tue, 5 Mar 2024 03:59:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F08D96B00A3; Tue, 5 Mar 2024 03:59:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DCCC06B00A1 for ; Tue, 5 Mar 2024 03:59:51 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AF03B120E00 for ; Tue, 5 Mar 2024 08:59:51 +0000 (UTC) X-FDA: 81862387782.23.F3491C7 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf30.hostedemail.com (Postfix) with ESMTP id 054D280010 for ; Tue, 5 Mar 2024 08:59:49 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aA2LjCIk; spf=pass (imf30.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629190; a=rsa-sha256; cv=none; b=QARvTWCWMv22bJOUx99kCQottaAKDitLAtEhEDnes57qt3B9zPOE630BaBOlcwxUA1+tcc 2AmvaFV6ORKxhJ/IdoTWzr51VSMoYd7wyqaVGGcAnSLsaJPsAe2ZVs+I7lYGx/ri1IogQ1 2RqB8aJKQjrlrMBDumJmVMpGOuNi708= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aA2LjCIk; spf=pass (imf30.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709629190; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=sOHznW6+srUJIKfxAeJuw5s8rcUCb4CAELpzL9mF1wj+RVC5AzMlVA+K1IUGjA76WbMlo5 oAfOHKZkiT8zeLmiSe9/c0vlC7ZK5MCqW+we4/oiZFuQsdnH2IFkvJUa+jA5DWbEYyuQe1 8fqIxApwdlNlQOXiPz10HqLh/vFPN10= Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a44f2d894b7so330585466b.1 for ; Tue, 05 Mar 2024 00:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629188; x=1710233988; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=aA2LjCIksMe02eoSnEUHkGnCRoWfrSxv3coZXHppBgnZbesR9z/yUd0z7WYNg9Qqq7 JeQs/iRNdKwzdJc01v3PzH0rgUmGDFMrjG+6VwnfnZ+BrNmp0gKTNc+C9aKAP2dDkVna YGlIoQcHm6o4UUG9F3zbPbILEpAdOHJQdHrs/pKzky42QzzJ7iC6EGnEmDWmn7xrLy11 /bhxlQJ9Q0Qbl/v3FDgXEQXwgfV489G03EvSmeHW6SoMXa/0OoUN4JjMrHWJ3N6UT+1o Mi1zSaAweygUyvqSXih9pXeZts78YiqOC9+o/lCWJ6b6Q1+ESSBckSHKvQom+ThgET21 /T1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629188; x=1710233988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=F12o/984ypfDqsBiOMT524ooouw2UT49uTkIPP6zoih2Vq5qftifnqQMS4u/267FfR ++TsvXDYpEbM9mxIvdU9ikTF11OgTfUipylC/uOoMLhuL9mOsQ/WvF6qxYRO2l8uEVmI 8wto7CdQT0MQaIHGzcjZhpAHvZnxevw9Vn1PY1h2l8ZL8dj+VOuWsNP3M4odiML9XMeb tobI2nGB+lFTuxaJ5E71T49IE20RT9H6EjlV+b3hCWqMD4Muqb4YqJAamAupvNDa1kTz eL92rODEnK94Sx50K+AgpX9l18mq2q5wmhcHbzbDHVhlkt0RKdgkEdkA0Zr8/6M0lhje jSEg== X-Forwarded-Encrypted: i=1; AJvYcCWf4oAW1AN9EvuIDWhpuJs2eZA2Vudla5/qDqroMpD//LsMAvc03AN2rzoDs3OjiEpPtOwfSWv3UotlEl8OKiWkmEg= X-Gm-Message-State: AOJu0Yxkoy9C5tE6cL6hXUzZycy3kbXLD/qjBriHifv/lusMqk7XCnSy 4Sdqkb253fmeK2VBTShCMEpFEUYLoVr++REEFAmqPc5W6V1RwQfsdo+jE4PLJs0= X-Google-Smtp-Source: AGHT+IGDWjdTWBhp9yoamhZMNLezFfIn6Lq1nEJWjHZkb5MGsCgGfbPtzgnfRK1QoTBK5gAAf0Xdmg== X-Received: by 2002:a17:907:20d9:b0:a44:1b98:1829 with SMTP id qq25-20020a17090720d900b00a441b981829mr8277971ejb.57.1709629188722; Tue, 05 Mar 2024 00:59:48 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:47 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Tue, 5 Mar 2024 09:59:17 +0100 Message-Id: <20240305085919.1601395-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 054D280010 X-Stat-Signature: gzaghxawrfi5ounuz5sg6g5w4csc1ruq X-Rspam-User: X-HE-Tag: 1709629189-142147 X-HE-Meta: U2FsdGVkX1+RzdTyqvt/3KCsGqUOPo1sWVcaIAyCxkMviiDGyLVhepzBiug5oeOhNwcaGAMbCF+6JrecnKCZt4N+w14ZQc5bEPHk+vKIwwJWViK4g+h6Zq5ngz9EDts2swDjtlGmPA9pkUQE+JxRAnY34JGUxCZ+sUsvy5N6fp/rYdfWi20eiy7GP4xtoebTtu9594mpnBKR2l1MZJz74e+aT8mnrlDQIN2wUTH/XnxjI+irFTPSN86a8N4iJMA0mnHxGiN1vlyw5L/N530kMJgtQpBszmWUEqFJ0OZi9ik2N1Q8gzZ3gzGGO6YtNmzZUnxLQSLWgggPbS2L6I4q3eslDFTppvpKRL0pPfhauJuHUdmVC/3jDvIZhGeJiaIv9xuN71Gpu3XFeYsebB6asQWhdJOIteu6FP7Hv54zaVEIAipQHoORUT5z4UzBgMtvvcnoKAErL99bAMH+JY+OyMaIqEyHLR1bng7mfqJdm2c4MbJoSwykdU2q6LvzX2o+EIcspI1rrrka0T2Em4HgBCX3D4jxqaHk/TS9RTbF96I0H7zq6VEGFDti53GPnpDwXJyli8PaKDCZ6lEJBOiYwK6m0n136NCqdyWShwkHLeQu0B1QM6xCeCPQYhShfdXc7VMCSghACOOIU+STgO5Fp0CrkUlVNi141ElAxxY5nYknZNlKzTN/3ltNGd+1OgGSWym6M5YNzo5ZHkkeGIJCbI09OTMIHFHD1DjDwc67OvKsTyi9iuqzsOA+dtdD29wAq6uLEe74aBtdmg65eLKeOVHwEioHx3h4xKuIdYwDnjvCz9Dfj6oJPNQIoGb/FdyCSKUCjsqEIm1a9yDItfqg0X1v4YCT4LDatwpE57JmxYFncLW0Sxbu5jhLRqoa0f/pjTv9grJh3H7PmoDdCY7bweqPnTM7FYTbFnEDIhZKX2vMc47Q0nV/K6e4ejVdJ9pdttigQUjXEOVtIqH6aq2 3YHq1lPg qRjJVKrM2DdkKhTSEFdbOB8rr/qDvaies6SjHKcc1EbobwBH4UpjbSv9ExdhC8J1jE3gJniZ71G85bODaluCb+GDKVBHbyL/R6TcWPIkZo6eRSxun0X7g639+a5s72PgsWY5somRyocaCE+kRnPzACY9SP3H2PUzJ/H8P X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/dma-mapping.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 25 +------------------------ include/linux/mm/vmalloc_addr.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/vmalloc_addr.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 07262ae43c5d..80fc7df2856a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1086,30 +1087,6 @@ enum { int region_intersects(resource_size_t offset, size_t size, unsigned long flags, unsigned long desc); -/* Support for virtually mapped pages */ -struct page *vmalloc_to_page(const void *addr); -unsigned long vmalloc_to_pfn(const void *addr); - -/* - * Determine if an address is within the vmalloc range - * - * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there - * is no special casing required. - */ -#ifdef CONFIG_MMU -extern bool is_vmalloc_addr(const void *x); -extern int is_vmalloc_or_module_addr(const void *x); -#else -static inline bool is_vmalloc_addr(const void *x) -{ - return false; -} -static inline int is_vmalloc_or_module_addr(const void *x) -{ - return 0; -} -#endif - /* * How many times the entire folio is mapped as a single unit (eg by a * PMD or PUD entry). This is probably not what you want, except for diff --git a/include/linux/mm/vmalloc_addr.h b/include/linux/mm/vmalloc_addr.h new file mode 100644 index 000000000000..86ad2dc94960 --- /dev/null +++ b/include/linux/mm/vmalloc_addr.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_VMALLOC_ADDR_H +#define _LINUX_MM_VMALLOC_ADDR_H + +#include // for bool + +struct page; + +/* Support for virtually mapped pages */ +struct page *vmalloc_to_page(const void *addr); +unsigned long vmalloc_to_pfn(const void *addr); + +/* + * Determine if an address is within the vmalloc range + * + * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there + * is no special casing required. + */ +#ifdef CONFIG_MMU +extern bool is_vmalloc_addr(const void *x); +extern int is_vmalloc_or_module_addr(const void *x); +#else +static inline bool is_vmalloc_addr(const void *x) +{ + return false; +} +static inline int is_vmalloc_or_module_addr(const void *x) +{ + return 0; +} +#endif + +#endif /* _LINUX_MM_VMALLOC_ADDR_H */