From patchwork Thu Feb 15 14:56:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 201522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp456452dyb; Thu, 15 Feb 2024 07:01:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXLcMQVPtRjB899OzD6sqnR+80UYGA59qOutvYHczFzO1APihmVZc1gkZsFo+SIzDushSUDKAE3D/SpO6ckB+a63gPo9g== X-Google-Smtp-Source: AGHT+IF70GhRSqbfiVKwAxWknofpoth+JJuHDQFMg4IZEVfwuCtu6y8O8628bEYcswHduzb6Ahmt X-Received: by 2002:a05:6a21:1519:b0:1a0:828a:50d8 with SMTP id nq25-20020a056a21151900b001a0828a50d8mr575109pzb.22.1708009309068; Thu, 15 Feb 2024 07:01:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708009309; cv=pass; d=google.com; s=arc-20160816; b=Yo3d1q/Tp7vx74K1ddJC80IfngnDr4wZhM/fG1rOPkHItwIouvdf4k1VFV2MUY01PI ZHaCgPczF5QuqfdZAknCOXJSKDujCY2ZjPH228PbRi0ZQSgCcoq2EwcVCL7W9alRfyLu o2lc2zEQY6BJMM6WhrWihxAFvJei4GuI5qLMNAKCTvGiJDM74vAD+LfW7yKDwy4ikt9C 9tbV2yHoV+bbaVvCe9Kbe6Puv/VeCkJ0/Ah2qf/XprB06MSKHWOUE1KNIPAZUizB8uGf bbT+qHL8aiyVMhSz6FTshHVz/SLLFP8D10o5UW34bBenbBTwO4BWKtkaV2fO1d1mDbXc YYoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hDi3zk+Z/SLj4QVGPle17xDH/MSBW8emaxfc34uAZG8=; fh=S5cvOgQaQ4GwWcOAJsYk0YpoRIWoJXal2AFEd1Nqfc8=; b=apiput//GZDe7UpOJ/KbtOIpYck2rEUh9V7X8dKELVyVweusb2MFMcNXVMBBpPvhGe 4VapipTDIru8yf2k7roDKyz/3LTEz8ZeNXm0fPrNcSD3qM7a8H4TaYHwHI/RYYrtSPZt KDXve+2l3OHOwWmg66GprBZJg3IU3cXZfPck26tqMQuCAC0HgxgXUf9MpnMylw+MK++X 9fJN5GEwGEmj/JNoa1dqzddhQk7xD1btd0g3QyMf9SdnHAYoGLrjyDawTjsI2Q5BOb0V lyJRF8Man/8ZR3uzPqtU1pAFQS8w6rry5yKKCyMdmCgb0yABmX3lJCoWf+Ynyznp2Lgy eQug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b="Rm/Nobin"; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-67123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67123-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p21-20020a637f55000000b005dc76f56a18si1195452pgn.559.2024.02.15.07.01.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:01:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b="Rm/Nobin"; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-67123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67123-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D675A28551A for ; Thu, 15 Feb 2024 14:59:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBD801350E4; Thu, 15 Feb 2024 14:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="Rm/Nobin" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87E181339BE for ; Thu, 15 Feb 2024 14:56:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008986; cv=none; b=H1oQKQpPNkqbpri3vTUPts6TqLD6/BOHUZbDdnuDkA++n6Qme/pTNyF7yUWiREJohQBeuZo7BDjhs8LtNAwMhtvTUbmzfosfP9TLOuY6shG8R9hLf+2pXfqB7YFFUdWgWkwaGPmIITZ6frVeJ8t27srXyq3iaKOgC+MFfe11/6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008986; c=relaxed/simple; bh=v9cPlxD645ETqqwrU2mneRRT1GLcfGc/VwKe6UrwJKg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ltvev8WHJz1MwmRVH0vqpvz0DTIqxD/mN777MzKuYKBIaT3Z7s5MXjWxh3TJUIxc1XB29ZrobMvEDjZWQ5ekcYJgjq0KBUIWxfwneA5PU5c+xCOFXEzXZzC+v0DLZT0wbNpF4F5nQ3U6Hs1e+GXBHRyf+f1gFxJ+e0/vvsP20Kc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=Rm/Nobin; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a3832ef7726so123247466b.0 for ; Thu, 15 Feb 2024 06:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008982; x=1708613782; darn=vger.kernel.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=hDi3zk+Z/SLj4QVGPle17xDH/MSBW8emaxfc34uAZG8=; b=Rm/Nobinc4rClo55Tp8XMgLCiLCZADV/QiPhWLiFYDZY5w3zhWuEPklPLGsZ73CbMS /36YfFuh0oq1dFg7k+bsAOe4wQtAVXfjYoZaGCCJhOCfE0SA2ejw4PcIuaxubql9MIDt qGP/U6I6qhtl0UQM8Hha2hpzX/WmwjSrxbvDW0Y8H0LMtwjbbyr/367PQ6k4HftV4Yp/ GxUUTgwMdYjyM9xjuCjYg2bH9V3QIH2x7dNe6T5JhAr8KBvWPg31Vb9rNofdzA3gZaMu O3axoPCGxj14F3S8z3RxfKDyVhq7tRinfCTsr5Ee1X+dxzdoj1KLAMl+ck5F+oyoxcmr Wrow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008982; x=1708613782; 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=hDi3zk+Z/SLj4QVGPle17xDH/MSBW8emaxfc34uAZG8=; b=BqktQWosVnA1tBAWhzHP9mU5WFOeGg9RR4T+Lypfunfa5TBvxetroAL3yFmPZbrujS IWAPhw/12gYaDRSH8t1bPLB6d01CR1APdlMZID7rc0t+IP3J/U1FcuK+YyCUdhU/YEdZ CKWUTt+PtBP4TfbSbwJqS3GcBD8dvXf3bxNEpFtItQfOzC3Mc592sNKa8lGKQ51kkbTu 5pNIGT5V3AvszQb8JWGfHfX4QyBzJUGbOTIzeY83TvPFxsS+HKzp+bCZzBNT2rm+1pub BXzJKoF1MPp3dEza4x74mRk0QejRw6qvWhDTmTqAiVngb8VbDh91wl4jSF7m9Ndjjet9 Jl7Q== X-Forwarded-Encrypted: i=1; AJvYcCViZxQZuYjXyBLazkXZc+onHB8nxG1zRMwaZ+V4qnJglokyuyVVbJDJDq6fsQgI6blacPsMlPZ2Jq8yNJL/Rb0XQxLfStGwRoXKzI15 X-Gm-Message-State: AOJu0YwB3cG+1Vk7bJRLpa1ujgywPjLPm3Ez67N9IX1N6IyGz6JiKo0r l/O7Sa8urVp7RBVp/XzuLbvUnOtwHpPweQaRCZ/SM2gB71686swwkNOGdddG/SI= X-Received: by 2002:a17:906:5fc5:b0:a38:7171:e832 with SMTP id k5-20020a1709065fc500b00a387171e832mr1267787ejv.32.1708008982697; Thu, 15 Feb 2024 06:56:22 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:22 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Thu, 15 Feb 2024 15:56:00 +0100 Message-Id: <20240215145602.1371274-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790977569204342143 X-GMAIL-MSGID: 1790977569204342143 Prepare to reduce dependencies in 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 c7e53cd0cdd0..d4624940923f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1067,30 +1068,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 */