linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-mm@kvack.org
Subject: [PATCH] fix-proc-page
Date: Wed,  3 Apr 2024 18:31:11 +0100	[thread overview]
Message-ID: <20240403173112.1450721-1-willy@infradead.org> (raw)

Dan reported I'd messed up some bits vs masks here:
https://lore.kernel.org/linux-fsdevel/1a6dc6a5-b5b6-494c-b94b-f6655da51bb9@moroto.mountain/T/#u

Please add as a fix for "proc: rewrite stable_page_flags()"

---
 fs/proc/page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/page.c b/fs/proc/page.c
index 55b01535eb22..2fb64bdb64eb 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -153,7 +153,7 @@ u64 stable_page_flags(const struct page *page)
 	 * to make sure a given page is a thp, not a non-huge compound page.
 	 */
 	else if (folio_test_large(folio)) {
-		if ((k & PG_lru) || is_anon)
+		if ((k & (1 << PG_lru)) || is_anon)
 			u |= 1 << KPF_THP;
 		else if (is_huge_zero_folio(folio)) {
 			u |= 1 << KPF_ZERO_PAGE;
@@ -205,7 +205,7 @@ u64 stable_page_flags(const struct page *page)
 	u |= kpf_copy_bit(k, KPF_MLOCKED,	PG_mlocked);
 
 #ifdef CONFIG_MEMORY_FAILURE
-	if (u & KPF_HUGE)
+	if (u & (1 << KPF_HUGE))
 		u |= kpf_copy_bit(k, KPF_HWPOISON,	PG_hwpoison);
 	else
 		u |= kpf_copy_bit(page->flags, KPF_HWPOISON,	PG_hwpoison);
-- 
2.43.0



                 reply	other threads:[~2024-04-03 17:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240403173112.1450721-1-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-mm@kvack.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