From patchwork Thu Feb 15 14:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 201513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp453748dyb; Thu, 15 Feb 2024 06:57:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWBSZYn8eP4MqLMaVj+69J6NYroi4z5vEMD7JBAuA/LYqK9fdSNBQSP2HeoyPgs48gbLmRjXzXpTu66UTFP+CTmsb7g2Q== X-Google-Smtp-Source: AGHT+IEr/qcPWMh57u6S2EjtoSjsyqDwebineQkqJj6ZkYL44PUnopSu7hhDK7/KmcmeBkNCpnFa X-Received: by 2002:a05:6358:6484:b0:178:c4f4:4ae1 with SMTP id g4-20020a056358648400b00178c4f44ae1mr2728583rwh.13.1708009070036; Thu, 15 Feb 2024 06:57:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708009069; cv=pass; d=google.com; s=arc-20160816; b=MPoCuoAULUYZGscV8FSXc9niN8ctG3WF/ge2nLucoyZGF8IeTjnftbEuJcDJSjK8ia qtCsN0qrNoTH4TtAVY1Z2tZzEQdZh9Huyb4PMzEXtifTwylOK1jBg/7SP9jBdAPkGOvV 6ZuUc6wwqMZt/mpLCMw4dKeTp8d87nj0rG/tj83ctQuJBVlAxswpCIeui8Pn/8Cfm9BE yERpEOcGwgtM7GxFH/RHNSHc26s9RoVdQcZadaRvkKhiuuULR5ILgjtAPd2LKptdjTcs fF9mHAS5bbcMCtG8/NaiFm+98PLgbsOtngv7VSYFh/NHNA7uu9uY69M8o2fOrWk6uu90 NYkQ== 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; fh=sZKcvTdI1y+3grkwgp1GLq4o20hUJv5aTOO0yN+n14g=; b=SG5H3ahfamfzziVMqBvqt0/dbL0+t1K16GvSRl5yKKmCNPvn5dkLuuWkR9vxQn8Tqu lgxsN8Ipe21aXt54noJvKYACZReQSaoJ5Ec9d/BqvGirVDY6mxUYaNt2RpLHZMBaToSi Fy6N20t92+S8mUCbBUn4JnF9nyooSQ9k5TtFWsfbZo13JK2xThEsU4gXfMoflpsfiRyy 37ry1WIF9C6qlMt06Om7SCgOx6d7regtmWBdeCOdEjEDp5O18rfjtbRmNgvEEE3x87iO 0K/4SuwneRf4W/PE99tOXg0K5O6tqIZiD3irTS08fBWzIUgoNH1BN61LSw4BH/ycrYhe 9FWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=bztQzl4Z; 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-67115-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67115-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 b16-20020a631b10000000b005dc71c7b944si1275724pgb.144.2024.02.15.06.57.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:57:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67115-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=bztQzl4Z; 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-67115-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67115-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 CCCD1289656 for ; Thu, 15 Feb 2024 14:57:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EBCA133436; Thu, 15 Feb 2024 14:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="bztQzl4Z" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 2EFF0132C2F for ; Thu, 15 Feb 2024 14:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008979; cv=none; b=NT2NAl/qvlkuZh2ZbyBjQNSNlkOiF+JMjjD4GMRBI1ht043LhmKvu9FhkOl7rILvC+Q5LLOsP/2W9O/bx2vFVgLu2z8rAnGU9z81/dK78tUyNPE5ypPy994KfhtkqObXuCEfjjWM4WsfFwrDqg93MDIgUnRvtGDOjZyTgLJHLak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008979; c=relaxed/simple; bh=IpD67k2gO2M25PjFyFyPuo75aV97Zro4npvwo0DmQ38=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bc7Tf3ENlFLg2KPEXMvAhcoUK5Kg6LlRWg9FY+8p6w4xWVvEsM1e+gfjH+YeX9O9f7L2yja25li5ekO7EkPKh12nvo+UexR8oKfnKhWZWaQD48y+tO2sg7uSjvw2lbPXzQzpRnEYpXN2fnYI+Lw1nFd2WpvNW6CMoKbgd6Qv4ko= 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=bztQzl4Z; arc=none smtp.client-ip=209.85.208.46 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-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55f279dca99so1643198a12.3 for ; Thu, 15 Feb 2024 06:56:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008975; x=1708613775; 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=bztQzl4ZWifAlujdj5vU9b7rCWYZYBstWPTPITzvBWGyN1/pHG0qScI55r+q8KaAx3 KHzVRcW3GzPEg7ORfzTUY0LUM3nGBbzwRU/YQ1Z+5/SFj0VS+5G7+NvvMnFY7rrg1HYU 4gpwyIDo4L6VIKhsq1MEKP2NyPNcqHFO3yi5w2sdB8ODUwYIpPOegcMBTbf8YrC+Mkz+ RnZKMnkTYQGf4Zyz81ky/hzMIxtMYoiZLyt8bCXppFg0EFZLC66bukU5zTkc+azqGr1J nTv4YBvZPQGhgN+gMTg8TyLx4VnQguMv6nd896V5LXUS/kCp2QMDSBClfHNF+cWMok5F kI8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008975; x=1708613775; 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=vUrtpSxJPYIBFG3qktOguRsMsNlNRbVUKDwgYkgCgRjUyvi6J8ZCSi9DTAJFBBAFL5 LItniHAMG+5S4rO4N0nnd7InZUDzn0qlo+RW2E6VJe1T0t1N+MsK3BvMBlhVg0MQlqsL Qkn7DUkeVV5oc/vqLoLARYytlpQeBSVrgm3hkLRcls7L0AnifwbHM12WxIP4eA3Ct83G UfxgT23KrOqZz0gqKR9YO6akFYsRDyDY1C/2uYQw9nnIn0IIZC4fWjiz+9Ijk+yhXNVS XcnBPTLrKkKF9ipZCT0tHiZuiGSj3q5A1THcNYKLBBqteKReZ5fAIo/S/MYjc9aIAPys mD5w== X-Forwarded-Encrypted: i=1; AJvYcCUCcAncWQI1m38cwMH15xWw74HokclRJup0MPtVO1aFTj6d+03mlxXWuDyxUUHa/TNiHS1Twnf9FHmSj2rfY2T0RpJDVynCvj81p3U6 X-Gm-Message-State: AOJu0Yxd1fiimwArWZD1M2AfAH98hRfLepZmuZjzaLvBiwW+HemNHw8V 7WlgZ5UQOM9O8LaIiW0qrfWE3WpAf+hARTDt+uXdLI4koo+OhT03Jfh374mJoaw= X-Received: by 2002:a17:906:35c9:b0:a3b:b947:af77 with SMTP id p9-20020a17090635c900b00a3bb947af77mr1309692ejb.67.1708008975496; Thu, 15 Feb 2024 06:56:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:15 -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 04/14] linux/mm.h: move section functions to mm/page_section.h Date: Thu, 15 Feb 2024 15:55:52 +0100 Message-Id: <20240215145602.1371274-5-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: 1790977318186181669 X-GMAIL-MSGID: 1790977318186181669 Prepare to reduce dependencies in linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 18 +----------------- include/linux/mm/page_section.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 include/linux/mm/page_section.h diff --git a/include/linux/mm.h b/include/linux/mm.h index decc0cb8ed32..84a49178b94a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H #include +#include #include #include #include @@ -1622,10 +1623,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define SECTION_IN_PAGE_FLAGS -#endif - /* * The identification function is mainly used by the buddy allocator for * determining if two pages could be buddies. We are not really identifying @@ -1825,19 +1822,6 @@ static inline pg_data_t *folio_pgdat(const struct folio *folio) return page_pgdat(&folio->page); } -#ifdef SECTION_IN_PAGE_FLAGS -static inline void set_page_section(struct page *page, unsigned long section) -{ - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; -} - -static inline unsigned long page_to_section(const struct page *page) -{ - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; -} -#endif - /** * folio_pfn - Return the Page Frame Number of a folio. * @folio: The folio. diff --git a/include/linux/mm/page_section.h b/include/linux/mm/page_section.h new file mode 100644 index 000000000000..e4558c2691b8 --- /dev/null +++ b/include/linux/mm/page_section.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_SECTION_H +#define _LINUX_MM_PAGE_SECTION_H + +#include // for struct page +#include // for SECTIONS_* + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define SECTION_IN_PAGE_FLAGS + +static inline void set_page_section(struct page *page, unsigned long section) +{ + page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); + page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; +} + +static inline unsigned long page_to_section(const struct page *page) +{ + return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; +} +#endif + +#endif /* _LINUX_MM_PAGE_SECTION_H */