[PATCH v2 1/7] fs/proc/page: remove unneeded PageTail && PageSlab check

Kefeng Wang posted 7 patches 2 years, 1 month ago
[PATCH v2 1/7] fs/proc/page: remove unneeded PageTail && PageSlab check
Posted by Kefeng Wang 2 years, 1 month ago
After commit dcb351cd095a ("page-flags: define behavior SL*B-related
flags on compound pages"), the slab could not be a tail, remove unneeded
PageTail && PageSlab check.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 fs/proc/page.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/proc/page.c b/fs/proc/page.c
index 195b077c0fac..466efb0dadf7 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -184,9 +184,6 @@ u64 stable_page_flags(struct page *page)
 	u |= kpf_copy_bit(k, KPF_LOCKED,	PG_locked);
 
 	u |= kpf_copy_bit(k, KPF_SLAB,		PG_slab);
-	if (PageTail(page) && PageSlab(page))
-		u |= 1 << KPF_SLAB;
-
 	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);
-- 
2.27.0
Re: [PATCH v2 1/7] fs/proc/page: remove unneeded PageTail && PageSlab check
Posted by Matthew Wilcox 2 years, 1 month ago
On Fri, Nov 10, 2023 at 11:33:18AM +0800, Kefeng Wang wrote:
> After commit dcb351cd095a ("page-flags: define behavior SL*B-related
> flags on compound pages"), the slab could not be a tail, remove unneeded
> PageTail && PageSlab check.

No, that's completely wrong.

 * PF_NO_TAIL:
 *     modifications of the page flag must be done on small or head pages,
 *     checks can be done on tail pages too.

That's backed up by the code:

#define PF_NO_TAIL(page, enforce) ({                                    \
                VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page);     \
                PF_POISONED_CHECK(compound_head(page)); })

(enforce is set to 0 for the 'test')

> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

NAK