Re: [PATCH V3]hrtimer: Fix a performance regression by disable reprogramming in remove_hrtimer
From: ethan.zhao
Date: Thu Aug 08 2013 - 05:06:15 EST
在 2013-8-8,下午5:04,"ethan.zhao" <ethan.kernel@xxxxxxxxx> 写道:
> Kernel 3.11-rc1 +Peterz' patch+ Mike's patch, No C-states in BIOS, got the same result as only Peter's patch.
Typo 3.11-rc3
> Of course , No C states to enter, make sense.
> [root@localhost ~]# time ./pip1m
>
> real 0m4.381s
> user 0m0.099s
> sys 0m2.784s
> [root@localhost ~]# time ./pip1m
>
> real 0m4.436s
> user 0m0.093s
> sys 0m2.809s
> [root@localhost ~]#
>
> Retest with C-states enabled in BIOS
> [root@localhost ~]# time ./pip1m
>
> real 0m8.670s
> user 0m0.203s
> sys 0m5.459s
> [root@localhost ~]# time ./pip1m
>
> real 0m8.489s
> user 0m0.184s
> sys 0m5.360s
> [root@localhost ~]#
>
> So the result is Peter's patch working or Mike's ? Compared with default 3.11-rc3
> result of test case 1 as following, looks great.
> [root@localhost ~]# time ./pip1m
>
> real 0m10.683s
> user 0m0.204s
> sys 0m6.597s
> [root@localhost ~]# time ./pip1m
>
> real 0m10.629s
> user 0m0.185s
> sys 0m6.546s
>
> So revert Mike's patch and retest, got
> [root@localhost ~]# time ./pip1m
>
> real 0m8.606s
> user 0m0.193s
> sys 0m5.449s
> [root@localhost ~]# time ./pip1m
>
> real 0m8.655s
> user 0m0.198s
> sys 0m5.519s
> [root@localhost ~]#
>
> So, it's Peter's patch working………
>
> The result of kernel 3.11-rc3 + Peter's patch + no rescheduling IPI and no C-states in BIOS is :
> [root@localhost ~]# time ./pip1m
>
> real 0m3.915s
> user 0m0.088s
> sys 0m2.487s
> [root@localhost ~]# time ./pip1m
>
> real 0m3.929s
> user 0m0.082s
> sys 0m2.560s
> [root@localhost ~]# time ./pip1m
>
> Got about 0.5 sec better than only Peter's patch, but it is strange, only no rescheduling IPI almost got the
> same result.
>
>
> Thanks,
> Ethan
>
>
> 在 2013-8-8,下午12:31,ethan.zhao <ethan.kernel@xxxxxxxxx> 写道:
>>>>
>>>> sched: ratelimit nohz
>>>>
>>>> Entering nohz code on every micro-idle is too expensive to bear.
>>>>
>>>> Signed-off-by: Mike Galbraith <efault@xxxxxx>
>>>>
>>>> ---
>>>> include/linux/sched.h | 5 +++++
>>>> kernel/sched/core.c | 5 +++++
>>>> kernel/time/tick-sched.c | 2 +-
>>>> 3 files changed, 11 insertions(+), 1 deletion(-)
>>>>
>>>> --- a/include/linux/sched.h
>>>> +++ b/include/linux/sched.h
>>>> @@ -235,9 +235,14 @@ extern int runqueue_is_locked(int cpu);
>>>> extern void nohz_balance_enter_idle(int cpu);
>>>> extern void set_cpu_sd_state_idle(void);
>>>> extern int get_nohz_timer_target(void);
>>>> +extern int sched_needs_cpu(int cpu);
>>>> #else
>>>> static inline void nohz_balance_enter_idle(int cpu) { }
>>>> static inline void set_cpu_sd_state_idle(void) { }
>>>> +static inline int sched_needs_cpu(int cpu)
>>>> +{
>>>> + return 0;
>>>> +}
>>>> #endif
>>>>
>>>> /*
>>>> --- a/kernel/sched/core.c
>>>> +++ b/kernel/sched/core.c
>>>> @@ -650,6 +650,11 @@ static inline bool got_nohz_idle_kick(vo
>>>> return false;
>>>> }
>>>>
>>>> +int sched_needs_cpu(int cpu)
>>>> +{
>>>> + return cpu_rq(cpu)->avg_idle < sysctl_sched_migration_cost;
>>>> +}
>>>> +
>>>> #else /* CONFIG_NO_HZ_COMMON */
>>>>
>>>> static inline bool got_nohz_idle_kick(void)
>>>> --- a/kernel/time/tick-sched.c
>>>> +++ b/kernel/time/tick-sched.c
>>>> @@ -548,7 +548,7 @@ static ktime_t tick_nohz_stop_sched_tick
>>>> time_delta = timekeeping_max_deferment();
>>>> } while (read_seqretry(&jiffies_lock, seq));
>>>>
>>>> - if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
>>>> + if (sched_needs_cpu(cpu) || rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
>>>> arch_needs_cpu(cpu) || irq_work_needs_cpu()) {
>>>> next_jiffies = last_jiffies + 1;
>>>> delta_jiffies = 1;
>>>>
>>>>
>>>
>>>
>>
>
--
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/