Skip to contentSkip to conversation

get_nohz_timer_target?

DISCUSSION Richard Cochran 3 participants 4 messages Apr 18, 2016 – Jul 8, 2016 Stable branch

lore
Share & tools
lore
#0 lore raw

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

commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Author: Vatika Harlalka <[email protected]>
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

#1 lore raw
Quoted 20 lines · Richard Cochran

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

commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Author: Vatika Harlalka <[email protected]>
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)) {
Quoted 2 lines

--------------------------------------------------------------- ^^^ Was this supposed to be 'i' instead?

Yes. Care to send a patch?

Thanks,

tglx

#2 lore raw
Quoted 17 lines · Thomas Gleixner
Quoted 16 lines · Richard Cochran

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

commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Author: Vatika Harlalka <[email protected]>
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;
Quoted 8 lines
Quoted 6 lines
	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.

Quoted 4 lines

Thanks,

tglx

#3 lore raw
Quoted 25 lines · Frederic Weisbecker
Quoted 24 lines · Thomas Gleixner
Quoted 22 lines · Richard Cochran

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

commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Author: Vatika Harlalka <[email protected]>
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?

Quoted 4 lines
Quoted 1 line

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