From: Jeff Chua <jeff.chua.linux@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Johannes Berg <johannes.berg@intel.com>,
Arjan van de Ven <arjan@linux.intel.com>,
"johnstul@us.ibm.com" <johnstul@us.ibm.com>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Intel Linux Wireless <ilw@linux.intel.com>,
"John W. Linville" <linville@tuxdriver.com>,
Frans Pop <elendil@planet.nl>,
"Chatre, Reinette" <reinette.chatre@intel.com>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: Wireless IBSS on Linux-2.6.34 broken by commit 3bbb9ec946428b96657126768f65487a48dd090c
Date: Tue, 25 May 2010 06:48:35 +0800 (SGT) [thread overview]
Message-ID: <Pine.LNX.4.64.1005250637530.3140@boston.corp.fedex.com> (raw)
On Mon, May 24, 2010 at 10:57 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:>
> On Mon, 24 May 2010, Jeff Chua wrote:
>> + if (timer->slack > -1)
>> + else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */
>> expires_limit = expires + (expires - jiffies)/256;
>
> Please don't reload 'jiffies' twice. It's volatile, and the compiler will
> do a crap job of it.
Linus,
Sorry, didn't know what a jiffies was before, so didn't know about the
crap it caused. Now I learned something new.
> Also, '0' is a normal number, but '-1' is a rather odd value. Please just
> test for non-negative by doing ">= 0" rather than "> -1"
Fixed.
Below is the patch to fix jiffies and checking for non-negative.
Thanks,
Jeff
--- a/kernel/timer.c.org 2010-05-25 06:05:46.000000000 +0800
+++ a/kernel/timer.c 2010-05-25 06:17:44.000000000 +0800
@@ -748,14 +748,15 @@
unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
{
unsigned long expires_limit, mask;
+ unsigned long now = jiffies;
int bit;
expires_limit = expires;
- if (timer->slack > -1)
+ if (timer->slack >= 0)
expires_limit = expires + timer->slack;
- else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */
- expires_limit = expires + (expires - jiffies)/256;
+ else if (time_after(expires, now)) /* auto slack: use 0.4% */
+ expires_limit = expires + (expires - now)/256;
mask = expires ^ expires_limit;
if (mask == 0)
next reply other threads:[~2010-05-24 22:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-24 22:48 Jeff Chua [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-05-23 23:16 Jeff Chua
2010-05-24 14:57 ` Linus Torvalds
2010-05-25 18:37 ` Thomas Gleixner
2010-05-23 17:07 Jeff Chua
2010-05-23 4:58 Jeff Chua
2010-05-23 6:21 ` Arjan van de Ven
2010-05-23 9:49 ` Johannes Berg
2010-05-23 13:19 ` Jeff Chua
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=Pine.LNX.4.64.1005250637530.3140@boston.corp.fedex.com \
--to=jeff.chua.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=elendil@planet.nl \
--cc=ilw@linux.intel.com \
--cc=johannes.berg@intel.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mingo@elte.hu \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®