Re: [PATCH 20/24] nohz: Full dynticks mode

From: Namhyung Kim
Date: Wed Dec 26 2012 - 02:02:14 EST


On Wed, 26 Dec 2012 15:12:22 +0900, Namhyung Kim wrote:
> Hi Frederic,
>
> On Thu, 20 Dec 2012 19:33:07 +0100, Frederic Weisbecker wrote:
>> When a CPU is in full dynticks mode, try to switch
>> it to nohz mode from the interrupt exit path if it is
>> running a single non-idle task.
>>
>> Then restart the tick if necessary if we are enqueuing a
>> second task while the timer is stopped, so that the scheduler
>> tick is rearmed.
>>
>> [TODO: Check remaining things to be done from scheduler_tick()]
>>
>> [ Included build fix from Geoff Levand ]
> [snip]
>> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
>> index db3d4df..f3d8f4a 100644
>> --- a/kernel/sched/sched.h
>> +++ b/kernel/sched/sched.h
>> @@ -943,6 +943,14 @@ static inline u64 steal_ticks(u64 steal)
>> static inline void inc_nr_running(struct rq *rq)
>> {
>> rq->nr_running++;
>> +
>> + if (rq->nr_running == 2) {
>> + if (tick_nohz_full_cpu(rq->cpu)) {
>> + /* Order rq->nr_running write against the IPI */
>> + smp_wmb();
>> + smp_send_reschedule(rq->cpu);
>> + }
>> + }
>
> This block should be guarded with #ifdef CONFIG_SMP, otherwise:

Or apply something like this:


diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 0cd913ed29de..8de13ca88a17 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -957,10 +957,10 @@ static inline void inc_nr_running(struct rq *rq)
rq->nr_running++;

if (rq->nr_running == 2) {
- if (tick_nohz_full_cpu(rq->cpu)) {
+ if (tick_nohz_full_cpu(cpu_of(rq))) {
/* Order rq->nr_running write against the IPI */
smp_wmb();
- smp_send_reschedule(rq->cpu);
+ smp_send_reschedule(cpu_of(rq));
}
}
}


Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/