public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* privatize CALC_LOAD()
@ 2007-04-29 21:52 William Lee Irwin III
  0 siblings, 0 replies; only message in thread
From: William Lee Irwin III @ 2007-04-29 21:52 UTC (permalink / raw)
  To: linux-kernel

I think I've posted this before, but anyway.

CALC_LOAD() and a number of its attendant macros are only ever used
in kernel/timer.c; this patch moves them there. Bizarrely, various
arch code for S/390, PPC Amiga, m68k(nommu), sh, and sh64 is using
FSHIFT, FIXED_1, and avenrun[] in a manner resembling /proc/ for the
purpose of LED flashing and similar (save S/390, which is rather odd),
so they can't be privatized without some sort of load average helpers.

The macros moved here are only ever used for updating the load average,
not reporting it. None of the platform drivers or /proc/ attempt to do
anything of that sort, so it's useless to clutter sched.h with them.

Spotted over the course of other, more meaningful cleanups being made
in preparation for more serious work.

Signed-off-by: William Irwin <wli@holomorphy.com>


Index: sched/include/linux/sched.h
===================================================================
--- sched.orig/include/linux/sched.h	2007-04-29 14:28:47.165445871 -0700
+++ sched/include/linux/sched.h	2007-04-29 14:29:02.030292970 -0700
@@ -109,15 +109,6 @@
 
 #define FSHIFT		11		/* nr of bits of precision */
 #define FIXED_1		(1<<FSHIFT)	/* 1.0 as fixed-point */
-#define LOAD_FREQ	(5*HZ)		/* 5 sec intervals */
-#define EXP_1		1884		/* 1/exp(5sec/1min) as fixed-point */
-#define EXP_5		2014		/* 1/exp(5sec/5min) */
-#define EXP_15		2037		/* 1/exp(5sec/15min) */
-
-#define CALC_LOAD(load,exp,n) \
-	load *= exp; \
-	load += n*(FIXED_1-exp); \
-	load >>= FSHIFT;
 
 extern unsigned long total_forks;
 extern int nr_threads;
Index: sched/kernel/timer.c
===================================================================
--- sched.orig/kernel/timer.c	2007-04-29 14:28:46.861428546 -0700
+++ sched/kernel/timer.c	2007-04-29 14:29:02.030292970 -0700
@@ -1242,6 +1242,15 @@
 
 EXPORT_SYMBOL(avenrun);
 
+#define LOAD_FREQ	(5*HZ)		/* 5 sec intervals */
+#define EXP_1		1884		/* 1/exp(5sec/1min) as fixed-point */
+#define EXP_5		2014		/* 1/exp(5sec/5min) */
+#define EXP_15		2037		/* 1/exp(5sec/15min) */
+#define CALC_LOAD(load,exp,n) \
+	load *= exp; \
+	load += n*(FIXED_1-exp); \
+	load >>= FSHIFT;
+
 /*
  * calc_load - given tick count, update the avenrun load estimates.
  * This is called while holding a write_lock on xtime_lock.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-29 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-29 21:52 privatize CALC_LOAD() William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox