From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: Chinmay V S <chinmay.v.s@pathpartnertech.com>
Cc: linux-kernel@vger.kernel.org, cvs268@gmail.com,
tglx@linutronix.de, sebastian@breakpoint.cc,
arjan@linux.intel.com, jeff.chua.linux@gmail.com
Subject: Re: [RFC] [PATCH] [timer] Optimise apply_slack() for size and speed.
Date: Thu, 2 Feb 2012 23:59:17 +0100 [thread overview]
Message-ID: <20120202225917.GA1189@kibibi> (raw)
In-Reply-To: <1328002652-7700-1-git-send-email-chinmay.v.s@pathpartnertech.com>
* Chinmay V S | 2012-01-31 15:07:32 [+0530]:
>This patch modifies the masking logic to a bit-shift logic, therby
>reducing the complexity and number of operations. Thus obtaining a minor
>speed-up.
>diff --git a/kernel/timer.c b/kernel/timer.c
>index a297ffc..0379658 100644
>--- a/kernel/timer.c
>+++ b/kernel/timer.c
>@@ -785,9 +785,7 @@ EXPORT_SYMBOL(mod_timer_pending);
>@@ -811,9 +809,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
>
> bit = find_last_bit(&mask, BITS_PER_LONG);
>
>- mask = (1 << bit) - 1;
>-
>- expires_limit = expires_limit & ~(mask);
>+ expires_limit = (expires_limit >> bit) << bit;
The question is whether a shift left is more efficient compared to an
and operation. Besides that you save atleast one operation because you
don't need to load -1 into a register for creating a mask. So it looks
like less code.
Sebastian
next prev parent reply other threads:[~2012-02-02 23:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 9:37 [RFC] [PATCH] [timer] Optimise apply_slack() for size and speed Chinmay V S
2012-02-02 22:59 ` Sebastian Andrzej Siewior [this message]
[not found] ` <CAKZbaaTDcfEVPa2JRSnkv_YCiScoTTqpmzaGQGWT98QJpYzZ8A@mail.gmail.com>
2012-02-03 14:52 ` Arjan van de Ven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120202225917.GA1189@kibibi \
--to=sebastian@breakpoint.cc \
--cc=arjan@linux.intel.com \
--cc=chinmay.v.s@pathpartnertech.com \
--cc=cvs268@gmail.com \
--cc=jeff.chua.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox