VM_BUG_ON_PAGE(PageAnonNotKsm(page)) defconfig riscv64
Nam Cao
namcao at linutronix.de
Fri Oct 4 12:12:10 PDT 2024
On Fri, Oct 04, 2024 at 03:09:22PM +0200, Miguel Ojeda wrote:
> Hi Matthew,
>
> I noticed riscv64 defconfig seems to reproducibly hit
> `VM_BUG_ON_PAGE(PageAnonNotKsm(page))` in today's next-20241004 --
> please see below.
>
> I hope that helps!
I can also reproduce this on arm64 with CONFIG_DEBUG_VM_PGFLAGS=y.
Looks like an invert logic bug from:
https://lore.kernel.org/linux-mm/20241002152533.1350629-5-willy@infradead.org/
I made the below changes and the problem goes away.
Best regards,
Nam
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index fe9abdf26ab0..ccf3c78faefc 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1131,14 +1131,14 @@ static __always_inline int PageAnonExclusive(const struct page *page)
static __always_inline void SetPageAnonExclusive(struct page *page)
{
- VM_BUG_ON_PGFLAGS(PageAnonNotKsm(page), page);
+ VM_BUG_ON_PGFLAGS(!PageAnonNotKsm(page), page);
VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
set_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
}
static __always_inline void ClearPageAnonExclusive(struct page *page)
{
- VM_BUG_ON_PGFLAGS(PageAnonNotKsm(page), page);
+ VM_BUG_ON_PGFLAGS(!PageAnonNotKsm(page), page);
VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
}
More information about the linux-riscv
mailing list