linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* get_nohz_timer_target?
@ 2016-04-18 13:37 Richard Cochran
  2016-07-08  9:05 ` get_nohz_timer_target? Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Cochran @ 2016-04-18 13:37 UTC (permalink / raw)
  To: vatikaharlalka
  Cc: Frederic Weisbecker, Preeti U Murthy, Thomas Gleixner,
	Ingo Molnar, linux-kernel


Looking at kernel/sched/core.c:get_nohz_timer_target(), I don't
understand the change made in:

    commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
    Author: Vatika Harlalka <vatikaharlalka@gmail.com>
    Date:   Tue Sep 1 16:50:59 2015 +0200
    nohz: Affine unpinned timers to housekeepers

After that change, the code now reads like this:

	int i, cpu = smp_processor_id();
	struct sched_domain *sd;

	if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
		return cpu;

	rcu_read_lock();
	for_each_domain(cpu, sd) {
		for_each_cpu(i, sched_domain_span(sd)) {
			if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
--------------------------------------------------------------- ^^^
Was this supposed to be 'i' instead?
If not, how does this test make any sense?
In any case, testing over and over again is surely wasteful.
---------------------------------------------------------------
				cpu = i;
				goto unlock;
			}
		}
	}

	if (!is_housekeeping_cpu(cpu))
		cpu = housekeeping_any_cpu();
unlock:
	rcu_read_unlock();
	return cpu;

Thanks,
Richard

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

* Re: get_nohz_timer_target?
  2016-04-18 13:37 get_nohz_timer_target? Richard Cochran
@ 2016-07-08  9:05 ` Thomas Gleixner
  2016-07-08 11:49   ` get_nohz_timer_target? Frederic Weisbecker
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2016-07-08  9:05 UTC (permalink / raw)
  To: Richard Cochran
  Cc: vatikaharlalka, Frederic Weisbecker, Preeti U Murthy,
	Ingo Molnar, LKML, Peter Zijlstra

On Mon, 18 Apr 2016, Richard Cochran wrote:
> Looking at kernel/sched/core.c:get_nohz_timer_target(), I don't
> understand the change made in:
> 
>     commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
>     Author: Vatika Harlalka <vatikaharlalka@gmail.com>
>     Date:   Tue Sep 1 16:50:59 2015 +0200
>     nohz: Affine unpinned timers to housekeepers
> 
> After that change, the code now reads like this:
> 
> 	int i, cpu = smp_processor_id();
> 	struct sched_domain *sd;
> 
> 	if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
> 		return cpu;
> 
> 	rcu_read_lock();
> 	for_each_domain(cpu, sd) {
> 		for_each_cpu(i, sched_domain_span(sd)) {
> 			if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
> --------------------------------------------------------------- ^^^
> Was this supposed to be 'i' instead?

Yes. Care to send a patch?

Thanks,

	tglx

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

* Re: get_nohz_timer_target?
  2016-07-08  9:05 ` get_nohz_timer_target? Thomas Gleixner
@ 2016-07-08 11:49   ` Frederic Weisbecker
  2016-07-08 16:48     ` get_nohz_timer_target? Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Frederic Weisbecker @ 2016-07-08 11:49 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Richard Cochran, vatikaharlalka, Preeti U Murthy, Ingo Molnar,
	LKML, Peter Zijlstra

On Fri, Jul 08, 2016 at 11:05:58AM +0200, Thomas Gleixner wrote:
> On Mon, 18 Apr 2016, Richard Cochran wrote:
> > Looking at kernel/sched/core.c:get_nohz_timer_target(), I don't
> > understand the change made in:
> > 
> >     commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
> >     Author: Vatika Harlalka <vatikaharlalka@gmail.com>
> >     Date:   Tue Sep 1 16:50:59 2015 +0200
> >     nohz: Affine unpinned timers to housekeepers
> > 
> > After that change, the code now reads like this:
> > 
> > 	int i, cpu = smp_processor_id();
> > 	struct sched_domain *sd;
> > 
> > 	if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
> > 		return cpu;
> > 
> > 	rcu_read_lock();
> > 	for_each_domain(cpu, sd) {
> > 		for_each_cpu(i, sched_domain_span(sd)) {
> > 			if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
> > --------------------------------------------------------------- ^^^
> > Was this supposed to be 'i' instead?
> 
> Yes. Care to send a patch?

Ah this got fixed already: 444969223c81c7d0a95136b7b4cfdcfbc96ac5bd
("sched/nohz: Fix affine unpinned timers mess")

Thanks.

> 
> Thanks,
> 
> 	tglx

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

* Re: get_nohz_timer_target?
  2016-07-08 11:49   ` get_nohz_timer_target? Frederic Weisbecker
@ 2016-07-08 16:48     ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2016-07-08 16:48 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Richard Cochran, vatikaharlalka, Preeti U Murthy, Ingo Molnar,
	LKML, Peter Zijlstra, stable

On Fri, 8 Jul 2016, Frederic Weisbecker wrote:
> On Fri, Jul 08, 2016 at 11:05:58AM +0200, Thomas Gleixner wrote:
> > On Mon, 18 Apr 2016, Richard Cochran wrote:
> > > Looking at kernel/sched/core.c:get_nohz_timer_target(), I don't
> > > understand the change made in:
> > > 
> > >     commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
> > >     Author: Vatika Harlalka <vatikaharlalka@gmail.com>
> > >     Date:   Tue Sep 1 16:50:59 2015 +0200
> > >     nohz: Affine unpinned timers to housekeepers
> > > 
> > > After that change, the code now reads like this:
> > > 
> > > 	int i, cpu = smp_processor_id();
> > > 	struct sched_domain *sd;
> > > 
> > > 	if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
> > > 		return cpu;
> > > 
> > > 	rcu_read_lock();
> > > 	for_each_domain(cpu, sd) {
> > > 		for_each_cpu(i, sched_domain_span(sd)) {
> > > 			if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
> > > --------------------------------------------------------------- ^^^
> > > Was this supposed to be 'i' instead?
> > 
> > Yes. Care to send a patch?
> 
> Ah this got fixed already: 444969223c81c7d0a95136b7b4cfdcfbc96ac5bd
> ("sched/nohz: Fix affine unpinned timers mess")

Good. Though that patch misses a stable tag.

Thanks,

	tglx

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

end of thread, other threads:[~2016-07-08 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-18 13:37 get_nohz_timer_target? Richard Cochran
2016-07-08  9:05 ` get_nohz_timer_target? Thomas Gleixner
2016-07-08 11:49   ` get_nohz_timer_target? Frederic Weisbecker
2016-07-08 16:48     ` get_nohz_timer_target? Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).