From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751859AbbDIGxa (ORCPT ); Thu, 9 Apr 2015 02:53:30 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:35802 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbbDIGx3 (ORCPT ); Thu, 9 Apr 2015 02:53:29 -0400 Date: Thu, 9 Apr 2015 08:53:24 +0200 From: Ingo Molnar To: Thomas Gleixner Cc: Viresh Kumar , Ingo Molnar , Peter Zijlstra , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Preeti U Murthy Subject: [PATCH] hrtimer: Replace timerqueue_getnext() uses with direct access to 'active.next' Message-ID: <20150409065324.GE14259@gmail.com> References: <20150409062841.GB14259@gmail.com> <20150409063838.GC14259@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150409063838.GC14259@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar wrote: > I'd also suggest the removal of the timerqueue_getnext() > obfuscation: it 'sounds' complex but in reality it's a simple > dereference to active.next. I think this is what triggered this > rather pointless maintenance of active_bases. The patch below does this - it's more readable to me in this fashion, the 'next' field is already very clearly named, no need for a (longer!) helper function there. I lightly tested the 3 patches with hrtimers enabled under a virtual machine. Thanks, Ingo --- kernel/time/hrtimer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Index: tip/kernel/time/hrtimer.c =================================================================== --- tip.orig/kernel/time/hrtimer.c +++ tip/kernel/time/hrtimer.c @@ -451,7 +451,7 @@ static ktime_t __hrtimer_get_next_event( struct timerqueue_node *next; struct hrtimer *timer; - next = timerqueue_getnext(&base->active); + next = base->active.next; if (!next) continue; @@ -876,7 +876,7 @@ static void __remove_hrtimer(struct hrti if (!(timer->state & HRTIMER_STATE_ENQUEUED)) goto out; - next_timer = timerqueue_getnext(&base->active); + next_timer = base->active.next; timerqueue_del(&base->active, &timer->node); if (&timer->node == next_timer) { #ifdef CONFIG_HIGH_RES_TIMERS @@ -1271,7 +1271,7 @@ retry: basenow = ktime_add(now, base->offset); - while ((node = timerqueue_getnext(&base->active))) { + while ((node = base->active.next)) { struct hrtimer *timer; timer = container_of(node, struct hrtimer, node); @@ -1438,7 +1438,7 @@ void hrtimer_run_queues(void) for (index = 0; index < HRTIMER_MAX_CLOCK_BASES; index++) { base = &cpu_base->clock_base[index]; - if (!timerqueue_getnext(&base->active)) + if (!base->active.next) continue; if (gettime) { @@ -1448,7 +1448,7 @@ void hrtimer_run_queues(void) raw_spin_lock(&cpu_base->lock); - while ((node = timerqueue_getnext(&base->active))) { + while ((node = base->active.next)) { struct hrtimer *timer; timer = container_of(node, struct hrtimer, node); @@ -1631,7 +1631,7 @@ static void migrate_hrtimer_list(struct struct hrtimer *timer; struct timerqueue_node *node; - while ((node = timerqueue_getnext(&old_base->active))) { + while ((node = old_base->active.next)) { timer = container_of(node, struct hrtimer, node); BUG_ON(hrtimer_callback_running(timer)); debug_deactivate(timer);