From patchwork Tue Jun 4 09:08:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684924 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 26293C25B78 for ; Tue, 4 Jun 2024 09:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2E656B00AA; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E62646B00A9; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC2CC6B00A8; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A434F6B00A5 for ; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6AE3DA0DF3 for ; Tue, 4 Jun 2024 09:09:25 +0000 (UTC) X-FDA: 82192632690.13.D5D87FA Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf13.hostedemail.com (Postfix) with ESMTP id 8EADB20003 for ; Tue, 4 Jun 2024 09:09:23 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=R5SIU5Y1; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.53 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=1717492163; a=rsa-sha256; cv=none; b=6U6gxrIct3QoLKuutSIl7GCBpAvzy6W2TyZyAACUrDd7uYilAtDOD0fSh2o8kNVPWcmnK5 iDMaiu0ohWMwPWVoGRoKmflOS71iLYEYKWN6djp1IZlJ5BlibzvMmFRxs37N1FKji5F74I U+n5UgrAUj1dQBzoL0FY4J5i8uvuT28= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=R5SIU5Y1; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.53 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=1717492163; 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=1o8h4WW2rkKyKPUI+a/gz6b5mzKTaMa0Q8zXDVfDCoM=; b=FHfmEYJRF3tij0TyBh2yMn2K3HfyWr0sByUejQPyN9HSm+XXW725k5r7L3KwXfWlQ88SoH OPtD/X1/+9eYCVSxZO1XaMHfule7gM9fRsI+NKs8EAJKOtDLE2jO8O20m3GhU7d6T5BrPg vx2VsihzzD7X34INe85WdPbPCNDz9l4= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a68ee841138so257792766b.1 for ; Tue, 04 Jun 2024 02:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492162; x=1718096962; 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=1o8h4WW2rkKyKPUI+a/gz6b5mzKTaMa0Q8zXDVfDCoM=; b=R5SIU5Y1LMT5NcpQL4ZDLh9kT6Iwcha2/EhZ+oTJRX18flJZYMQhgv7MVYZMqkHvLn 11Nxlo6J0A8erhuDOj+oAHEdd9zwrCpY8G4p7azFjxJCAPWcl+J5KZQyjtH/Zvml7N9J I7Sf5sXYVFXoA9CioVOBgCYmJkWHbdFh/a5vnAzbFFKKNNZic5oGCRanAxbUdRnt45e9 t9LRSLEZ1jClE69y9F8+1ll640okyQXxGVlvm0yDsMqIPhELh49TACHJJcqnnYaYPJUe 62xt9npSmOQPY+toJHEKQBFcZLAE1FzemSzOXkxs6uE7GzA3iCk368saZbGVRi+efCQc rNGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492162; x=1718096962; 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=1o8h4WW2rkKyKPUI+a/gz6b5mzKTaMa0Q8zXDVfDCoM=; b=uAIPd3pSQOen9tS6l9m/VLsVV4HvDmNll0cAofIYsMxvB9nW+3gsLhnxWZH0OXne9c uojNp3KNCnvnvrfUu3/10q+X4T0dP+wwAj3sTn2c8r+SJCpBwllsuA/X26gimDPiSDDZ TNI/IvRELT75yfYJknaTsVQwSQHXhnQ6lW5nBtensLAHbVw6aTjUelw87M9saT+pAvg8 hNI9FAiJnuLYRTE7jAF9LJMdTx4tK3umJXRGy38u7+stwu3BMYQ1O3YtjX36IQllTgNP oJw3tzWojss/Cp0zGPqkRqLIz8iAWTv3yFx5Ws360O9dxtPVA5ZebAZFgbj45yH9J9He Jgmg== X-Forwarded-Encrypted: i=1; AJvYcCWfHQQ+yieb2leGp3heSxBSprhj4rbO+crjcIOpq6uA/4ZRU9SnvE154BCoqBF0kZDvBk0ODXYIsMDw6dWwH1wOyIs= X-Gm-Message-State: AOJu0YyOF6miS0c9+HVoUiQS3nWsJkjI6xckQkKohhW3gW/UpJn0UHSt T0rWbtlT3FWfbUMVu2POK0g6D7/t0MgqnQ150Zc1xIe73DJE/w/rodIjKJkkTj0= X-Google-Smtp-Source: AGHT+IHcBCOnI/AP+4Gs+A9GVqIIvYfhFKwdpV9/+hIkLKh+cjnNIZ7LwpLVGv8+f7nFEA7iDEBeHg== X-Received: by 2002:a17:906:40d8:b0:a68:379d:d623 with SMTP id a640c23a62f3a-a68379dd799mr735700466b.36.1717492162204; Tue, 04 Jun 2024 02:09:22 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:21 -0700 (PDT) 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, david@redhat.com, Max Kellermann Subject: [PATCH v6 13/15] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Tue, 4 Jun 2024 11:08:43 +0200 Message-Id: <20240604090845.2182265-14-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8EADB20003 X-Stat-Signature: bpmwg5qpd8u14o31yum48iwcoabcdjp9 X-HE-Tag: 1717492163-292347 X-HE-Meta: U2FsdGVkX1+lrcLQg2+BJGTukRFbcu6RtO3WtaGBqoUI+Uc1dv4aOX6tPzHSLkzJhr0kY8g2L311mYTBRgou9Wlxi24SQdo1O/uDxU638pdmmaaAXzJ3sgQsZ9HDUfcSgy5WkaGdEKaSPEDu2I8vqTn/fLssyZyYZH3IZpuinuE+lUspINezrTtH0bgKobRxYEldGaoCElxO6Y5+9BQJLX5Z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m5xphgHZzAPipTQkO3zxoaA/18N7v/lU8lKKNk4JQ4E/s8QeGs1mMzs5CMw+LLW/XAs5I2BwS1j7B4iyHDuhkfgwGSmnZSYYOZxkFw43opVe+sPevLo3NzbR5UYBzssMGH4a3G7oh59+cGXaOfmlGRHIZsUIY5AHowynV3AsWEeQ== 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 e178bda2525d..6c9089adbb4e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1087,30 +1088,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 */