public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org
Subject: privatize CALC_LOAD()
Date: Sun, 29 Apr 2007 14:52:15 -0700	[thread overview]
Message-ID: <20070429215215.GA19966@holomorphy.com> (raw)

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.

                 reply	other threads:[~2007-04-29 21:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070429215215.GA19966@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox