linux/include
Eric Dumazet 5517d86bea Speed up divides by cpu_power in scheduler
I noticed expensive divides done in try_to_wakeup() and
find_busiest_group() on a bi dual core Opteron machine (total of 4 cores),
moderatly loaded (15.000 context switch per second)

oprofile numbers :

CPU: AMD64 processors, speed 2600.05 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a unit
mask of 0x00 (No unit mask) count 50000
samples  %        symbol name
...
613914    1.0498  try_to_wake_up
    834  0.0013 :ffffffff80227ae1:   div    %rcx
77513  0.1191 :ffffffff80227ae4:   mov    %rax,%r11

608893    1.0413  find_busiest_group
   1841  0.0031 :ffffffff802260bf:       div    %rdi
140109  0.2394 :ffffffff802260c2:       test   %sil,%sil

Some of these divides can use the reciprocal divides we introduced some
time ago (currently used in slab AFAIK)

We can assume a load will fit in a 32bits number, because with a
SCHED_LOAD_SCALE=128 value, its still a theorical limit of 33554432

When/if we reach this limit one day, probably cpus will have a fast
hardware divide and we can zap the reciprocal divide trick.

Ingo suggested to rename cpu_power to __cpu_power to make clear it should
not be modified without changing its reciprocal value too.

I did not convert the divide in cpu_avg_load_per_task(), because tracking
nr_running changes may be not worth it ?  We could use a static table of 32
reciprocal values but it would add a conditional branch and table lookup.

[akpm@linux-foundation.org: !SMP build fix]
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:17 -07:00
..
acpi PNPACPI sets pnpdev->dev.archdata 2007-05-08 11:15:08 -07:00
asm-alpha Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-arm Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-arm26 Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-avr32 Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-blackfin blackfin architecture 2007-05-07 12:12:58 -07:00
asm-cris move die notifier handling to common code 2007-05-08 11:15:04 -07:00
asm-frv Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-generic move die notifier handling to common code 2007-05-08 11:15:04 -07:00
asm-h8300 Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-i386 Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-ia64 Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-m32r Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-m68k Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-m68knommu Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-mips au1550 SPI controller driver 2007-05-08 11:15:16 -07:00
asm-parisc Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-powerpc kdump/kexec: calculate note size at compile time 2007-05-08 11:15:07 -07:00
asm-ppc Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-s390 kdump/kexec: calculate note size at compile time 2007-05-08 11:15:07 -07:00
asm-sh Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-sh64 Clean up mostly unused IOSPACE macros 2007-05-08 11:15:13 -07:00
asm-sparc move die notifier handling to common code 2007-05-08 11:15:04 -07:00
asm-sparc64 consolidate asm/const.h to linux/const.h 2007-05-08 11:15:13 -07:00
asm-um move die notifier handling to common code 2007-05-08 11:15:04 -07:00
asm-v850 move die notifier handling to common code 2007-05-08 11:15:04 -07:00
asm-x86_64 x86_64: kill 19000+ sparse warnings 2007-05-08 11:15:14 -07:00
asm-xtensa move die notifier handling to common code 2007-05-08 11:15:04 -07:00
crypto [CRYPTO] cryptd: Add software async crypto daemon 2007-05-02 14:38:32 +10:00
keys [AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both 2007-04-26 15:48:28 -07:00
linux Speed up divides by cpu_power in scheduler 2007-05-08 11:15:17 -07:00
math-emu Delete unused header file math-emu/extended.h 2007-05-08 11:15:05 -07:00
media i2c: Cleanup the includes of <linux/i2c.h> 2007-05-01 23:26:29 +02:00
mtd UBI: Unsorted Block Images 2007-04-27 14:23:33 +03:00
net cleanup compat ioctl handling 2007-05-08 11:15:09 -07:00
pcmcia add new_id to PCMCIA drivers 2007-05-07 12:12:50 -07:00
rdma Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2007-05-07 12:18:21 -07:00
rxrpc [AF_RXRPC]: Delete the old RxRPC code. 2007-04-26 15:55:48 -07:00
scsi [SCSI] modalias for scsi devices 2007-04-17 18:15:04 -04:00
sound [ALSA] version 1.0.14rc3 2007-03-14 08:25:52 +01:00
video
Kbuild