privatize CALC_LOAD()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux