KUROSAWA Takahiro wrote:
There might be some reason to move cpu_rc and cpu_rc_domain structure
definitions into cpu_rc.h. But I can't find out other good reasons
to move cpu_rc_lock()/cpu_rc_unlock() into cpu_rc.h so far.
Kurosawa-san,
How about the following patch? As Chandra suggested, I directly
can call spin_lock and spin_unlock, but the following change is
needed.
Thanks,
MAEDA Naoaki
include/linux/cpu_rc.h | 27 +++++++++++++++++++++++++++
kernel/cpu_rc.c | 32 ++------------------------------
2 files changed, 29 insertions(+), 30 deletions(-)
Index: linux-2.6.13/include/linux/cpu_rc.h
===================================================================
--- linux-2.6.13.orig/include/linux/cpu_rc.h
+++ linux-2.6.13/include/linux/cpu_rc.h
@@ -17,6 +17,33 @@
#ifdef CONFIG_CPU_RC
#ifdef __KERNEL__
+#define CPU_RC_SPREAD_PERIOD (5 * HZ)
+#define CPU_RC_LOAD_SCALE 1000
+#define CPU_RC_GUAR_SCALE 100
+#define CPU_RC_TSFACTOR_MAX CPU_RC_GUAR_SCALE
+#define CPU_RC_TSFACTOR_INC 5
+#define CPU_RC_RECALC_INTERVAL HZ
+
+struct cpu_rc_domain {
+ spinlock_t lock;
+ unsigned int hungry_groups;
+ cpumask_t cpus;
+ int numcpus;
+};
+
+struct cpu_rc {
+ int guarantee;
+ int is_hungry;
+ unsigned int ts_factor;
+ unsigned long last_recalc;
+ struct cpu_rc_domain *rcd;
+ struct {
+ unsigned long timestamp;
+ unsigned int load;
+ int maybe_hungry;
+ } stat[NR_CPUS]; /* XXX need alignment */
+};
+
void cpu_rc_init(void);
unsigned int cpu_rc_scale_timeslice(task_t *tsk, unsigned int slice);
void cpu_rc_account(task_t *tsk, unsigned long now);
Index: linux-2.6.13/kernel/cpu_rc.c
===================================================================
--- linux-2.6.13.orig/kernel/cpu_rc.c
+++ linux-2.6.13/kernel/cpu_rc.c
@@ -15,35 +15,7 @@
#include <linux/proc_fs.h>
#include <linux/cpu_rc.h>
-/* local macros */
-#define CPU_RC_SPREAD_PERIOD (5 * HZ)
-#define CPU_RC_LOAD_SCALE 1000
-#define CPU_RC_GUAR_SCALE 100
-#define CPU_RC_TSFACTOR_MAX CPU_RC_GUAR_SCALE
-#define CPU_RC_TSFACTOR_INC 5
-#define CPU_RC_RECALC_INTERVAL HZ
-
-struct cpu_rc_domain {
- spinlock_t lock;
- unsigned int hungry_groups;
- cpumask_t cpus;
- int numcpus;
-};
-
-struct cpu_rc {
- int guarantee;
- int is_hungry;
- unsigned int ts_factor;
- unsigned long last_recalc;
- struct cpu_rc_domain *rcd;
- struct {
- unsigned long timestamp;
- unsigned int load;
- int maybe_hungry;
- } stat[NR_CPUS]; /* XXX need alignment */
-};
-
-static struct cpu_rc *cpu_rc_get(task_t *tsk);
+extern struct cpu_rc *cpu_rc_get(task_t *tsk);
static inline void cpu_rc_lock(struct cpu_rc *cr)
{
@@ -228,6 +200,6 @@ void cpu_rc_collect_hunger(task_t *tsk)
tsk->last_activated = 0;
}
-void cpu_rc_init(void)
+void __attribute__((weak)) cpu_rc_init(void)
{
}
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech