From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, david@redhat.com,
lorenzo.stoakes@oracle.com, ziy@nvidia.com,
baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com,
npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, lance.yang@linux.dev, xu.xin16@zte.com.cn,
chengming.zhou@linux.dev
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>
Subject: [Patch v4 0/2] mm_slot: fix the usage of mm_slot_entry()
Date: Sat, 27 Sep 2025 00:45:37 +0000 [thread overview]
Message-ID: <20250927004539.19308-1-richard.weiyang@gmail.com> (raw)
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
next reply other threads:[~2025-09-27 0:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-27 0:45 Wei Yang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250927004539.19308-1-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=chengming.zhou@linux.dev \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=npache@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=xu.xin16@zte.com.cn \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox