sched: introduce for_each_process_rculock and for_each_thread_rculock - #2649
Open
vfsci-bot[bot] wants to merge 15 commits into
Open
vfsci-bot[bot] wants to merge 15 commits into
vfsci-bot[bot] wants to merge 15 commits into
Conversation
Introduce for_each_process_rculock(), for_each_thread_rculock() and for_each_process_thread_rculock() macros that acquire the RCU read lock before the iteration starts and release it when the loop is left, so that the RCU read-side critical section is scoped to the loop body instead of an externally managed rcu_read_lock()/rcu_read_unlock() pair. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Replace the manual rcu_read_lock()/rcu_read_unlock() pairs wrapping for_each_process()/for_each_thread() loops with for_each_process_rculock() and for_each_thread_rculock(), which scope the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process() loop in mm/ksm.c with for_each_process_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Replace the manual rcu_read_lock()/rcu_read_unlock() pairs combined with for_each_process() loop in mm/memory-failure.c with for_each_process_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). In collect_procs_file(), the page_pgoff() call now falls outside the RCU read-side critical section. This is safe because page_pgoff() only reads folio->index and does not traverse any RCU-protected structures. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process() loop in kernel/cpu.c with for_each_process_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_thread() loop in kernel/freezer.c with for_each_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process_thread() loop in kernel/hung_task.c with for_each_process_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process_thread() loop in kernel/locking/lockdep.c with for_each_process_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process_thread() loop in kernel/rcu/update.c with for_each_process_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Replace the manual rcu_read_lock()/rcu_read_unlock() and guard(rcu) pairs combined with for_each_process_thread() loops in kernel/sched/ with for_each_process_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
…hread_rculock Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process_thread() loop in kernel/trace/fgraph.c with for_each_process_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Steven Rostedt <rostedt@goodmis.org>
…ulock Replace guard(rcu)() combined with for_each_process_thread() loop in kernel/unwind/deferred.c with for_each_process_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Steven Rostedt <rostedt@goodmis.org>
Replace the manual rcu_read_lock()/rcu_read_unlock() pairs combined with for_each_process() and for_each_process_thread() loops in fs/ with the for_each_*_rculock() macros, which scope the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined with for_each_process() loop in lib/ with for_each_process_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net> Reviewed-by: SJ Park <sj@kernel.org>
Replace guard(rcu)() + for_each_thread() with for_each_thread_rculock(), which scopes the RCU read lock to the loop body via scoped_guard(rcu). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> Reviewed-by: Justin Suess <utilityemal77@gmail.com> Reviewed-by: Günther Noack <gnoack3000@gmail.com> Reviewed-by: Gregory Price (Meta) <gourry@gourry.net> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1170196
Submitter: Ye Liu
Version: 4
Patches: 15/15
Message-ID:
<20260921092101.89285-1-ye.liu@linux.dev>Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/20260921092101.89285-1-ye.liu@linux.dev
Automated by ml2pr