All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: ignore cache hotness for SMT migration
@ 2020-08-04  0:06 Josh Don
  2020-08-04 10:56 ` peterz
  0 siblings, 1 reply; 7+ messages in thread
From: Josh Don @ 2020-08-04  0:06 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	linux-kernel, Josh Don

SMT siblings share caches, so cache hotness should be irrelevant for
cross-sibling migration.

Proposed-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Josh Don <joshdon@google.com>
---
 kernel/sched/fair.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2ba8f230feb9..5b203b55bcb2 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7402,6 +7402,9 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
 	if (unlikely(task_has_idle_policy(p)))
 		return 0;
 
+	if ((env->sd->flags & cpu_smt_flags()) == cpu_smt_flags())
+		return 0;
+
 	/*
 	 * Buddy candidates are cache hot:
 	 */
-- 
2.28.0.163.g6104cc2f0b6-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: ignore cache hotness for SMT migration
  2020-08-04  0:06 [PATCH] sched/fair: ignore cache hotness for SMT migration Josh Don
@ 2020-08-04 10:56 ` peterz
  2020-08-04 19:24   ` Josh Don
  2020-08-04 19:34   ` [PATCH v2] " Josh Don
  0 siblings, 2 replies; 7+ messages in thread
From: peterz @ 2020-08-04 10:56 UTC (permalink / raw)
  To: Josh Don
  Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel

On Mon, Aug 03, 2020 at 05:06:14PM -0700, Josh Don wrote:
> SMT siblings share caches, so cache hotness should be irrelevant for
> cross-sibling migration.
> 
> Proposed-by: Venkatesh Pallipadi <venki@google.com>
> Signed-off-by: Josh Don <joshdon@google.com>
> ---
>  kernel/sched/fair.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 2ba8f230feb9..5b203b55bcb2 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7402,6 +7402,9 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
>  	if (unlikely(task_has_idle_policy(p)))
>  		return 0;
>  
> +	if ((env->sd->flags & cpu_smt_flags()) == cpu_smt_flags())
> +		return 0;

I think that wants to be:

	if (env->sd->flags & SD_SHARE_CPUCAPACITY)

Also, perhaps stick a comment on top with the rationale for this.

> +
>  	/*
>  	 * Buddy candidates are cache hot:
>  	 */
> -- 
> 2.28.0.163.g6104cc2f0b6-goog
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: ignore cache hotness for SMT migration
  2020-08-04 10:56 ` peterz
@ 2020-08-04 19:24   ` Josh Don
  2020-08-04 19:34   ` [PATCH v2] " Josh Don
  1 sibling, 0 replies; 7+ messages in thread
From: Josh Don @ 2020-08-04 19:24 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel

On Tue, Aug 4, 2020 at 3:56 AM <peterz@infradead.org> wrote:
>
> On Mon, Aug 03, 2020 at 05:06:14PM -0700, Josh Don wrote:
> > SMT siblings share caches, so cache hotness should be irrelevant for
> > cross-sibling migration.
> >
> > Proposed-by: Venkatesh Pallipadi <venki@google.com>
> > Signed-off-by: Josh Don <joshdon@google.com>
> > ---
> >  kernel/sched/fair.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 2ba8f230feb9..5b203b55bcb2 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -7402,6 +7402,9 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
> >       if (unlikely(task_has_idle_policy(p)))
> >               return 0;
> >
> > +     if ((env->sd->flags & cpu_smt_flags()) == cpu_smt_flags())
> > +             return 0;
>
> I think that wants to be:
>
>         if (env->sd->flags & SD_SHARE_CPUCAPACITY)
>

Agreed

> Also, perhaps stick a comment on top with the rationale for this.
>
> > +
> >       /*
> >        * Buddy candidates are cache hot:
> >        */
> > --
> > 2.28.0.163.g6104cc2f0b6-goog
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] sched/fair: ignore cache hotness for SMT migration
  2020-08-04 10:56 ` peterz
  2020-08-04 19:24   ` Josh Don
@ 2020-08-04 19:34   ` Josh Don
  2020-08-10  6:14     ` Srikar Dronamraju
  2020-08-27  7:54     ` [tip: sched/core] sched/fair: Ignore " tip-bot2 for Josh Don
  1 sibling, 2 replies; 7+ messages in thread
From: Josh Don @ 2020-08-04 19:34 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	linux-kernel, Josh Don

SMT siblings share caches, so cache hotness should be irrelevant for
cross-sibling migration.

Proposed-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Josh Don <joshdon@google.com>
---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1a68a0536add..abdb54e2339f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7402,6 +7402,10 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
 	if (unlikely(task_has_idle_policy(p)))
 		return 0;
 
+	/* SMT siblings share cache */
+	if (env->sd->flags & SD_SHARE_CPUCAPACITY)
+		return 0;
+
 	/*
 	 * Buddy candidates are cache hot:
 	 */
