Re: [PATCH v2] dm thin: free thins with kfree_rcu() instead of waiting in thin_dtr()
From: Qiliang Yuan
Date: Thu Nov 19 2026 - 01:14:40 EST
On Thu, Nov 19, 2026 at 12:16:20AM -0500, Benjamin Marzinski wrote:
> Qiliang, does this version work for you? Could you rerun the timing?
It works. I applied it on top of mainline 63fdb511c27af plus v2 1/3, the
thin_ctr() patch, with a test-only 3 s msleep() added to the pool worker
after each thin it walks. Thins 1 and 2 of a three-thin pool are
suspended and then removed while the worker holds thin 1:
- With your patch, KASAN reports nothing in 5 of 5 trials.
- With v2 1/3 alone, the guest crashes on the first trial; earlier
runs of the same test reported a slab-use-after-free in
get_next_thin() in 3 of 3.
A 300 s run of thins being created and removed while the worker walks
the list, on the same KASAN and lockdep kernel, logged no kernel errors.
Removing 100 thin devices of an idle pool with dmsetup remove takes per
device (same boot, mean of five rounds, min-max of the rounds in
parentheses). All kernels are mainline 63fdb511c27af with the patches
listed; the change is against "v2 1/3", the thin_ctr() patch alone:
patches on top of mainline remove (ms) change
none 17.0 (16.6-17.6)
v2 1/3 16.8 (16.5-17.1)
v2 1/3 + your [PATCH v2] 13.9 (13.1-14.6) -17%
v2 1/3, 2/3 and 3/3 14.1 (13.7-14.4) -16%
Thanks,
Qiliang