[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1005250637530.3140@boston.corp.fedex.com>
Date: Tue, 25 May 2010 06:48:35 +0800 (SGT)
From: Jeff Chua <jeff.chua.linux@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
cc: Johannes Berg <johannes.berg@...el.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
"johnstul@...ibm.com" <johnstul@...ibm.com>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Intel Linux Wireless <ilw@...ux.intel.com>,
"John W. Linville" <linville@...driver.com>,
Frans Pop <elendil@...net.nl>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: Wireless IBSS on Linux-2.6.34 broken by commit
3bbb9ec946428b96657126768f65487a48dd090c
On Mon, May 24, 2010 at 10:57 PM, Linus Torvalds <torvalds@...ux-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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists