The patch titled Subject: mm: vmscan: move shrinker_debugfs_remove() before synchronize_srcu() has been added to the -mm mm-unstable branch. Its filename is mm-vmscan-move-shrinker_debugfs_remove-before-synchronize_srcu.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmscan-move-shrinker_debugfs_remove-before-synchronize_srcu.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx> Subject: mm: vmscan: move shrinker_debugfs_remove() before synchronize_srcu() Date: Thu, 1 Jun 2023 13:27:14 +0000 The debugfs_remove_recursive() will wait for debugfs_file_put() to return, so there is no need to put it after synchronize_srcu() to wait for the rcu read-side critical section to exit. Just move it before synchronize_srcu(), which is also convenient to put the heavy synchronize_srcu() in the delayed work later. Link: https://lkml.kernel.org/r/20230601132714.2540707-1-qi.zheng@xxxxxxxxx Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx> Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/vmscan.c~mm-vmscan-move-shrinker_debugfs_remove-before-synchronize_srcu +++ a/mm/vmscan.c @@ -818,11 +818,11 @@ void unregister_shrinker(struct shrinker debugfs_entry = shrinker_debugfs_detach(shrinker, &debugfs_id); mutex_unlock(&shrinker_mutex); + shrinker_debugfs_remove(debugfs_entry, debugfs_id); + atomic_inc(&shrinker_srcu_generation); synchronize_srcu(&shrinker_srcu); - shrinker_debugfs_remove(debugfs_entry, debugfs_id); - kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } _ Patches currently in -mm which might be from zhengqi.arch@xxxxxxxxxxxxx are mm-vmscan-move-shrinker_debugfs_remove-before-synchronize_srcu.patch