summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGabriele Monaco <gmonaco@redhat.com>2026-06-01 17:38:39 +0200
committerGabriele Monaco <gmonaco@redhat.com>2026-07-23 13:38:23 +0200
commit3fc5d9bb0989996a143af03686efb32f22b46884 (patch)
tree7713ef81de07049a10d44d7cb154e9aa8cdad076 /include
parentda245fae4041774bc467fc62fbbfc36a57442e4c (diff)
downloadlinux-3fc5d9bb0989996a143af03686efb32f22b46884.tar.gz
linux-3fc5d9bb0989996a143af03686efb32f22b46884.zip
rv: Fix read_lock scope in per-task DA cleanup
The da_monitor_reset_all() function for per-task monitors takes tasklist_lock while iterating over tasks, then keeps it also while iterating over idle tasks (one per CPU). The latter is not necessary since the lock needs to guard only for_each_process_thread(). Use a scoped_guard for more compact syntax and adjust the scope only where the lock is necessary. Reviewed-by: Wen Yang <wen.yang@linux.dev> Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20260601153840.124372-13-gmonaco@redhat.com Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/rv/da_monitor.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h
index 34b8fba9ecd4..08e5d0c59926 100644
--- a/include/rv/da_monitor.h
+++ b/include/rv/da_monitor.h
@@ -334,12 +334,12 @@ static void __da_monitor_reset_all(void (*reset)(struct da_monitor *))
struct task_struct *g, *p;
int cpu;
- read_lock(&tasklist_lock);
- for_each_process_thread(g, p)
- reset(da_get_monitor(p));
+ scoped_guard(read_lock, &tasklist_lock) {
+ for_each_process_thread(g, p)
+ reset(da_get_monitor(p));
+ }
for_each_present_cpu(cpu)
reset(da_get_monitor(idle_task(cpu)));
- read_unlock(&tasklist_lock);
}
static void da_monitor_reset_all(void)