From: Vlastimil Babka <vbabka@suse.cz>
To: "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: RCU <rcu@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>,
stable@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v1 2/2] mm/slab/kvfree_rcu: Switch to WQ_MEM_RECLAIM wq
Date: Fri, 28 Feb 2025 15:42:02 +0100 [thread overview]
Message-ID: <c4d0005d-ae34-40d4-80a0-67ca904cdae1@suse.cz> (raw)
In-Reply-To: <20250228121356.336871-2-urezki@gmail.com>
On 2/28/25 13:13, Uladzislau Rezki (Sony) wrote:
> Currently kvfree_rcu() APIs use a system workqueue which is
> "system_unbound_wq" to driver RCU machinery to reclaim a memory.
>
> Recently, it has been noted that the following kernel warning can
> be observed:
>
> <snip>
> workqueue: WQ_MEM_RECLAIM nvme-wq:nvme_scan_work is flushing !WQ_MEM_RECLAIM events_unbound:kfree_rcu_work
> WARNING: CPU: 21 PID: 330 at kernel/workqueue.c:3719 check_flush_dependency+0x112/0x120
> Modules linked in: intel_uncore_frequency(E) intel_uncore_frequency_common(E) skx_edac(E) ...
> CPU: 21 UID: 0 PID: 330 Comm: kworker/u144:6 Tainted: G E 6.13.2-0_g925d379822da #1
> Hardware name: Wiwynn Twin Lakes MP/Twin Lakes Passive MP, BIOS YMM20 02/01/2023
> Workqueue: nvme-wq nvme_scan_work
> RIP: 0010:check_flush_dependency+0x112/0x120
> Code: 05 9a 40 14 02 01 48 81 c6 c0 00 00 00 48 8b 50 18 48 81 c7 c0 00 00 00 48 89 f9 48 ...
> RSP: 0018:ffffc90000df7bd8 EFLAGS: 00010082
> RAX: 000000000000006a RBX: ffffffff81622390 RCX: 0000000000000027
> RDX: 00000000fffeffff RSI: 000000000057ffa8 RDI: ffff88907f960c88
> RBP: 0000000000000000 R08: ffffffff83068e50 R09: 000000000002fffd
> R10: 0000000000000004 R11: 0000000000000000 R12: ffff8881001a4400
> R13: 0000000000000000 R14: ffff88907f420fb8 R15: 0000000000000000
> FS: 0000000000000000(0000) GS:ffff88907f940000(0000) knlGS:0000000000000000
> CR2: 00007f60c3001000 CR3: 000000107d010005 CR4: 00000000007726f0
> PKRU: 55555554
> Call Trace:
> <TASK>
> ? __warn+0xa4/0x140
> ? check_flush_dependency+0x112/0x120
> ? report_bug+0xe1/0x140
> ? check_flush_dependency+0x112/0x120
> ? handle_bug+0x5e/0x90
> ? exc_invalid_op+0x16/0x40
> ? asm_exc_invalid_op+0x16/0x20
> ? timer_recalc_next_expiry+0x190/0x190
> ? check_flush_dependency+0x112/0x120
> ? check_flush_dependency+0x112/0x120
> __flush_work.llvm.1643880146586177030+0x174/0x2c0
> flush_rcu_work+0x28/0x30
> kvfree_rcu_barrier+0x12f/0x160
> kmem_cache_destroy+0x18/0x120
> bioset_exit+0x10c/0x150
> disk_release.llvm.6740012984264378178+0x61/0xd0
> device_release+0x4f/0x90
> kobject_put+0x95/0x180
> nvme_put_ns+0x23/0xc0
> nvme_remove_invalid_namespaces+0xb3/0xd0
> nvme_scan_work+0x342/0x490
> process_scheduled_works+0x1a2/0x370
> worker_thread+0x2ff/0x390
> ? pwq_release_workfn+0x1e0/0x1e0
> kthread+0xb1/0xe0
> ? __kthread_parkme+0x70/0x70
> ret_from_fork+0x30/0x40
> ? __kthread_parkme+0x70/0x70
> ret_from_fork_asm+0x11/0x20
> </TASK>
> ---[ end trace 0000000000000000 ]---
> <snip>
>
> To address this switch to use of independent WQ_MEM_RECLAIM
> workqueue, so the rules are not violated from workqueue framework
> point of view.
>
> Apart of that, since kvfree_rcu() does reclaim memory it is worth
> to go with WQ_MEM_RECLAIM type of wq because it is designed for
> this purpose.
>
> Cc: <stable@vger.kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
stable is sufficient, no need for greg himself too
> Cc: Keith Busch <kbusch@kernel.org>
> Closes: https://www.spinics.net/lists/kernel/msg5563270.html
lore pls :)
> Fixes: 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
> Reported-by: Keith Busch <kbusch@kernel.org>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
fixed locally and pushed to slab/for-next-fixes
thanks!
next prev parent reply other threads:[~2025-02-28 14:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250228121356.336871-1-urezki@gmail.com>
2025-02-28 12:13 ` [PATCH v1 2/2] mm/slab/kvfree_rcu: Switch to WQ_MEM_RECLAIM wq Uladzislau Rezki (Sony)
2025-02-28 14:42 ` Vlastimil Babka [this message]
2025-02-28 16:25 ` Uladzislau Rezki
2025-03-03 16:08 ` Joel Fernandes
2025-03-04 14:55 ` Paul E. McKenney
2025-03-06 18:26 ` Joel Fernandes
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=c4d0005d-ae34-40d4-80a0-67ca904cdae1@suse.cz \
--to=vbabka@suse.cz \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=gregkh@linuxfoundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oleksiy.avramchenko@sony.com \
--cc=penberg@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=stable@vger.kernel.org \
--cc=urezki@gmail.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