linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	David Hildenbrand <david@redhat.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <ying.huang@intel.com>,
	Zi Yan <ziy@nvidia.com>, Kefeng Wang <wangkefeng.wang@huawei.com>
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	[thread overview]
Message-ID: <20230926005254.2861577-10-wangkefeng.wang@huawei.com> (raw)
In-Reply-To: <20230926005254.2861577-1-wangkefeng.wang@huawei.com>

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 <wangkefeng.wang@huawei.com>
---
 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);
-- 
2.27.0



      parent reply	other threads:[~2023-09-26  0:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  0:52 [PATCH -next rfc 0/9] mm: convert page cpupid functions to folios Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 1/9] mm_types: add _last_cpupid into folio Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 2/9] mm: mprotect: use a folio in change_pte_range() Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 3/9] mm: huge_memory: use a folio in change_huge_pmd() Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 4/9] mm: convert xchg_page_access_time to xchg_folio_access_time() Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 5/9] mm: convert page_cpupid_last() to folio_cpupid_last() Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 6/9] mm: make wp_page_reuse() and finish_mkwrite_fault() to take a folio Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 7/9] mm: convert page_cpupid_xchg_last() to folio_cpupid_xchg_last() Kefeng Wang
2023-09-26  0:52 ` [PATCH -next 8/9] mm: page_alloc: use a folio in free_pages_prepare() Kefeng Wang
2023-09-26  7:49   ` David Hildenbrand
2023-09-26  9:39     ` Kefeng Wang
2023-09-27 12:08       ` Kefeng Wang
2023-09-26  0:52 ` Kefeng Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926005254.2861577-10-wangkefeng.wang@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox