[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240516190437.3545310-6-costa.shul@redhat.com>
Date: Thu, 16 May 2024 22:04:35 +0300
From: Costa Shulyupin <costa.shul@...hat.com>
To: longman@...hat.com,
pauld@...hat.com,
juri.lelli@...hat.com,
prarit@...hat.com,
vschneid@...hat.com,
Anna-Maria Behnsen <anna-maria@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Zefan Li <lizefan.x@...edance.com>,
Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Petr Mladek <pmladek@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Randy Dunlap <rdunlap@...radead.org>,
Yoann Congal <yoann.congal@...le.fr>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Nhat Pham <nphamcs@...il.com>,
Costa Shulyupin <costa.shul@...hat.com>,
linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org
Subject: [PATCH v1 5/7] [NOT-FOR-MERGE] test timers affinity adjustment
There must be no timers on the specified cpu
at the end of timers_resettle_from_cpu.
Signed-off-by: Costa Shulyupin <costa.shul@...hat.com>
---
kernel/time/timer.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 2d15c0e7b0550..b7d253d230453 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -2658,6 +2658,27 @@ int timers_prepare_cpu(unsigned int cpu)
return 0;
}
+static int count_timers(int cpu)
+{
+ struct timer_base *base;
+ int b, v, count = 0;
+
+ for (b = 0; b < NR_BASES; b++) {
+ base = per_cpu_ptr(&timer_bases[b], cpu);
+ raw_spin_lock_irq(&base->lock);
+
+ for (v = 0; v < WHEEL_SIZE; v++) {
+ struct hlist_node *c;
+
+ hlist_for_each(c, base->vectors + v)
+ count++;
+ }
+ raw_spin_unlock_irq(&base->lock);
+ }
+
+ return count;
+}
+
/**
* timers_resettle_from_cpu - resettles timers from
* specified cpu to housekeeping cpus.
@@ -2697,6 +2718,7 @@ void timers_resettle_from_cpu(unsigned int cpu)
raw_spin_unlock_irq(&new_base->lock);
}
local_irq_enable();
+ WARN_ON(count_timers(cpu));
}
int timers_dead_cpu(unsigned int cpu)
--
2.45.0
Powered by blists - more mailing lists