linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linux-mm@kvack.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH 1/3] mm: prefix page_cpupid_reset_last as non-atomic
Date: Sun, 20 Dec 2020 15:03:38 +1000	[thread overview]
Message-ID: <20201220050340.849754-1-npiggin@gmail.com> (raw)

Add a __ prefix to indicate that it should be used in non-atomic
situations (where the page is not subject to concurrent flags
access, following the pattern of the other page flags modifications).

This prepares for an atomic version.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 include/linux/mm.h | 6 +++---
 mm/page_alloc.c    | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 855161080f18..5b3fc2c8fd8b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1358,7 +1358,7 @@ static inline int page_cpupid_last(struct page *page)
 {
 	return page->_last_cpupid;
 }
-static inline void page_cpupid_reset_last(struct page *page)
+static inline void __page_cpupid_reset_last(struct page *page)
 {
 	page->_last_cpupid = -1 & LAST_CPUPID_MASK;
 }
@@ -1370,7 +1370,7 @@ static inline int page_cpupid_last(struct page *page)
 
 extern int page_cpupid_xchg_last(struct page *page, int cpupid);
 
-static inline void page_cpupid_reset_last(struct page *page)
+static inline void __page_cpupid_reset_last(struct page *page)
 {
 	page->flags |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT;
 }
@@ -1411,7 +1411,7 @@ static inline bool cpupid_pid_unset(int cpupid)
 	return true;
 }
 
-static inline void page_cpupid_reset_last(struct page *page)
+static inline void __page_cpupid_reset_last(struct page *page)
 {
 }
 
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3beeb8d722f3..ead28946f3ce 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1260,7 +1260,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
 	if (bad)
 		return false;
 
-	page_cpupid_reset_last(page);
+	__page_cpupid_reset_last(page);
 	page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
 	reset_page_owner(page, order);
 
@@ -1453,7 +1453,7 @@ static 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_cpupid_reset_last(page);
 	page_kasan_tag_reset(page);
 
 	INIT_LIST_HEAD(&page->lru);
-- 
2.23.0



             reply	other threads:[~2020-12-20  5:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-20  5:03 Nicholas Piggin [this message]
2020-12-20  5:03 ` [PATCH 2/3] mm: add page_cpupid_reset_last atomic variant Nicholas Piggin
2020-12-20  5:03 ` [PATCH 3/3] mm: skip page_cpupid_reset_last atomic update if the value is already reset Nicholas Piggin
2020-12-21  1:53 ` [PATCH 1/3] mm: prefix page_cpupid_reset_last as non-atomic huang ying

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=20201220050340.849754-1-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=peterz@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).