From: Eric Dumazet Date: Wed, 13 Dec 2006 08:35:45 +0000 (-0800) Subject: [PATCH] Optimize calc_load() X-Git-Tag: v2.6.20-rc1~45 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd7175edf963a92b2c3cd491d3e34afd357e7284;p=pandora-kernel.git [PATCH] Optimize calc_load() 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 Cc: Ingo Molnar Acked-by: "Siddha, Suresh B" Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed