lkml.org 
[lkml]   [2010]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 4/5] sched: Clean up ttwu stats
On 12/16/10 06:56, Peter Zijlstra wrote:
> Collect all ttwu stat code into a single function and ensure its
> always called for an actual wakeup (changing p->state to
> TASK_RUNNING).
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
> kernel/sched.c | 66 ++++++++++++++++++++++++++-------------------------------
> 1 file changed, 31 insertions(+), 35 deletions(-)

Looks good to me. Nice cleanup...

A couple of nits inline if you want them.

Acked-by: Frank Rowand <frank.rowand@am.sony.com>

>
> Index: linux-2.6/kernel/sched.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched.c
> +++ linux-2.6/kernel/sched.c
> @@ -2310,21 +2310,35 @@ static void update_avg(u64 *avg, u64 sam
> }
> #endif
>
> -static inline void ttwu_activate(struct task_struct *p, struct rq *rq,
> - bool is_sync, bool is_migrate, bool is_local,
> - unsigned long en_flags)
> +static void
> +ttwu_stat(struct rq *rq, struct task_struct *p, int cpu, int wake_flags)
> {
> +#ifdef CONFIG_SCHEDSTATS
> +

int this_cpu = smp_processor_id();

> + schedstat_inc(rq, ttwu_count);
> schedstat_inc(p, se.statistics.nr_wakeups);
> - if (is_sync)
> +
> + if (wake_flags & WF_SYNC)
> schedstat_inc(p, se.statistics.nr_wakeups_sync);
> - if (is_migrate)
> +
> + if (cpu != task_cpu(p))
> schedstat_inc(p, se.statistics.nr_wakeups_migrate);
> - if (is_local)
> +
> + if (cpu == smp_processor_id()) {

^^^^^^ this_cpu

> + schedstat_inc(rq, ttwu_local);
> schedstat_inc(p, se.statistics.nr_wakeups_local);
> - else
> - schedstat_inc(p, se.statistics.nr_wakeups_remote);
> + } else {
> + struct sched_domain *sd;
>
> - activate_task(rq, p, en_flags);
> + schedstat_inc(p, se.statistics.nr_wakeups_remote);
> + for_each_domain(smp_processor_id(), sd) {

^^^^^ this_cpu

> + if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
> + schedstat_inc(sd, ttwu_wake_remote);
> + break;
> + }
> + }
> + }
> +#endif /* CONFIG_SCHEDSTATS */
> }
>
> static void



\
 
 \ /
  Last update: 2010-12-18 02:13    [W:0.301 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site