linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch v4 0/2] mm_slot: fix the usage of mm_slot_entry()
@ 2025-09-27  0:45 Wei Yang
  2025-09-27  0:45 ` [Patch v4 1/2] mm/ksm: don't call mm_slot_entry() when the slot is NULL Wei Yang
  2025-09-27  0:45 ` [Patch v4 2/2] mm/khugepaged: remove definition of struct khugepaged_mm_slot Wei Yang
  0 siblings, 2 replies; 12+ messages in thread
From: Wei Yang @ 2025-09-27  0:45 UTC (permalink / raw)
  To: akpm, david, lorenzo.stoakes, ziy, baolin.wang, Liam.Howlett,
	npache, ryan.roberts, dev.jain, baohua, lance.yang, xu.xin16,
	chengming.zhou
  Cc: linux-mm, Wei Yang

The usage of mm_slot_entry() in ksm/khugepaged is not correct. In case
mm_slot_lookup() return a NULL slot, mm_slot_entry() should not be called.

To fix this:

Patch 1: check slot before continue in ksm.c
Patch 2: remove the definition of khugepaged_mm_slot

v4:
  * adjust change log
  * use invert style in patch 1
  * rename slab to "mm_slot"

v3:
  fix a pf because of slot change
  fix uninitialized mm_slot

v2:
  fix the error in code instead guard by compiler

V1:
  add a BUILD_BUG_ON_MSG() to make sure slot is the first element

[1]: https://lkml.kernel.org/r/20250914000026.17986-1-richard.weiyang@gmail.com
[2]: https://lkml.kernel.org/r/20250919071244.17020-1-richard.weiyang@gmail.com
[3]: https://lkml.kernel.org/r/20250924004854.29889-1-richard.weiyang@gmail.com

Wei Yang (2):
  mm/ksm: don't call mm_slot_entry() when the slot is NULL
  mm/khugepaged: remove definition of struct khugepaged_mm_slot

 mm/khugepaged.c | 55 ++++++++++++++++---------------------------------
 mm/ksm.c        | 23 ++++++++++++---------
 2 files changed, 31 insertions(+), 47 deletions(-)

-- 
2.34.1



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

end of thread, other threads:[~2025-09-30  6:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-27  0:45 [Patch v4 0/2] mm_slot: fix the usage of mm_slot_entry() Wei Yang
2025-09-27  0:45 ` [Patch v4 1/2] mm/ksm: don't call mm_slot_entry() when the slot is NULL Wei Yang
2025-09-27  8:39   ` Muhammad Usama Anjum
2025-09-28 13:53   ` Dev Jain
2025-09-29  8:13   ` David Hildenbrand
2025-09-29 10:58   ` Kiryl Shutsemau
2025-09-29 15:14   ` Zi Yan
2025-09-27  0:45 ` [Patch v4 2/2] mm/khugepaged: remove definition of struct khugepaged_mm_slot Wei Yang
2025-09-27  8:40   ` Muhammad Usama Anjum
2025-09-29  8:13   ` David Hildenbrand
2025-09-29 15:16   ` Zi Yan
2025-09-30  6:01   ` Raghavendra K T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox