Re: [PATCH] use unlikely() for current_kernel_time() loop



On Thursday 08 June 2006 07:01, Andrew Morton wrote:
On 08 Jun 2006 04:28:12 +0200
Andi Kleen <ak@xxxxxxx> wrote:

Andreas Dilger <adilger@xxxxxxxxxxxxx> writes:

Hello,
I just noticed this minor optimization. current_kernel_time() is called
from current_fs_time() so it is used fairly often but it doesn't use
unlikely(read_seqretry(&xtime_lock, seq)) as other users of xtime_lock do.
Also removes extra whitespace on the empty line above.

It would be better to put the unlikely into the read_seqretry I guess.


yup. But it'd be good to check that this actually causes the compiler to
do the right thing, rather than simply ignoring it.

If it was put into a macro wrapper it should be safe enough.


I'm not sure how one would do that though. I guess compare
before-and-after assembly code, work out if "after" is better.

Nothing on x86-64 at least - it uses -fno-reorder-blocks by default.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH] use unlikely() for current_kernel_time() loop
    ... I just noticed this minor optimization. ... I guess compare ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: /dev/hdl not showing up because of fix-ide-probe-double-detection patch
    ... On Iau, 2004-08-05 at 06:47, Andrew Morton wrote: ... they both report that they are Model ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: 2.6.21-gitX: known regressions
    ... Andrew Morton wrote: ... Michal Piotrowski wrote: ... Networking: ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: linux-next: Tree for June 5
    ... On Fri, Jun 6, 2008 at 12:54 PM, Andrew Morton ... Consolidate node_to_cpumask operations and remove the 256k ... This is done by allocating the ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: [LTP] Re: Recent changes in LTP test results
    ... On Wed, 2004-07-07 at 23:07, Andrew Morton wrote: ... fails on my 2-proc xeon box (and all the STP machines). ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)