https://github.com/torvalds/linux
Revision cd7175edf963a92b2c3cd491d3e34afd357e7284 authored by Eric Dumazet on 13 December 2006, 08:35:45 UTC, committed by Linus Torvalds on 13 December 2006, 17:05:55 UTC
calc_load() is called by timer interrupt to update avenrun[].  It currently
calls nr_active() at each timer tick (HZ per second), while the update of
avenrun[] is done only once every 5 seconds.  (LOAD_FREQ=5 Hz)

nr_active() is quite expensive on SMP machines, since it has to sum up
nr_running and nr_uninterruptible of all online CPUS, bringing foreign
dirty cache lines.

This patch is an optimization of calc_load() so that nr_active() is called
only if we need it.

The use of unlikely() is welcome since the condition is true only once every
5*HZ time.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent f988443
History
Tip revision: cd7175edf963a92b2c3cd491d3e34afd357e7284 authored by Eric Dumazet on 13 December 2006, 08:35:45 UTC
[PATCH] Optimize calc_load()
Tip revision: cd7175e
File Mode Size
Documentation
arch
block
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
scripts
security
sound
usr
.gitignore -rw-r--r-- 547 bytes
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 88.5 KB
Kbuild -rw-r--r-- 1.2 KB
MAINTAINERS -rw-r--r-- 75.2 KB
Makefile -rw-r--r-- 49.2 KB
README -rw-r--r-- 16.5 KB
REPORTING-BUGS -rw-r--r-- 3.0 KB

README

back to top