Skip to content

Commit 8259cb1

Browse files
glemcorostedt
authored andcommitted
rv: Reset per-task monitors also for idle tasks
RV per-task monitors are implemented through a monitor structure available for each task_struct. This structure is reset every time the monitor is (re-)started, to avoid inconsistencies if the monitor was activated previously. To do so, we reset the monitor on all threads using the macro for_each_process_thread. However, this macro excludes the idle tasks on each CPU. Idle tasks could be considered tasks on their own right and it should be up to the model whether to ignore them or not. Reset monitors also on the idle tasks for each present CPU whenever we reset all per-task monitors. Cc: [email protected] Cc: Juri Lelli <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: John Kacur <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 7925753 ("rv/include: Add deterministic automata monitor definition via C macros") Signed-off-by: Gabriele Monaco <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ffd294d commit 8259cb1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/rv/da_monitor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <rv/automata.h>
1515
#include <linux/rv.h>
1616
#include <linux/bug.h>
17+
#include <linux/sched.h>
1718

1819
#ifdef CONFIG_RV_REACTORS
1920

@@ -324,10 +325,13 @@ static inline struct da_monitor *da_get_monitor_##name(struct task_struct *tsk)
324325
static void da_monitor_reset_all_##name(void) \
325326
{ \
326327
struct task_struct *g, *p; \
328+
int cpu; \
327329
\
328330
read_lock(&tasklist_lock); \
329331
for_each_process_thread(g, p) \
330332
da_monitor_reset_##name(da_get_monitor_##name(p)); \
333+
for_each_present_cpu(cpu) \
334+
da_monitor_reset_##name(da_get_monitor_##name(idle_task(cpu))); \
331335
read_unlock(&tasklist_lock); \
332336
} \
333337
\

0 commit comments

Comments
 (0)