Re: [PATCH 1/2] hrtimer: don't add clock-base to active_bases if already present
On Thu, 27 Mar 2014, Viresh Kumar wrote: > If active_bases already has entry for a particular clock type, then we don't > need to rewrite it while queuing a hrtimer. > > Signed-off-by: Viresh Kumar > --- > Initially I thought of doing this but then thought better remove active_bases > completely and so didn't sent this one. Now it might find some place for > itself > :). > > kernel/hrtimer.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c > index da351ad..acfef5f 100644 > --- a/kernel/hrtimer.c > +++ b/kernel/hrtimer.c > @@ -864,8 +864,9 @@ static int enqueue_hrtimer(struct hrtimer *timer, > { > debug_activate(timer); > > + if (!timerqueue_getnext(>active)) > + base->cpu_base->active_bases |= 1 << base->index; > timerqueue_add(>active, >node); > - base->cpu_base->active_bases |= 1 << base->index; The conditional is more expensive than actually doing the OR operation at least on x86 as it results in a branch. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] hrtimer: don't add clock-base to active_bases if already present
If active_bases already has entry for a particular clock type, then we don't need to rewrite it while queuing a hrtimer. Signed-off-by: Viresh Kumar --- Initially I thought of doing this but then thought better remove active_bases completely and so didn't sent this one. Now it might find some place for itself :). kernel/hrtimer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index da351ad..acfef5f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -864,8 +864,9 @@ static int enqueue_hrtimer(struct hrtimer *timer, { debug_activate(timer); + if (!timerqueue_getnext(>active)) + base->cpu_base->active_bases |= 1 << base->index; timerqueue_add(>active, >node); - base->cpu_base->active_bases |= 1 << base->index; /* * HRTIMER_STATE_ENQUEUED is or'ed to the current state to preserve the -- 1.7.12.rc2.18.g61b472e -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] hrtimer: don't add clock-base to active_bases if already present
If active_bases already has entry for a particular clock type, then we don't need to rewrite it while queuing a hrtimer. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org --- Initially I thought of doing this but then thought better remove active_bases completely and so didn't sent this one. Now it might find some place for itself :). kernel/hrtimer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index da351ad..acfef5f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -864,8 +864,9 @@ static int enqueue_hrtimer(struct hrtimer *timer, { debug_activate(timer); + if (!timerqueue_getnext(base-active)) + base-cpu_base-active_bases |= 1 base-index; timerqueue_add(base-active, timer-node); - base-cpu_base-active_bases |= 1 base-index; /* * HRTIMER_STATE_ENQUEUED is or'ed to the current state to preserve the -- 1.7.12.rc2.18.g61b472e -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] hrtimer: don't add clock-base to active_bases if already present
On Thu, 27 Mar 2014, Viresh Kumar wrote: If active_bases already has entry for a particular clock type, then we don't need to rewrite it while queuing a hrtimer. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org --- Initially I thought of doing this but then thought better remove active_bases completely and so didn't sent this one. Now it might find some place for itself :). kernel/hrtimer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index da351ad..acfef5f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -864,8 +864,9 @@ static int enqueue_hrtimer(struct hrtimer *timer, { debug_activate(timer); + if (!timerqueue_getnext(base-active)) + base-cpu_base-active_bases |= 1 base-index; timerqueue_add(base-active, timer-node); - base-cpu_base-active_bases |= 1 base-index; The conditional is more expensive than actually doing the OR operation at least on x86 as it results in a branch. Thanks, tglx -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/