sched; Fix a few missing rq clock updates
Hi,
So I revisited the rq clock series I had for dynticks. The patches actually were about upstream issues so I refactored the fixes under that angle and gave up with the wrong asumption that rq clock relies on the tick for its updates.
Patches 1-4 fix some missing updates. Additionally I removed 2 of these updates from the previous set:
* No need to update the rq clock on idle_balance() because it should follow a call to deactivate_task() (unless TIF_NEED_RESCHED is set on idle without new task on the runqueue, not sure we want to cover that).
* No need to update for try_to_wake_up_local() -> ttwu_do_wakeup() -> check_preempt_curr() as it's following deactivate_task().
Patch 5 brings accessors that will be necessary to settle an rq clock debugging engine. What remains is to tag scheduler's entry/exit points and report missing or redundant update_rq_clock() before calls to rq_clock() and rq_clock_task().
The branch is pullable from:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
sched/core
HEAD: 8b5fa0f1de7e41176dc68740de7548110a404538
Thanks.
---
Frederic Weisbecker (5):
sched: Update rq clock before migrating tasks out of dying CPU
sched: Update rq clock before setting fair group shares
sched: Update rq clock before calling check_preempt_curr()
sched: Update rq clock earlier in unthrottle_cfs_rq
sched: Use an accessor to read rq clock
kernel/sched/core.c | 15 ++++++++++-- kernel/sched/fair.c | 51 +++++++++++++++++++++++++-------------------- kernel/sched/rt.c | 8 +++--- kernel/sched/sched.h | 10 +++++++++ kernel/sched/stats.h | 8 +++--- kernel/sched/stop_task.c | 8 +++--- 6 files changed, 62 insertions(+), 38 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/5 sched: Update rq clock before migrating tasks out of dying CPU
Because the sched_class::put_prev_task() callback of rt and fair classes are referring to the rq clock to update their runtime statistics. There is a missing rq clock update from the CPU hotplug notifier's entrypoint of the scheduler.
--- kernel/sched/core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
kernel/sched/core.c +7 -0
@@ -4928,6 +4928,13 @@ static void migrate_tasks(unsigned int dead_cpu)*/ rq->stop =NULL ; +/* +* put_prev_task() and pick_next_task() sched +* class method both need to have an up-to-date +* value of rq->clock[_task] +*/ +update_rq_clock (rq); +for ( ; ; ) {/* * There's this thread running, bail when that's the only
Signature · 1 line
1.7.5.4
tip-bot for Frederic Weisbecker
merge bot[tip:sched/core] sched: Update rq clock before migrating tasks out of dying CPU
sched: Update rq clock before migrating tasks out of dying CPU
Commit-ID: 77bd39702f0b3840cea17681409270b16a3b93c0 Gitweb: http://git.kernel.org/tip/77bd39702f0b3840cea17681409270b16a3b93c0 Author: Frederic Weisbecker <[email protected]> AuthorDate: Fri, 12 Apr 2013 01:50:58 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 May 2013 09:40:23 +0200
sched: Update rq clock before migrating tasks out of dying CPU
Because the sched_class::put_prev_task() callback of rt and fair classes are referring to the rq clock to update their runtime statistics. There is a missing rq clock update from the CPU hotplug notifier's entry point of the scheduler.
--- kernel/sched/core.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/sched/core.c +7 -0
@@ -4378,6 +4378,13 @@ static void migrate_tasks(unsigned int dead_cpu)*/ rq->stop =NULL ; +/* +* put_prev_task() and pick_next_task() sched +* class method both need to have an up-to-date +* value of rq->clock[_task] +*/ +update_rq_clock (rq); +for ( ; ; ) {/* * There's this thread running, bail when that's the only
PATCH 2/5 sched: Update rq clock before setting fair group shares
In reply to Frederic WeisbeckerBecause we may update the execution time (sched_group_set_shares()->
update_cfs_shares()->reweight_entity()->update_curr()) before
reweighting the entity while setting the group shares and this requires an uptodate version of the runqueue clock.
--- kernel/sched/fair.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/sched/fair.c +3 -0
@@ -6057,6 +6057,9 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares) se = tg->se[i];/* Propagate contribution to hierarchy */ raw_spin_lock_irqsave (&rq->lock, flags); + +/* Possible calls to update_curr() need rq clock */ +update_rq_clock (rq);for_each_sched_entity (se)update_cfs_shares (group_cfs_rq (se));raw_spin_unlock_irqrestore (&rq->lock, flags);
Signature · 1 line
1.7.5.4
tip-bot for Frederic Weisbecker
merge bot[tip:sched/core] sched: Update rq clock before setting fair group shares
sched: Update rq clock before setting fair group shares
Commit-ID: 71b1da46ff70309a2ec12ce943aa0d192d2c8f0c Gitweb: http://git.kernel.org/tip/71b1da46ff70309a2ec12ce943aa0d192d2c8f0c Author: Frederic Weisbecker <[email protected]> AuthorDate: Fri, 12 Apr 2013 01:50:59 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 May 2013 09:40:23 +0200
sched: Update rq clock before setting fair group shares
Because we may update the execution time in
sched_group_set_shares()->update_cfs_shares()->reweight_entity()->update_curr()
before reweighting the entity while setting the group shares and this requires an uptodate version of the runqueue clock.
--- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/sched/fair.c +3 -0
@@ -6107,6 +6107,9 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares) se = tg->se[i];/* Propagate contribution to hierarchy */ raw_spin_lock_irqsave (&rq->lock, flags); + +/* Possible calls to update_curr() need rq clock */ +update_rq_clock (rq);for_each_sched_entity (se)update_cfs_shares (group_cfs_rq (se));raw_spin_unlock_irqrestore (&rq->lock, flags);
PATCH 3/5 sched: Update rq clock before calling check_preempt_curr()
In reply to Frederic Weisbeckercheck_preempt_curr() of fair class needs an uptodate sched clock value to update runtime stats of the current task of the target's rq.
When a task is woken up, activate_task() is usually called right before ttwu_do_wakeup() unless the task is still in the runqueue. In the latter case we need to update the rq clock explicitly because activate_task() isn't here to do the job for us.
--- kernel/sched/core.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sched/core.c +2 -0
@@ -1334,6 +1334,8 @@ static int ttwu_remote(struct task_struct *p, int wake_flags) rq =__task_rq_lock (p);if (p->on_rq) { +/* check_preempt_curr() may use rq clock */ +update_rq_clock (rq);ttwu_do_wakeup (rq, p, wake_flags); ret =1 ; }
Signature · 1 line
1.7.5.4
tip-bot for Frederic Weisbecker
merge bot[tip:sched/core] sched: Update rq clock before calling check_preempt_curr()
sched: Update rq clock before calling check_preempt_curr()
Commit-ID: 1ad4ec0dc740c4183acd6d6e367ca52b28e4fa94 Gitweb: http://git.kernel.org/tip/1ad4ec0dc740c4183acd6d6e367ca52b28e4fa94 Author: Frederic Weisbecker <[email protected]> AuthorDate: Fri, 12 Apr 2013 01:51:00 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 May 2013 09:40:24 +0200
sched: Update rq clock before calling check_preempt_curr()
check_preempt_curr() of fair class needs an uptodate sched clock value to update runtime stats of the current task of the target's rq.
When a task is woken up, activate_task() is usually called right before ttwu_do_wakeup() unless the task is still in the runqueue. In the latter case we need to update the rq clock explicitly because activate_task() isn't here to do the job for us.
--- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sched/core.c +2 -0
@@ -1365,6 +1365,8 @@ static int ttwu_remote(struct task_struct *p, int wake_flags) rq =__task_rq_lock (p);if (p->on_rq) { +/* check_preempt_curr() may use rq clock */ +update_rq_clock (rq);ttwu_do_wakeup (rq, p, wake_flags); ret =1 ; }
PATCH 4/5 sched: Update rq clock earlier in unthrottle_cfs_rq
In reply to Frederic WeisbeckerIn this function we are making use of rq->clock right before the update of the rq clock, let's just call update_rq_clock() just before that to avoid using a stale rq clock value.
--- kernel/sched/fair.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/sched/fair.c +3 -1
@@ -2280,12 +2280,14 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) se = cfs_rq->tg->se[cpu_of (rq_of (cfs_rq))]; cfs_rq->throttled =0 ; + +update_rq_clock (rq); +raw_spin_lock (&cfs_b->lock); cfs_b->throttled_time += rq->clock - cfs_rq->throttled_clock;list_del_rcu (&cfs_rq->throttled_list);raw_spin_unlock (&cfs_b->lock); -update_rq_clock (rq);/* update hierarchical throttle state */ walk_tg_tree_from (cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)rq);
Signature · 1 line
1.7.5.4
tip-bot for Frederic Weisbecker
merge bot[tip:sched/core] sched: Update rq clock earlier in unthrottle_cfs_rq
sched: Update rq clock earlier in unthrottle_cfs_rq
Commit-ID: 1a55af2e45cce0ff13bc33c8ee99da84e188b615 Gitweb: http://git.kernel.org/tip/1a55af2e45cce0ff13bc33c8ee99da84e188b615 Author: Frederic Weisbecker <[email protected]> AuthorDate: Fri, 12 Apr 2013 01:51:01 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 May 2013 09:40:25 +0200
sched: Update rq clock earlier in unthrottle_cfs_rq
In this function we are making use of rq->clock right before the update of the rq clock, let's just call update_rq_clock() just before that to avoid using a stale rq clock value.
--- kernel/sched/fair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/sched/fair.c +3 -1
@@ -2319,12 +2319,14 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) se = cfs_rq->tg->se[cpu_of (rq_of (cfs_rq))]; cfs_rq->throttled =0 ; + +update_rq_clock (rq); +raw_spin_lock (&cfs_b->lock); cfs_b->throttled_time += rq->clock - cfs_rq->throttled_clock;list_del_rcu (&cfs_rq->throttled_list);raw_spin_unlock (&cfs_b->lock); -update_rq_clock (rq);/* update hierarchical throttle state */ walk_tg_tree_from (cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)rq);
PATCH 5/5 sched: Use an accessor to read rq clock
In reply to Frederic WeisbeckerRead the runqueue clock through an accessor. This prepares for adding a debugging infrastructure to detect missing or redundant calls to update_rq_clock() between a scheduler's entry and exit point.
--- kernel/sched/core.c | 6 +++--- kernel/sched/fair.c | 44 ++++++++++++++++++++++---------------------- kernel/sched/rt.c | 8 ++++---- kernel/sched/sched.h | 10 ++++++++++ kernel/sched/stats.h | 8 ++++---- kernel/sched/stop_task.c | 8 ++++---- 6 files changed, 47 insertions(+), 37 deletions(-)
kernel/sched/core.c +3 -3
@@ -636,7 +636,7 @@ void sched_avg_update(struct rq *rq) {s64 period =sched_avg_period (); -while ((s64)(rq->clock - rq->age_stamp) > period) { +while ((s64)(rq_clock (rq) - rq->age_stamp) > period) {/* * Inline assembly required to prevent the compiler * optimising this loop into a divmod call.
@@ -1297,7 +1297,7 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags) p->sched_class->task_woken (rq, p);if (rq->idle_stamp) { -u64 delta = rq->clock - rq->idle_stamp; +u64 delta =rq_clock (rq) - rq->idle_stamp;u64 max =2 *sysctl_sched_migration_cost;if (delta > max)
@@ -2638,7 +2638,7 @@ static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq)if (task_current (rq, p)) {update_rq_clock (rq); - ns = rq->clock_task - p->se.exec_start; + ns =rq_clock_task (rq) - p->se.exec_start;if ((s64 )ns <0 ) ns =0 ; }
kernel/sched/fair.c +22 -22
164 lines not on this page · raw message
kernel/sched/rt.c +4 -4
@@ -926,7 +926,7 @@ static void update_curr_rt(struct rq *rq)if (curr->sched_class != &rt_sched_class)return ; - delta_exec = rq->clock_task - curr->se.exec_start; + delta_exec =rq_clock_task (rq) - curr->se.exec_start;if (unlikely ((s64 )delta_exec <=0 ))return ;
@@ -936,7 +936,7 @@ static void update_curr_rt(struct rq *rq) curr->se.sum_exec_runtime += delta_exec;account_group_exec_runtime (curr, delta_exec); - curr->se.exec_start = rq->clock_task; + curr->se.exec_start =rq_clock_task (rq);cpuacct_charge (curr, delta_exec);sched_rt_avg_update (rq, delta_exec);
@@ -1385,7 +1385,7 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) }while (rt_rq); p =rt_task_of (rt_se); - p->se.exec_start = rq->clock_task; + p->se.exec_start =rq_clock_task (rq);return p; }
@@ -2037,7 +2037,7 @@ static void set_curr_task_rt(struct rq *rq) {struct task_struct *p = rq->curr; - p->se.exec_start = rq->clock_task; + p->se.exec_start =rq_clock_task (rq);/* The running task is never eligible for pushing */ dequeue_pushable_task (rq, p);
kernel/sched/sched.h +10 -0
@@ -536,6 +536,16 @@ DECLARE_PER_CPU(struct rq, runqueues);#define cpu_curr (cpu) (cpu_rq(cpu)->curr)#define raw_rq () (&__raw_get_cpu_var(runqueues)) +static inline u64 rq_clock (struct rq *rq) +{ +return rq->clock; +} + +static inline u64 rq_clock_task (struct rq *rq) +{ +return rq->clock_task; +} +#ifdef CONFIG_SMP #define rcu_dereference_check_sched_domain (p) \
kernel/sched/stats.h +4 -4
@@ -61,7 +61,7 @@ static inline void sched_info_reset_dequeued(struct task_struct *t)*/ static inline void sched_info_dequeued (struct task_struct *t) { -unsigned long long now =task_rq (t)->clock, delta =0 ; +unsigned long long now =rq_clock (task_rq (t)), delta =0 ;if (unlikely (sched_info_on ()))if (t->sched_info.last_queued)
@@ -79,7 +79,7 @@ static inline void sched_info_dequeued(struct task_struct *t)*/ static void sched_info_arrive (struct task_struct *t) { -unsigned long long now =task_rq (t)->clock, delta =0 ; +unsigned long long now =rq_clock (task_rq (t)), delta =0 ;if (t->sched_info.last_queued) delta = now - t->sched_info.last_queued;
@@ -100,7 +100,7 @@ static inline void sched_info_queued(struct task_struct *t) {if (unlikely (sched_info_on ()))if (!t->sched_info.last_queued) - t->sched_info.last_queued =task_rq (t)->clock; + t->sched_info.last_queued =rq_clock (task_rq (t)); }/*
@@ -112,7 +112,7 @@ static inline void sched_info_queued(struct task_struct *t)*/ static inline void sched_info_depart (struct task_struct *t) { -unsigned long long delta =task_rq (t)->clock - +unsigned long long delta =rq_clock (task_rq (t)) - t->sched_info.last_arrival;rq_sched_info_depart (task_rq (t), delta);
kernel/sched/stop_task.c +4 -4
@@ -28,7 +28,7 @@ static struct task_struct *pick_next_task_stop(struct rq *rq)struct task_struct *stop = rq->stop;if (stop && stop->on_rq) { - stop->se.exec_start = rq->clock_task; + stop->se.exec_start =rq_clock_task (rq);return stop; }
@@ -57,7 +57,7 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)struct task_struct *curr = rq->curr;u64 delta_exec; - delta_exec = rq->clock_task - curr->se.exec_start; + delta_exec =rq_clock_task (rq) - curr->se.exec_start;if (unlikely ((s64 )delta_exec <0 )) delta_exec =0 ;
@@ -67,7 +67,7 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev) curr->se.sum_exec_runtime += delta_exec;account_group_exec_runtime (curr, delta_exec); - curr->se.exec_start = rq->clock_task; + curr->se.exec_start =rq_clock_task (rq);cpuacct_charge (curr, delta_exec); }
@@ -79,7 +79,7 @@ static void set_curr_task_stop(struct rq *rq) {struct task_struct *stop = rq->stop; - stop->se.exec_start = rq->clock_task; + stop->se.exec_start =rq_clock_task (rq); }static void switched_to_stop (struct rq *rq,struct task_struct *p)
Signature · 1 line
1.7.5.4
tip-bot for Frederic Weisbecker
merge bot[tip:sched/core] sched: Use an accessor to read the rq clock
sched: Use an accessor to read the rq clock
Commit-ID: 78becc27097585c6aec7043834cadde950ae79f2 Gitweb: http://git.kernel.org/tip/78becc27097585c6aec7043834cadde950ae79f2 Author: Frederic Weisbecker <[email protected]> AuthorDate: Fri, 12 Apr 2013 01:51:02 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 May 2013 09:40:27 +0200
sched: Use an accessor to read the rq clock
Read the runqueue clock through an accessor. This prepares for adding a debugging infrastructure to detect missing or redundant calls to update_rq_clock() between a scheduler's entry and exit point.
--- kernel/sched/core.c | 6 +++--- kernel/sched/fair.c | 44 ++++++++++++++++++++++---------------------- kernel/sched/rt.c | 8 ++++---- kernel/sched/sched.h | 10 ++++++++++ kernel/sched/stats.h | 8 ++++---- kernel/sched/stop_task.c | 8 ++++---- 6 files changed, 47 insertions(+), 37 deletions(-)
kernel/sched/core.c +3 -3
@@ -667,7 +667,7 @@ void sched_avg_update(struct rq *rq) {s64 period =sched_avg_period (); -while ((s64)(rq->clock - rq->age_stamp) > period) { +while ((s64)(rq_clock (rq) - rq->age_stamp) > period) {/* * Inline assembly required to prevent the compiler * optimising this loop into a divmod call.
@@ -1328,7 +1328,7 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags) p->sched_class->task_woken (rq, p);if (rq->idle_stamp) { -u64 delta = rq->clock - rq->idle_stamp; +u64 delta =rq_clock (rq) - rq->idle_stamp;u64 max =2 *sysctl_sched_migration_cost;if (delta > max)
@@ -2106,7 +2106,7 @@ static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq)if (task_current (rq, p)) {update_rq_clock (rq); - ns = rq->clock_task - p->se.exec_start; + ns =rq_clock_task (rq) - p->se.exec_start;if ((s64 )ns <0 ) ns =0 ; }
kernel/sched/fair.c +22 -22
164 lines not on this page · raw message
kernel/sched/rt.c +4 -4
@@ -886,7 +886,7 @@ static void update_curr_rt(struct rq *rq)if (curr->sched_class != &rt_sched_class)return ; - delta_exec = rq->clock_task - curr->se.exec_start; + delta_exec =rq_clock_task (rq) - curr->se.exec_start;if (unlikely ((s64 )delta_exec <=0 ))return ;
@@ -896,7 +896,7 @@ static void update_curr_rt(struct rq *rq) curr->se.sum_exec_runtime += delta_exec;account_group_exec_runtime (curr, delta_exec); - curr->se.exec_start = rq->clock_task; + curr->se.exec_start =rq_clock_task (rq);cpuacct_charge (curr, delta_exec);sched_rt_avg_update (rq, delta_exec);
@@ -1345,7 +1345,7 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) }while (rt_rq); p =rt_task_of (rt_se); - p->se.exec_start = rq->clock_task; + p->se.exec_start =rq_clock_task (rq);return p; }
@@ -1997,7 +1997,7 @@ static void set_curr_task_rt(struct rq *rq) {struct task_struct *p = rq->curr; - p->se.exec_start = rq->clock_task; + p->se.exec_start =rq_clock_task (rq);/* The running task is never eligible for pushing */ dequeue_pushable_task (rq, p);
kernel/sched/sched.h +10 -0
@@ -548,6 +548,16 @@ DECLARE_PER_CPU(struct rq, runqueues);#define cpu_curr (cpu) (cpu_rq(cpu)->curr)#define raw_rq () (&__raw_get_cpu_var(runqueues)) +static inline u64 rq_clock (struct rq *rq) +{ +return rq->clock; +} + +static inline u64 rq_clock_task (struct rq *rq) +{ +return rq->clock_task; +} +#ifdef CONFIG_SMP #define rcu_dereference_check_sched_domain (p) \
kernel/sched/stats.h +4 -4
@@ -61,7 +61,7 @@ static inline void sched_info_reset_dequeued(struct task_struct *t)*/ static inline void sched_info_dequeued (struct task_struct *t) { -unsigned long long now =task_rq (t)->clock, delta =0 ; +unsigned long long now =rq_clock (task_rq (t)), delta =0 ;if (unlikely (sched_info_on ()))if (t->sched_info.last_queued)
@@ -79,7 +79,7 @@ static inline void sched_info_dequeued(struct task_struct *t)*/ static void sched_info_arrive (struct task_struct *t) { -unsigned long long now =task_rq (t)->clock, delta =0 ; +unsigned long long now =rq_clock (task_rq (t)), delta =0 ;if (t->sched_info.last_queued) delta = now - t->sched_info.last_queued;
@@ -100,7 +100,7 @@ static inline void sched_info_queued(struct task_struct *t) {if (unlikely (sched_info_on ()))if (!t->sched_info.last_queued) - t->sched_info.last_queued =task_rq (t)->clock; + t->sched_info.last_queued =rq_clock (task_rq (t)); }/*
@@ -112,7 +112,7 @@ static inline void sched_info_queued(struct task_struct *t)*/ static inline void sched_info_depart (struct task_struct *t) { -unsigned long long delta =task_rq (t)->clock - +unsigned long long delta =rq_clock (task_rq (t)) - t->sched_info.last_arrival;rq_sched_info_depart (task_rq (t), delta);
kernel/sched/stop_task.c +4 -4
@@ -28,7 +28,7 @@ static struct task_struct *pick_next_task_stop(struct rq *rq)struct task_struct *stop = rq->stop;if (stop && stop->on_rq) { - stop->se.exec_start = rq->clock_task; + stop->se.exec_start =rq_clock_task (rq);return stop; }
@@ -57,7 +57,7 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)struct task_struct *curr = rq->curr;u64 delta_exec; - delta_exec = rq->clock_task - curr->se.exec_start; + delta_exec =rq_clock_task (rq) - curr->se.exec_start;if (unlikely ((s64 )delta_exec <0 )) delta_exec =0 ;
@@ -67,7 +67,7 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev) curr->se.sum_exec_runtime += delta_exec;account_group_exec_runtime (curr, delta_exec); - curr->se.exec_start = rq->clock_task; + curr->se.exec_start =rq_clock_task (rq);cpuacct_charge (curr, delta_exec); }
@@ -79,7 +79,7 @@ static void set_curr_task_stop(struct rq *rq) {struct task_struct *stop = rq->stop; - stop->se.exec_start = rq->clock_task; + stop->se.exec_start =rq_clock_task (rq); }static void switched_to_stop (struct rq *rq,struct task_struct *p)
Peter Zijlstra
maintainerQuoted 14 lines · Frederic Weisbecker
Hi,
So I revisited the rq clock series I had for dynticks. The patches actually were about upstream issues so I refactored the fixes under that angle and gave up with the wrong asumption that rq clock relies on the tick for its updates.
Patches 1-4 fix some missing updates. Additionally I removed 2 of these updates from the previous set:
* No need to update the rq clock on
idle_balance()because it should follow a call todeactivate_task()(unlessTIF_NEED_RESCHEDis set on idle without new task on the runqueue, not sure we want to cover that).
Quoted 7 lines
* No need to update for
try_to_wake_up_local()->ttwu_do_wakeup()->check_preempt_curr()as it's followingdeactivate_task().Patch 5 brings accessors that will be necessary to settle an rq clock debugging engine. What remains is to tag scheduler's entry/exit points and report missing or redundant
update_rq_clock()before calls torq_clock()andrq_clock_task().
Just noticed this queue was still sitting in the INBOX, I took it and will soon-ish hand to Ingo.
Thanks!
Quoted 18 lines · Peter Zijlstra
Quoted 17 lines · Frederic Weisbecker
Hi,
So I revisited the rq clock series I had for dynticks. The patches actually were about upstream issues so I refactored the fixes under that angle and gave up with the wrong asumption that rq clock relies on the tick for its updates.
Patches 1-4 fix some missing updates. Additionally I removed 2 of these updates from the previous set:
* No need to update the rq clock on
idle_balance()because it should follow a call todeactivate_task()(unlessTIF_NEED_RESCHEDis set on idle without new task on the runqueue, not sure we want to cover that).* No need to update for
try_to_wake_up_local()->ttwu_do_wakeup()->check_preempt_curr()as it's followingdeactivate_task().
Quoted 7 lines
Quoted 4 lines
Patch 5 brings accessors that will be necessary to settle an rq clock debugging engine. What remains is to tag scheduler's entry/exit points and report missing or redundant
update_rq_clock()before calls torq_clock()andrq_clock_task().Just noticed this queue was still sitting in the INBOX, I took it and will soon-ish hand to Ingo.
Thanks a lot!