* [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters
@ 2026-10-28 13:46 Zhan Xusheng
2026-10-28 13:46 ` [PATCH 2/2] mm/slab: don't queue the page cache work under krcp->lock Zhan Xusheng
2026-10-28 15:23 ` [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters Harry Yoo
0 siblings, 2 replies; 3+ messages in thread
From: Zhan Xusheng @ 2026-10-28 13:46 UTC (permalink / raw)
To: vbabka, harry
Cc: urezki, paulmck, qiang.zhang, akpm, hao.li, cl, rientjes,
roman.gushchin, linux-mm, rcu, linux-kernel, zhanxusheng
From: Zhan Xusheng <zhanxusheng@xiaomi.com>
The move of kvfree_rcu() to mm/slab_common.c dropped the "rcutree."
MODULE_PARAM_PREFIX, so rcu_min_cached_objs and
rcu_delay_page_cache_fill_msec became slab_common.* and the documented
rcutree.* names are silently ignored. Restore the prefix; the
slab_common.* names, never documented, stop working.
Fixes: bbe658d65802 ("mm/slab: Move kvfree_rcu() into SLAB")
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
---
mm/slab_common.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 01c64ef661e7..3729aa7a6156 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1373,6 +1373,10 @@ void __init kvfree_rcu_init(void)
* per-CPU. Object size is equal to one page. This value
* can be changed at boot time.
*/
+/* These used to be rcutree parameters; keep their documented names. */
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "rcutree."
+
static int rcu_min_cached_objs = 5;
module_param(rcu_min_cached_objs, int, 0444);
base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] mm/slab: don't queue the page cache work under krcp->lock
2026-10-28 13:46 [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters Zhan Xusheng
@ 2026-10-28 13:46 ` Zhan Xusheng
2026-10-28 15:23 ` [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters Harry Yoo
1 sibling, 0 replies; 3+ messages in thread
From: Zhan Xusheng @ 2026-10-28 13:46 UTC (permalink / raw)
To: vbabka, harry
Cc: urezki, paulmck, qiang.zhang, akpm, hao.li, cl, rientjes,
roman.gushchin, linux-mm, rcu, linux-kernel, zhanxusheng
From: Zhan Xusheng <zhanxusheng@xiaomi.com>
run_page_cache_worker() runs under krcp->lock, from kvfree_call_rcu()
callers that may hold more, such as set_cpus_allowed_force() under
pi_lock, so it kicks the refill work from an hrtimer. Under memory
pressure it instead queues the work with a delay of
rcutree.rcu_delay_page_cache_fill_msec, which may be 0, and a zero delay
queues it at once, taking pool->lock under krcp->lock.
With the delay set to 0, calling kvfree_rcu() on vmalloc memory under
pi_lock after a drop_caches makes lockdep report:
Chain exists of:
&pool->lock --> &p->pi_lock --> krc.lock
Use the hrtimer when the delay is 0.
Fixes: d0bfa8b3c411 ("kvfree_rcu: Release a page cache under memory pressure")
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
---
mm/slab_common.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 3729aa7a6156..ef5ff0a20249 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1987,7 +1987,13 @@ run_page_cache_worker(struct kfree_rcu_cpu *krcp)
if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING &&
!atomic_xchg(&krcp->work_in_progress, 1)) {
- if (atomic_read(&krcp->backoff_page_cache_fill)) {
+ /*
+ * A zero delay would queue the work right here, under
+ * krcp->lock and possibly the caller's pi_lock, so let the
+ * hrtimer do it.
+ */
+ if (atomic_read(&krcp->backoff_page_cache_fill) &&
+ rcu_delay_page_cache_fill_msec) {
queue_delayed_work(rcu_reclaim_wq,
&krcp->page_cache_work,
msecs_to_jiffies(rcu_delay_page_cache_fill_msec));
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters
2026-10-28 13:46 [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters Zhan Xusheng
2026-10-28 13:46 ` [PATCH 2/2] mm/slab: don't queue the page cache work under krcp->lock Zhan Xusheng
@ 2026-10-28 15:23 ` Harry Yoo
1 sibling, 0 replies; 3+ messages in thread
From: Harry Yoo @ 2026-10-28 15:23 UTC (permalink / raw)
To: Zhan Xusheng
Cc: vbabka, urezki, paulmck, qiang.zhang, akpm, hao.li, cl, rientjes,
roman.gushchin, linux-mm, rcu, linux-kernel, zhanxusheng
On Wed, Oct 28, 2026 at 09:46:46PM +0800, Zhan Xusheng wrote:
> From: Zhan Xusheng <zhanxusheng@xiaomi.com>
>
> The move of kvfree_rcu() to mm/slab_common.c dropped the "rcutree."
> MODULE_PARAM_PREFIX, so rcu_min_cached_objs and
> rcu_delay_page_cache_fill_msec became slab_common.* and the documented
> rcutree.* names are silently ignored. Restore the prefix; the
> slab_common.* names, never documented, stop working.
>
> Fixes: bbe658d65802 ("mm/slab: Move kvfree_rcu() into SLAB")
We should add:
Cc: stable@vger.kernel.org
This is a functional regression and in MM we don't automatically
backport fixes to -stable unless without this tag.
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
> ---
> mm/slab_common.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 01c64ef661e7..3729aa7a6156 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -1373,6 +1373,10 @@ void __init kvfree_rcu_init(void)
> * per-CPU. Object size is equal to one page. This value
> * can be changed at boot time.
> */
> +/* These used to be rcutree parameters; keep their documented names. */
> +#undef MODULE_PARAM_PREFIX
> +#define MODULE_PARAM_PREFIX "rcutree."
This should be moved to before "This rcu parameter is
runtime-read-only ..." part?
And perhaps let's rephrase the comment, something like:
/* Keep the prefix inherited from RCU */
With that adjusted, otherwise looks good to me, so:
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
--
Cheers,
Harry / Hyeonggon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-28 15:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 13:46 [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters Zhan Xusheng
2026-10-28 13:46 ` [PATCH 2/2] mm/slab: don't queue the page cache work under krcp->lock Zhan Xusheng
2026-10-28 15:23 ` [PATCH 1/2] mm/slab: restore the rcutree. prefix of the kvfree_rcu parameters Harry Yoo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®