All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Mel Gorman <mgorman@techsingularity.net>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Subject: Re: [PATCH 4/5] sched/debug: remove several CONFIG_SCHEDSTATS guards
Date: Mon, 27 Jun 2016 18:21:11 +0200	[thread overview]
Message-ID: <20160627162111.GF30909@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <e51e0ebe5af95ac295de720dd252e7c0d2142e4a.1466184592.git.jpoimboe@redhat.com>

On Fri, Jun 17, 2016 at 12:43:26PM -0500, Josh Poimboeuf wrote:
> index 017a4f5..0aee5dd 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1626,10 +1626,15 @@ static inline int __set_cpus_allowed_ptr(struct task_struct *p,
>  static void
>  ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
>  {
> -#ifdef CONFIG_SCHEDSTATS
> -	struct rq *rq = this_rq();
> +	struct rq *rq;
> +
> +	if (!schedstat_enabled())
> +		return;
> +
> +	rq = this_rq();
>  
>  #ifdef CONFIG_SMP
> +{
>  	int this_cpu = smp_processor_id();
>  
>  	if (cpu == this_cpu) {
> @@ -1651,7 +1656,7 @@ ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
>  
>  	if (wake_flags & WF_MIGRATED)
>  		schedstat_inc(p->se.statistics.nr_wakeups_migrate);
> -
> +}
>  #endif /* CONFIG_SMP */
>  
>  	schedstat_inc(rq->ttwu_count);

I did:

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1636,10 +1636,7 @@ ttwu_stat(struct task_struct *p, int cpu
 	rq = this_rq();
 
 #ifdef CONFIG_SMP
-{
-	int this_cpu = smp_processor_id();
-
-	if (cpu == this_cpu) {
+	if (cpu == rq->cpu) {
 		schedstat_inc(rq->ttwu_local);
 		schedstat_inc(p->se.statistics.nr_wakeups_local);
 	} else {
@@ -1647,7 +1644,7 @@ ttwu_stat(struct task_struct *p, int cpu
 
 		schedstat_inc(p->se.statistics.nr_wakeups_remote);
 		rcu_read_lock();
-		for_each_domain(this_cpu, sd) {
+		for_each_domain(rq->cpu, sd) {
 			if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
 				schedstat_inc(sd->ttwu_wake_remote);
 				break;
@@ -1658,7 +1655,6 @@ ttwu_stat(struct task_struct *p, int cpu
 
 	if (wake_flags & WF_MIGRATED)
 		schedstat_inc(p->se.statistics.nr_wakeups_migrate);
-}
 #endif /* CONFIG_SMP */
 
 	schedstat_inc(rq->ttwu_count);

  reply	other threads:[~2016-06-27 16:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 17:43 [PATCH 0/5] sched/debug: decouple sched_stat tracepoints from CONFIG_SCHEDSTATS Josh Poimboeuf
2016-06-17 17:43 ` [PATCH 1/5] sched/debug: rename and move enqueue_sleeper() Josh Poimboeuf
2016-09-05 11:56   ` [tip:sched/core] sched/debug: Rename " tip-bot for Josh Poimboeuf
2016-06-17 17:43 ` [PATCH 2/5] sched/debug: schedstat macro cleanup Josh Poimboeuf
2016-09-05 11:57   ` [tip:sched/core] sched/debug: Clean up schedstat macros tip-bot for Josh Poimboeuf
2016-06-17 17:43 ` [PATCH 3/5] sched/debug: 'schedstat_val()' -> 'schedstat_val_or_zero()' Josh Poimboeuf
2016-09-05 11:57   ` [tip:sched/core] sched/debug: Rename " tip-bot for Josh Poimboeuf
2016-06-17 17:43 ` [PATCH 4/5] sched/debug: remove several CONFIG_SCHEDSTATS guards Josh Poimboeuf
2016-06-27 16:21   ` Peter Zijlstra [this message]
2016-06-27 16:32     ` Josh Poimboeuf
2016-09-05 11:57   ` [tip:sched/core] sched/debug: Remove " tip-bot for Josh Poimboeuf
2016-06-17 17:43 ` [PATCH 5/5] sched/debug: decouple 'sched_stat_*' tracepoints' from CONFIG_SCHEDSTATS Josh Poimboeuf
2016-06-21  8:27 ` [PATCH 0/5] sched/debug: decouple sched_stat tracepoints " Srikar Dronamraju
2016-06-28 12:43 ` Peter Zijlstra
2016-06-29  2:32   ` Josh Poimboeuf
2016-06-29 10:29   ` Peter Zijlstra
2016-07-08 14:57     ` Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160627162111.GF30909@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@redhat.com \
    --cc=srikar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.