-- 
2.28.0.163.g6104cc2f0b6-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] sched/fair: ignore cache hotness for SMT migration
  2020-08-04 19:34   ` [PATCH v2] " Josh Don
@ 2020-08-10  6:14     ` Srikar Dronamraju
  2020-08-10  8:55       ` Valentin Schneider
  2020-08-27  7:54     ` [tip: sched/core] sched/fair: Ignore " tip-bot2 for Josh Don
  1 sibling, 1 reply; 7+ messages in thread
From: Srikar Dronamraju @ 2020-08-10  6:14 UTC (permalink / raw)
  To: Josh Don
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	linux-kernel

* Josh Don <joshdon@google.com> [2020-08-04 12:34:13]:

> SMT siblings share caches, so cache hotness should be irrelevant for
> cross-sibling migration.
> 
> Proposed-by: Venkatesh Pallipadi <venki@google.com>
> Signed-off-by: Josh Don <joshdon@google.com>
> ---
>  kernel/sched/fair.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 1a68a0536add..abdb54e2339f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7402,6 +7402,10 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
>  	if (unlikely(task_has_idle_policy(p)))
>  		return 0;
>  
> +	/* SMT siblings share cache */
> +	if (env->sd->flags & SD_SHARE_CPUCAPACITY)
> +		return 0;
> +

If this for retaining cache hotness, should we look at
SD_SHARE_PKG_RESOURCES instead of SD_SHARE_CPUCAPACITY?

>  	/*
>  	 * Buddy candidates are cache hot:
>  	 */
> -- 
> 2.28.0.163.g6104cc2f0b6-goog
> 

-- 
Thanks and Regards
Srikar Dronamraju

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] sched/fair: ignore cache hotness for SMT migration
  2020-08-10  6:14     ` Srikar Dronamraju
@ 2020-08-10  8:55       ` Valentin Schneider
  0 siblings, 0 replies; 7+ messages in thread
From: Valentin Schneider @ 2020-08-10  8:55 UTC (permalink / raw)
  To: Srikar Dronamraju
  Cc: Josh Don, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, linux-kernel


On 10/08/20 07:14, Srikar Dronamraju wrote:
> * Josh Don <joshdon@google.com> [2020-08-04 12:34:13]:
>
>> SMT siblings share caches, so cache hotness should be irrelevant for
>> cross-sibling migration.
>>
>> Proposed-by: Venkatesh Pallipadi <venki@google.com>
>> Signed-off-by: Josh Don <joshdon@google.com>
>> ---
>>  kernel/sched/fair.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 1a68a0536add..abdb54e2339f 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -7402,6 +7402,10 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
>>      if (unlikely(task_has_idle_policy(p)))
>>              return 0;
>>
>> +	/* SMT siblings share cache */
>> +	if (env->sd->flags & SD_SHARE_CPUCAPACITY)
>> +		return 0;
>> +
>
> If this for retaining cache hotness, should we look at
> SD_SHARE_PKG_RESOURCES instead of SD_SHARE_CPUCAPACITY?
>

Josh's patch only targets migrating tasks between threads of the same
core - as he points out, cache hotness shouldn't matter here.

Using SD_SHARE_PKG_RESOURCES here would mean freely migrating tasks between
any CPU of an LLC domain, which is quite likely something you do *not* want
to do.

>>      /*
>>       * Buddy candidates are cache hot:
>>       */
>> --
>> 2.28.0.163.g6104cc2f0b6-goog
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip: sched/core] sched/fair: Ignore cache hotness for SMT migration
  2020-08-04 19:34   ` [PATCH v2] " Josh Don
  2020-08-10  6:14     ` Srikar Dronamraju
@ 2020-08-27  7:54     ` tip-bot2 for Josh Don
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Don @ 2020-08-27  7:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Josh Don, Peter Zijlstra (Intel), x86, LKML

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     ec73240b1627cddfd7cef018c7fa1c32e64a721e
Gitweb:        https://git.kernel.org/tip/ec73240b1627cddfd7cef018c7fa1c32e64a721e
Author:        Josh Don <joshdon@google.com>
AuthorDate:    Tue, 04 Aug 2020 12:34:13 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 26 Aug 2020 12:41:57 +02:00

sched/fair: Ignore cache hotness for SMT migration

SMT siblings share caches, so cache hotness should be irrelevant for
cross-sibling migration.

Signed-off-by: Josh Don <joshdon@google.com>
Proposed-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200804193413.510651-1-joshdon@google.com
---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1a68a05..abdb54e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7402,6 +7402,10 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
 	if (unlikely(task_has_idle_policy(p)))
 		return 0;
 
+	/* SMT siblings share cache */
+	if (env->sd->flags & SD_SHARE_CPUCAPACITY)
+		return 0;
+
 	/*
 	 * Buddy candidates are cache hot:
 	 */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-27  7:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04  0:06 [PATCH] sched/fair: ignore cache hotness for SMT migration Josh Don
2020-08-04 10:56 ` peterz
2020-08-04 19:24   ` Josh Don
2020-08-04 19:34   ` [PATCH v2] " Josh Don
2020-08-10  6:14     ` Srikar Dronamraju
2020-08-10  8:55       ` Valentin Schneider
2020-08-27  7:54     ` [tip: sched/core] sched/fair: Ignore " tip-bot2 for Josh Don

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.