diff mbox series

fix-proc-page

Message ID 20240403173112.1450721-1-willy@infradead.org (mailing list archive)
State New
Headers show
Series fix-proc-page | expand

Commit Message

Matthew Wilcox April 3, 2024, 5:31 p.m. UTC
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 mbox series

Patch

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);