From patchwork Mon Oct 4 13:45:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12533965 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF37EC433F5 for ; Mon, 4 Oct 2021 13:50:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9B8DC61207 for ; Mon, 4 Oct 2021 13:50:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9B8DC61207 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 100FE940016; Mon, 4 Oct 2021 09:50:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B10494000B; Mon, 4 Oct 2021 09:50:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE2D1940016; Mon, 4 Oct 2021 09:50:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id DB75094000B for ; Mon, 4 Oct 2021 09:50:51 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8E5891809AF04 for ; Mon, 4 Oct 2021 13:50:51 +0000 (UTC) X-FDA: 78658890702.32.605CD7A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 453BB4001C7D for ; Mon, 4 Oct 2021 13:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=6Mxw6bpAxr2NSxJJKy2lgXKhcK5iMbJlpNLhXDkeTF4=; b=k0hz3fOknhQI9l6h6IJS+7ulvZ jkETpv1NimVjLNhUsGIGfj07EmC46naotqbbesUT4fLGeAsmi1Fk+IsXswvNFELqUa1noFtfrplwJ C1JGcdlN4qiLOsjForlEPnK7DwryHeGaKCrGtB97eIDyZ0tFVob8bPgIkNBW5J7GRUnuf3T/zzdwI fX497WOPIo9WPUHxiQyhNgcapc6DP1yHcJDl3UrhkJVUQ1EWFpIYfbEkRIMlAL5irvgfNkSjawzdH AiDI7YWV0c5dJrwg3i4oxX8uUnGPZC4UPt6AW8Lhw9pyw6PWntL0Rf56gS0F2HNl0DJSzarQXtb9S SGy6NHVQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOJk-00Gv4s-Pz; Mon, 04 Oct 2021 13:48:39 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 01/62] mm: Convert page_to_section() to pgflags_section() Date: Mon, 4 Oct 2021 14:45:49 +0100 Message-Id: <20211004134650.4031813-2-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004134650.4031813-1-willy@infradead.org> References: <20211004134650.4031813-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 453BB4001C7D X-Stat-Signature: n1pr6ohuttkeanhqmse5bofy7qeikfyj Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=k0hz3fOk; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-HE-Tag: 1633355451-394470 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: Pass the page->flags to this function instead of the struct page. This is in preparation for splitting struct page into separate types. Signed-off-by: Matthew Wilcox (Oracle) --- include/asm-generic/memory_model.h | 2 +- include/linux/mm.h | 4 ++-- mm/sparse.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index a2c8ed60233a..ee9c285f5af2 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h @@ -32,7 +32,7 @@ */ #define __page_to_pfn(pg) \ ({ const struct page *__pg = (pg); \ - int __sec = page_to_section(__pg); \ + int __sec = pgflags_section(__pg->flags); \ (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \ }) diff --git a/include/linux/mm.h b/include/linux/mm.h index 73a52aba448f..db63653f403c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1553,9 +1553,9 @@ static inline void set_page_section(struct page *page, unsigned long section) page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; } -static inline unsigned long page_to_section(const struct page *page) +static inline unsigned long pgflags_section(unsigned long pgflags) { - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; + return (flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; } #endif diff --git a/mm/sparse.c b/mm/sparse.c index 120bc8ea5293..4c59ed8c1d5a 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -45,7 +45,7 @@ static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned; int page_to_nid(const struct page *page) { - return section_to_node_table[page_to_section(page)]; + return section_to_node_table[pgflags_section(page->flags)]; } EXPORT_SYMBOL(page_to_nid);