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: 13558584 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 C0605C4829E for ; Thu, 15 Feb 2024 14:56:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8428D8D0024; Thu, 15 Feb 2024 09:56:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 72E7C8D0022; Thu, 15 Feb 2024 09:56:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E5228D0024; Thu, 15 Feb 2024 09:56:19 -0500 (EST) 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 3683F8D0022 for ; Thu, 15 Feb 2024 09:56:19 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EF6B01409D5 for ; Thu, 15 Feb 2024 14:56:18 +0000 (UTC) X-FDA: 81794338836.23.7AA48A3 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf05.hostedemail.com (Postfix) with ESMTP id D6407100003 for ; Thu, 15 Feb 2024 14:56:16 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LSs63XhU; spf=pass (imf05.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.49 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=1708008976; 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=A30amz9vb+D8MW9GOX0tR04z7qLzZxRuby1zb6djgLgl0gdhs6NdT255WZZMPPQhg/ZKzU 69ZO2yullzM4U92o216kXgJO3coyA+ML3aIx5V0h7E7OkB1Cqq20eu8VbVQQXnt/e0bDy6 FD6hA3/xpY8qG9U0IbjaABV8EA9iEGo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008976; a=rsa-sha256; cv=none; b=B5mwVBHw7TK4Tv1k966Zh1dJ3F0B/oPJJzDTmqpiUr75XPzCLdw4K1F5pAtEMbeoncIVPB lhs38KOKdQ0wYYzW2V44WJnACZ9PflUICmCnuoxiDrxEA1k+vJFyI1jj9eRVCOWx7lGKPT TIOb1uACvpU1Xtgj5aeHFNm4vLDaR+c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LSs63XhU; spf=pass (imf05.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a3d0d26182dso101242366b.1 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=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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=LSs63XhUQ1Fr+minOX5deQxEv4f2zAFdhzvZdID9g50qh9CYUmAX6hW2koqUoE2HGf /XeAm6geVfQeYkBTJ2jkOEtvSkuxTPcBO1u6sx7PQS5S48yIPtqak45x6INrQbggiS5w ep4fyglroLYQa+tJsG+u1NujzXkzYUofzA+qFO8nsEgmZuFVEcwCOEAFNhOY7sCIxOJc 9UXxLrjOSLJNGcnJLj32mOWBy6JLpzKYWD+y+gvS22iju2zsZ+3HAlRMbfJ8htchPO8G 1cr+3ZHhcteOydWKODN8feQcwkRdbEvWDNAdD3D414/ny6cv89YTkNS/9NQXR6pNEmOp Zkvg== 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=D4oXqQqsK6eVJcryFKUh14do7CR+l1gQpqoJGtE3S/PbcorMeYp2aAsvH3hj5lrsnb rW2r+qk6Uaz01KjKhfYvoidq7wdMLpnK+nNuZ1kCTcZ/G6ycaeC35f1xigAjE1yAJLiC wT48jwDO505Zlqm+3C0yNbvGE0F1Vpv1S1T+/+lnxG2JHjoH0xiABRWvlHm5JxgtL6pt a5yqKhzkCNT082PoeI9uJC7Sl8UZ2F8iqyFSy/tvHxCcwOFuGXC16FLhOGV1w3UmzEU8 uMKgC/BiENTNHRt1BhkMojsx2TthfWbR07gHwFAi0hoC5K4TPGV6qIHoDfybPGXexg7r BabA== X-Forwarded-Encrypted: i=1; AJvYcCUjChb2+Ro6MulIpKrf3djth0Rnqhn+HvNmKhhDSeGqvSCISE0SLpAvIZ06iNghCSblsTWw5on02pO5Xy3M8ZkpuUU= X-Gm-Message-State: AOJu0YxdcHN6w2j1FyXBghC9FdZviJWpkkcnmyUE90Oi1U2t/FcBjroj M5Mu6KZLHLv/ADg+8Zsh/E66kqWACy9Yyyqogtzlt3NYYeWnDeip6I3RD4g3+/8= X-Google-Smtp-Source: AGHT+IHmFd2m5CBKvzK5k3i8fLODdswNsgNMEnNccU6hMgsi68rJFyx72Ggm1uvQlSg441yXaAhOiw== 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> MIME-Version: 1.0 X-Rspamd-Queue-Id: D6407100003 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: dfw8q9noriiras7x1b5g1x5py36fzf1i X-HE-Tag: 1708008976-721453 X-HE-Meta: U2FsdGVkX19MPYMQD9QGBAnR3/Bf3t6/7lrwxjqm9iSDIk/8JEtGhCU3auCOKq1JrB1J3JqBDFnIBpDXy2pV+H7GvToJK2v+BoFU7F0zZ0lI249ksp2QXRj+qqBZpbMYziAxIwsvTpKsazCfqt4F+8EzjvHPfhr7k5MwtccL7aNgUCw6nrYrtWS6JqCWun59M99WdCOvdGalrRXgY4M+HxkaUCvGlI8jU60GJK8LjLD7db2wLRsEnPqmyffWs0cHgmborYFWssE1vDq19a2y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eqlk5vpMnLs7IPQzpoWCdlpHV5Rd2waKG4LN/6umIC2l04VlF0oqC4J6ww5hqtNI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 */