lkml.org 
[lkml]   [2004]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [Lse-tech] [PATCH] new bitmap list format (for cpusets)
Paul,

Considering that cpu_possible_map does not get fully initialized
until smp_prepare_cpus gets called by init(), I thought it right
to move cpuset_init() to after smp initialization. I tested it on
2.6.8-rc2-mm2 and it seemed to work ok.

Patch attached below

Regards,

Dinakar

Signed-off-by: Dinakar Guniguntala <dino@in.ibm.com>


diff -Naurp linux-2.6.8-rc2-mm2-cs3/include/linux/cpuset.h linux-2.6.8-rc2-mm2-cs3.new/include/linux/cpuset.h
--- linux-2.6.8-rc2-mm2-cs3/include/linux/cpuset.h 2004-08-05 17:22:31.000000000 +0530
+++ linux-2.6.8-rc2-mm2-cs3.new/include/linux/cpuset.h 2004-08-10 22:58:23.000000000 +0530
@@ -14,6 +14,43 @@

#ifdef CONFIG_CPUSETS

+struct cpuset {
+ unsigned long flags; /* "unsigned long" so bitops work */
+ cpumask_t cpus_allowed; /* CPUs allowed to tasks in cpuset */
+ nodemask_t mems_allowed; /* Memory Nodes allowed to tasks */
+
+ atomic_t count; /* count tasks using this cpuset */
+
+ /*
+ * We link our 'sibling' struct into our parents 'children'.
+ * Our children link their 'sibling' into our 'children'.
+ */
+ struct list_head sibling; /* my parents children */
+ struct list_head children; /* my children */
+
+ struct cpuset *parent; /* my parent */
+ struct dentry *dentry; /* cpuset fs entry */
+};
+
+/* bits in struct cpuset flags field */
+typedef enum {
+ CS_CPU_EXCLUSIVE,
+ CS_MEM_EXCLUSIVE,
+ CS_REMOVED,
+ CS_NOTIFY_ON_RELEASE
+} cpuset_flagbits_t;
+
+static struct cpuset top_cpuset = {
+ .flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)),
+ .cpus_allowed = CPU_MASK_ALL,
+ .mems_allowed = NODE_MASK_ALL,
+ .count = ATOMIC_INIT(0),
+ .sibling = LIST_HEAD_INIT(top_cpuset.sibling),
+ .children = LIST_HEAD_INIT(top_cpuset.children),
+ .parent = NULL,
+ .dentry = NULL,
+};
+
extern int cpuset_init(void);
extern void cpuset_fork(struct task_struct *p);
extern void cpuset_exit(struct task_struct *p);
@@ -26,8 +63,14 @@ int cpuset_zonelist_valid_mems_allowed(s
int cpuset_zone_allowed(struct zone *z);
extern struct file_operations proc_cpuset_operations;

+#define INIT_TASK_CPUSET(tsk) \
+ .cpuset = &top_cpuset, \
+ .mems_allowed = NODE_MASK_ALL,
+
#else /* !CONFIG_CPUSETS */

+#define INIT_TASK_CPUSET(tsk)
+
static inline int cpuset_init(void) { return 0; }
static inline void cpuset_fork(struct task_struct *p) {}
static inline void cpuset_exit(struct task_struct *p) {}
diff -Naurp linux-2.6.8-rc2-mm2-cs3/include/linux/init_task.h linux-2.6.8-rc2-mm2-cs3.new/include/linux/init_task.h
--- linux-2.6.8-rc2-mm2-cs3/include/linux/init_task.h 2004-08-05 17:20:52.000000000 +0530
+++ linux-2.6.8-rc2-mm2-cs3.new/include/linux/init_task.h 2004-08-10 22:47:14.000000000 +0530
@@ -3,6 +3,7 @@

#include <linux/file.h>
#include <linux/pagg.h>
+#include <linux/cpuset.h>

#define INIT_FILES \
{ \
@@ -114,6 +115,7 @@ extern struct group_info init_groups;
.switch_lock = SPIN_LOCK_UNLOCKED, \
.journal_info = NULL, \
INIT_TASK_PAGG(tsk) \
+ INIT_TASK_CPUSET(tsk) \
}


diff -Naurp linux-2.6.8-rc2-mm2-cs3/include/linux/pagg.h linux-2.6.8-rc2-mm2-cs3.new/include/linux/pagg.h
--- linux-2.6.8-rc2-mm2-cs3/include/linux/pagg.h 2004-08-05 17:20:52.000000000 +0530
+++ linux-2.6.8-rc2-mm2-cs3.new/include/linux/pagg.h 2004-08-10 20:12:45.000000000 +0530
@@ -183,7 +183,7 @@ static inline void pagg_exec(struct task
*/
#define INIT_TASK_PAGG(tsk) \
.pagg_list = LIST_HEAD_INIT(tsk.pagg_list), \
- .pagg_sem = __RWSEM_INITIALIZER(tsk.pagg_sem)
+ .pagg_sem = __RWSEM_INITIALIZER(tsk.pagg_sem),

#else /* CONFIG_PAGG */

diff -Naurp linux-2.6.8-rc2-mm2-cs3/init/main.c linux-2.6.8-rc2-mm2-cs3.new/init/main.c
--- linux-2.6.8-rc2-mm2-cs3/init/main.c 2004-08-05 17:22:31.000000000 +0530
+++ linux-2.6.8-rc2-mm2-cs3.new/init/main.c 2004-08-11 21:50:24.970179272 +0530
@@ -569,8 +569,6 @@ asmlinkage void __init start_kernel(void
#ifdef CONFIG_PROC_FS
proc_root_init();
#endif
- cpuset_init();
-
check_bugs();

/* Do the rest non-__init'ed, we're now alive */
@@ -708,6 +706,8 @@ static int init(void * unused)
smp_init();
sched_init_smp();

+ cpuset_init();
+
/*
* Do this before initcalls, because some drivers want to access
* firmware files.
diff -Naurp linux-2.6.8-rc2-mm2-cs3/kernel/cpuset.c linux-2.6.8-rc2-mm2-cs3.new/kernel/cpuset.c
--- linux-2.6.8-rc2-mm2-cs3/kernel/cpuset.c 2004-08-11 22:02:47.077361832 +0530
+++ linux-2.6.8-rc2-mm2-cs3.new/kernel/cpuset.c 2004-08-11 22:01:07.416512584 +0530
@@ -54,32 +54,6 @@

#define CPUSET_SUPER_MAGIC 0x27e0eb

-struct cpuset {
- unsigned long flags; /* "unsigned long" so bitops work */
- cpumask_t cpus_allowed; /* CPUs allowed to tasks in cpuset */
- nodemask_t mems_allowed; /* Memory Nodes allowed to tasks */
-
- atomic_t count; /* count tasks using this cpuset */
-
- /*
- * We link our 'sibling' struct into our parents 'children'.
- * Our children link their 'sibling' into our 'children'.
- */
- struct list_head sibling; /* my parents children */
- struct list_head children; /* my children */
-
- struct cpuset *parent; /* my parent */
- struct dentry *dentry; /* cpuset fs entry */
-};
-
-/* bits in struct cpuset flags field */
-typedef enum {
- CS_CPU_EXCLUSIVE,
- CS_MEM_EXCLUSIVE,
- CS_REMOVED,
- CS_NOTIFY_ON_RELEASE
-} cpuset_flagbits_t;
-
/* convenient tests for these bits */
static inline int is_cpu_exclusive(const struct cpuset *cs)
{
@@ -101,17 +75,6 @@ static inline int notify_on_release(cons
return !!test_bit(CS_NOTIFY_ON_RELEASE, &cs->flags);
}

-static struct cpuset top_cpuset = {
- .flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)),
- .cpus_allowed = CPU_MASK_ALL,
- .mems_allowed = NODE_MASK_ALL,
- .count = ATOMIC_INIT(0),
- .sibling = LIST_HEAD_INIT(top_cpuset.sibling),
- .children = LIST_HEAD_INIT(top_cpuset.children),
- .parent = NULL,
- .dentry = NULL,
-};
-
static struct vfsmount *cpuset_mount;
static struct super_block *cpuset_sb = NULL;
\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.179 / U:4.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site