linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch v3 0/2] mm_slot: fix the usage of mm_slot_entry
@ 2025-09-24  0:48 Wei Yang
  2025-09-24  0:48 ` [Patch v3 1/2] mm/ksm: get mm_slot by mm_slot_entry() when slot is !NULL Wei Yang
  2025-09-24  0:48 ` [Patch v3 2/2] mm/khugepaged: remove definition of struct khugepaged_mm_slot Wei Yang
  0 siblings, 2 replies; 16+ messages in thread
From: Wei Yang @ 2025-09-24  0:48 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

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

Wei Yang (2):
  mm/ksm: get mm_slot by mm_slot_entry() when slot is !NULL
  mm/khugepaged: remove definition of struct khugepaged_mm_slot

 mm/khugepaged.c | 58 ++++++++++++++++++-------------------------------
 mm/ksm.c        | 22 ++++++++++---------
 2 files changed, 33 insertions(+), 47 deletions(-)

-- 
2.34.1



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

end of thread, other threads:[~2025-09-24 14:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-24  0:48 [Patch v3 0/2] mm_slot: fix the usage of mm_slot_entry Wei Yang
2025-09-24  0:48 ` [Patch v3 1/2] mm/ksm: get mm_slot by mm_slot_entry() when slot is !NULL Wei Yang
2025-09-24  2:19   ` Chengming Zhou
2025-09-24  9:35   ` Kiryl Shutsemau
2025-09-24  9:40     ` David Hildenbrand
2025-09-24 10:06       ` Kiryl Shutsemau
2025-09-24 10:09         ` David Hildenbrand
2025-09-24 10:15           ` Kiryl Shutsemau
2025-09-24 10:42             ` David Hildenbrand
2025-09-24 14:52               ` Wei Yang
2025-09-24  9:35   ` David Hildenbrand
2025-09-24  0:48 ` [Patch v3 2/2] mm/khugepaged: remove definition of struct khugepaged_mm_slot Wei Yang
2025-09-24  3:18   ` Lance Yang
2025-09-24  5:51   ` Dev Jain
2025-09-24  9:39   ` David Hildenbrand
2025-09-24 14:59     ` Wei Yang

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