lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 2 Feb 2012 23:59:17 +0100
From:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
To:	Chinmay V S <chinmay.v.s@...hpartnertech.com>
Cc:	linux-kernel@...r.kernel.org, cvs268@...il.com, tglx@...utronix.de,
	sebastian@...akpoint.cc, arjan@...ux.intel.com,
	jeff.chua.linux@...il.com
Subject: Re: [RFC] [PATCH] [timer] Optimise apply_slack() for size and speed.

* 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
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