All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] mm/ksm: catch tail page abnormal in page_stable_node
@ 2024-03-18 12:14 alexs
  2024-03-18 12:25 ` David Hildenbrand
  2024-03-18 13:14 ` Matthew Wilcox
  0 siblings, 2 replies; 6+ messages in thread
From: alexs @ 2024-03-18 12:14 UTC (permalink / raw)
  To: kasong, Andrew Morton, open list:MEMORY MANAGEMENT, open list

From: Alex Shi <alexs@kernel.org>

commit 19138349ed59 ("mm/migrate: Add folio_migrate_flags()") change the
meaning of func page_stable_node() to check the compound head for tail
'page' instead of tail page self.
But seems both semantics are same at results, the func always return NULL
 for tail page. So adding a bug monitor here in case of abnormal.

Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: Izik Eidus <izik.eidus@ravellosystems.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Chris Wright <chrisw@sous-sol.org>
To: linux-kernel@vger.kernel.org
To: linux-mm@kvack.org
To: Andrew Morton <akpm@linux-foundation.org>
---
 mm/ksm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index 8c001819cf10..3ff469961927 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1091,7 +1091,12 @@ static inline struct ksm_stable_node *folio_stable_node(struct folio *folio)
 
 static inline struct ksm_stable_node *page_stable_node(struct page *page)
 {
-	return folio_stable_node(page_folio(page));
+	struct ksm_stable_node *node;
+
+	node = folio_stable_node(page_folio(page));
+	VM_BUG_ON_PAGE(PageTail(page) && node, page);
+
+	return node;
 }
 
 static inline void set_page_stable_node(struct page *page,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-20 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 12:14 [PATCH 01/12] mm/ksm: catch tail page abnormal in page_stable_node alexs
2024-03-18 12:25 ` David Hildenbrand
2024-03-20  9:05   ` Alex Shi
2024-03-20  9:29     ` David Hildenbrand
2024-03-20 12:03       ` Alex Shi
2024-03-18 13:14 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.