Eric Dumazet 753e9c5cd9 Optimize timespec_trunc()
The first thing done by timespec_trunc() is :

  if (gran <= jiffies_to_usecs(1) * 1000)

This should really be a test against a constant known at compile time.

Alas, it isnt. jiffies_to_usec() was unilined so C compiler emits a function
call and a multiply to compute : a CONSTANT.

mov    $0x1,%edi
mov    %rbx,0xffffffffffffffe8(%rbp)
mov    %r12,0xfffffffffffffff0(%rbp)
mov    %edx,%ebx
mov    %rsi,0xffffffffffffffc8(%rbp)
mov    %rsi,%r12
callq  ffffffff80232010 <jiffies_to_usecs>
imul   $0x3e8,%eax,%eax
cmp    %ebx,%eax

This patch reorders kernel/time.c a bit so that jiffies_to_usecs() is defined
before timespec_trunc() so that compiler now generates :

cmp    $0x3d0900,%edx  (HZ=250 on my machine)

This gives a better code (timespec_trunc() becoming a leaf function), and
shorter kernel size as well.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:01 -07:00
..
2006-09-11 13:32:30 -04:00
2007-02-11 10:51:32 -08:00
2007-03-16 19:25:06 -07:00
2007-04-30 16:40:39 -07:00
2006-12-07 08:39:36 -08:00
2006-12-04 02:00:22 -05:00
2007-05-08 11:14:58 -07:00
2007-05-08 11:15:00 -07:00
2007-02-17 20:10:16 +01:00
2006-09-29 09:18:12 -07:00
2005-04-16 15:20:36 -07:00
2007-05-08 11:14:59 -07:00
2007-05-07 12:12:59 -07:00
2007-04-24 08:23:08 -07:00
2007-05-08 11:15:01 -07:00
2006-04-19 16:27:18 -07:00
2006-12-07 08:39:25 -08:00
2006-07-10 13:24:25 -07:00