[RFC PATCH 04/23] sched/core: Add user_tick as argument to scheduler_tick()

From: Ricardo Neri
Date: Fri Sep 09 2022 - 19:07:00 EST


Differentiate between user and kernel ticks so that the scheduler updates
the class of the current task during the latter.

Cc: Ben Segall <bsegall@xxxxxxxxxx>
Cc: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Cc: Len Brown <len.brown@xxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxx>
Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Tim C. Chen <tim.c.chen@xxxxxxxxx>
Cc: Valentin Schneider <vschneid@xxxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@xxxxxxxxxxxxxxx>
---
include/linux/sched.h | 2 +-
kernel/sched/core.c | 2 +-
kernel/time/timer.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index acc33dbaa47c..73f9e745d17d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -283,7 +283,7 @@ enum {
TASK_COMM_LEN = 16,
};

-extern void scheduler_tick(void);
+extern void scheduler_tick(bool user_tick);

#define MAX_SCHEDULE_TIMEOUT LONG_MAX

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index db548c1a25ef..76015dbc45c5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5436,7 +5436,7 @@ static inline u64 cpu_resched_latency(struct rq *rq) { return 0; }
* This function gets called by the timer code, with HZ frequency.
* We call it with interrupts disabled.
*/
-void scheduler_tick(void)
+void scheduler_tick(bool user_tick)
{
int cpu = smp_processor_id();
struct rq *rq = cpu_rq(cpu);
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 717fcb9fb14a..b444b6f5f585 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1841,7 +1841,7 @@ void update_process_times(int user_tick)
if (in_irq())
irq_work_tick();
#endif
- scheduler_tick();
+ scheduler_tick(user_tick);
if (IS_ENABLED(CONFIG_POSIX_TIMERS))
run_posix_cpu_timers();
}
--
2.25.1