From a46d5ea00779400f7e7eb60d497b1f23d4d29c3a Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Sun, 29 Sep 2024 22:05:56 +0000 Subject: [PATCH] Revert "mm: remove PG_error" This reverts commit 09022bc196d23484a7a5d48cf373f8583e3fcf23. This is commit needs to be reinstated as PG_error is still used by incfs. Bug: 367265496 Change-Id: Iaaf98f9d0c3e9d919ba87862fcf249d685b91a91 Signed-off-by: Matthias Maennich --- fs/proc/page.c | 1 + include/linux/page-flags.h | 6 +++++- include/trace/events/mmflags.h | 1 + include/uapi/linux/kernel-page-flags.h | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index a55f5acefa97..7aae7a2d3e66 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -182,6 +182,7 @@ u64 stable_page_flags(const struct page *page) #endif u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); + u |= kpf_copy_bit(k, KPF_ERROR, PG_error); u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty); u |= kpf_copy_bit(k, KPF_UPTODATE, PG_uptodate); u |= kpf_copy_bit(k, KPF_WRITEBACK, PG_writeback); diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 1b3a76710487..4a84bb251fe3 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -66,6 +66,8 @@ * PG_referenced, PG_reclaim are used for page reclaim for anonymous and * file-backed pagecache (see mm/vmscan.c). * + * PG_error is set to indicate that an I/O error occurred on this page. + * * PG_arch_1 is an architecture specific page state bit. The generic code * guarantees that this bit is cleared for a page when it first is entered into * the page cache. @@ -101,6 +103,7 @@ enum pageflags { PG_waiters, /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */ PG_active, PG_workingset, + PG_error, PG_owner_priv_1, /* Owner use. If pagecache, fs may use */ PG_owner_2, /* Owner use. If pagecache, fs may use */ PG_arch_1, @@ -184,7 +187,7 @@ enum pageflags { */ /* At least one page in this folio has the hwpoison flag set */ - PG_has_hwpoisoned = PG_active, + PG_has_hwpoisoned = PG_error, PG_large_rmappable = PG_workingset, /* anon or file-backed */ PG_partially_mapped = PG_reclaim, /* was identified to be partially mapped */ }; @@ -508,6 +511,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } __PAGEFLAG(Locked, locked, PF_NO_TAIL) FOLIO_FLAG(waiters, FOLIO_HEAD_PAGE) +PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) FOLIO_FLAG(referenced, FOLIO_HEAD_PAGE) FOLIO_TEST_CLEAR_FLAG(referenced, FOLIO_HEAD_PAGE) __FOLIO_SET_FLAG(referenced, FOLIO_HEAD_PAGE) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index bb8a59c6caa2..c9a286d72c26 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -100,6 +100,7 @@ #define __def_pageflag_names \ DEF_PAGEFLAG_NAME(locked), \ DEF_PAGEFLAG_NAME(waiters), \ + DEF_PAGEFLAG_NAME(error), \ DEF_PAGEFLAG_NAME(referenced), \ DEF_PAGEFLAG_NAME(uptodate), \ DEF_PAGEFLAG_NAME(dirty), \ diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h index ff8032227876..6f2f2720f3ac 100644 --- a/include/uapi/linux/kernel-page-flags.h +++ b/include/uapi/linux/kernel-page-flags.h @@ -7,7 +7,7 @@ */ #define KPF_LOCKED 0 -#define KPF_ERROR 1 /* Now unused */ +#define KPF_ERROR 1 #define KPF_REFERENCED 2 #define KPF_UPTODATE 3 #define KPF_DIRTY 4