From patchwork Tue Sep 26 00:52:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13398588 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 5D3E4E6FE31 for ; Tue, 26 Sep 2023 00:53:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE55D8D005E; Mon, 25 Sep 2023 20:53:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D19D78D0005; Mon, 25 Sep 2023 20:53:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE1FA8D005E; Mon, 25 Sep 2023 20:53:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B01178D0005 for ; Mon, 25 Sep 2023 20:53:21 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 83FEB40D38 for ; Tue, 26 Sep 2023 00:53:21 +0000 (UTC) X-FDA: 81276925002.27.7590313 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf15.hostedemail.com (Postfix) with ESMTP id 26891A0036 for ; Tue, 26 Sep 2023 00:53:17 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695689599; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0mBqhTUBjVNOhn3gad4QEbyJ4wj4oLKXxijp0qqMZg4=; b=PhJ67D6A+iIEJDuq1qLTacUUIdhGHEVwtnteLQUd6AhOOuc384wcLSKrf4zl4GGZ85Ld+q FD3vry/VqX7GQn+F6hpy8RJkIF+ir67EGb5nFhjxRcJ1Fj+YkiKVXjuCxczKJ14BY0By2b CC0aYA6p//IHS7ht2UMhK8QxPMibfNQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695689599; a=rsa-sha256; cv=none; b=AIXM3NNF109+vg0GldE7NDQei5IJpm+ih7n94VA2bUmLN5aHpLDHiRyFV041oojP8mrrQN dGe740z+DYON5+FSK4wrJkFaWjct9BYhehIfZwfIpNU7OqG8idmIJuDlfDVz363KK/TTCq HfU4h+5Usk0Jf5i8/pZ5J3vdZL6nx0M= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rvh2z45FGzMlpj; Tue, 26 Sep 2023 08:49:31 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 26 Sep 2023 08:53:12 +0800 From: Kefeng Wang To: Andrew Morton CC: Mike Rapoport , Matthew Wilcox , David Hildenbrand , , , , Zi Yan , Kefeng Wang Subject: [PATCH -next 9/9] mm: convert page_cpupid_reset_last() to folio_cpupid_reset_last() Date: Tue, 26 Sep 2023 08:52:54 +0800 Message-ID: <20230926005254.2861577-10-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230926005254.2861577-1-wangkefeng.wang@huawei.com> References: <20230926005254.2861577-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 26891A0036 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 8c7eukpihgt71da4jofsmq7pm5qsonkz X-HE-Tag: 1695689597-618698 X-HE-Meta: U2FsdGVkX19KkCCnubHgFjsePcIjCRhvCsxNODtFjc8dtDefNDRsqpoMoVY2qMwR9iS2eNCVV/furZvJdr2JMAG5zR5ybj6EHHS+vBtBeS4eY9FppgUrHFXalBTVFVwpdv+MW/xCALxxRxwaekcEkGttpMzWG9vdNiPHnmg+Lk637EIwKwgbIylFTfImeKFw5dVs5V69z/NNxxcZFgLn4xMwHhpuz+7TKD4pgi53cIPh6aSsfTNtNIsMk+YoWb0ig8nOuNJRyJAX++MG84xMrg0A73xHvGyp00EBBGyjN9ZmYPUn+Q+tHh7xn4QqSfckwHeznYzTjqCYR2VyKeqmgTeKhwkMw4TuJhPhRNAFA0bgd3OXnpyJhuZNOSSzqnL851+wwJJzzBgFUQExBoXutbXx7H2EBMaRQifVG8h7YKSlY1lQw3f95n6bYQ/LuAxaDCMqkDoxVteh3M4zfYRUhfPKnv8ZxrtguJAd6TKdtee0f6gm0RTvRyXGI1SRAak09K1saDabna53rVxBs8wcww3MWzbdxf60SZYc0gLAQ3YFWIxy8xf/6MbUvzHqyS1s0ZvcUcr2dMXwKtM91ez8cLXYc5+FYZrzyNdfwfmyJA3nFzWdtssqM7aPE/iBAstTwAkvRV8Z6AjPPYMaNLbbpDnnuuI+8tXkz2sCTCCZQpfZNq8JfGqJCT0ERFvNg5yzSW4RR+7WI4EBPEyK3jIZEfjiJ75VWP+nn2fxiLbplcXklXz8CfD0wjA/ehP/N0iOPRSNrzkchKXrZ17o8KEQdl62HM2bssv7pSDHCKzIy4KzDWESh4/rGYsfjJz/xkKFcslYTUVBus0bp3Xa0x8XAR6MnuNIihynn7N+e38jCC3EUAm5P1coPsSZ9xInxLUSHiwLNxWXY68XgT1sRubxCd9+ITn0OjoJp/xp+ETWzlFf+i758ADPz/l5jW7vbR1iKQPGbiXvyjBr1/eBtau v2IYAb2S N7MKpMO7Fq/oeuxFCrxd4+UvU9uRadibAwb4kxLcjEjrZETRU+EOBqEFtsb2yqzDf5mm9t45HMtTaGDzjgr+Vre3NGII6N/U6Pi1AkswmPUeQ0gYtTRYdDfEAgpYP1k/bObTv5AbbTKrgokYvY8ybEIDw1uZZmkihRnDw/OHyt4GegdEaXzOFgT8zn2BMlpHJNP2r 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: It isn't need to fill the default cpupid value for all the struct page, since cpupid is only used for numa balancing, and the pages for numa balancing are all from buddy, page_cpupid_reset_last() is already called by free_pages_prepare() to initialize it, so let's drop the page_cpupid_reset_last() in __init_single_page(), then make page_cpupid_reset_last() to take a folio and rename it to folio_cpupid_reset_last(). Signed-off-by: Kefeng Wang --- include/linux/mm.h | 10 +++++----- mm/mm_init.c | 1 - mm/page_alloc.c | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a6f4b55bf469..ca66a05eb2ed 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1692,9 +1692,9 @@ static inline int folio_cpupid_last(struct folio *folio) { return folio->_last_cpupid; } -static inline void page_cpupid_reset_last(struct page *page) +static inline void folio_cpupid_reset_last(struct folio *folio) { - page->_last_cpupid = -1 & LAST_CPUPID_MASK; + folio->_last_cpupid = -1 & LAST_CPUPID_MASK; } #else static inline int folio_cpupid_last(struct folio *folio) @@ -1704,9 +1704,9 @@ static inline int folio_cpupid_last(struct folio *folio) extern int folio_cpupid_xchg_last(struct folio *folio, int cpupid); -static inline void page_cpupid_reset_last(struct page *page) +static inline void folio_cpupid_reset_last(struct folio *folio) { - page->flags |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT; + folio->flags |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT; } #endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */ @@ -1769,7 +1769,7 @@ static inline bool cpupid_pid_unset(int cpupid) return true; } -static inline void page_cpupid_reset_last(struct page *page) +static inline void folio_cpupid_reset_last(struct folio *folio) { } diff --git a/mm/mm_init.c b/mm/mm_init.c index 06a72c223bce..74c0dc27fbf1 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -563,7 +563,6 @@ void __meminit __init_single_page(struct page *page, unsigned long pfn, set_page_links(page, zone, nid, pfn); init_page_count(page); page_mapcount_reset(page); - page_cpupid_reset_last(page); page_kasan_tag_reset(page); INIT_LIST_HEAD(&page->lru); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a888b9d57751..852fc78ddb34 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1126,7 +1126,7 @@ static __always_inline bool free_pages_prepare(struct page *page, return false; } - page_cpupid_reset_last(page); + folio_cpupid_reset_last(folio); page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; reset_page_owner(page, order); page_table_check_free(page, order);