Re: [Lse-tech] [PATCH] new bitmap list format (for cpusets)

From: Dinakar Guniguntala
Date: Thu Aug 12 2004 - 04:38:03 EST


On Wed, Aug 11, 2004 at 01:40:18PM -0700, Paul Jackson wrote:
>
> Since I've gotten this far without having the definition of 'struct cpuset'
> exposed in a header file, I'd like to see if I can continue that. I'll
> give this other approach a try - though it will be a day or so before I
> can get to it - prior commitments. Unless of course, someone sends me such
> a patch first ;).

Ok revised patch attached

> However an equivalent detail would matter. Can I mark cpuset_init_smp()
> as "__init" ? Hmmm ... likely I can, since two routines called at the
> same time, sched_init_smp() and smp_init(), are marked __init. This
> suggests that my interpretation of that comment was wrong, and that
> you're entirely right -- calls made in either place can be marked
> __init. Is that comment above misleading?

That I believe applies only to the rest_init function which does not have
the __init qualifier

Regards,

Dinakar


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-12 18:58:51.000000000 +0530
@@ -15,6 +15,7 @@
#ifdef CONFIG_CPUSETS

extern int cpuset_init(void);
+extern void cpuset_init_smp(void);
extern void cpuset_fork(struct task_struct *p);
extern void cpuset_exit(struct task_struct *p);
extern const cpumask_t cpuset_cpus_allowed(const struct task_struct *p);
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-12 18:06:54.000000000 +0530
@@ -708,6 +708,8 @@ static int init(void * unused)
smp_init();
sched_init_smp();

+ cpuset_init_smp();
+
/*
* 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.000000000 +0530
+++ linux-2.6.8-rc2-mm2-cs3.new/kernel/cpuset.c 2004-08-12 18:55:34.000000000 +0530
@@ -1270,7 +1270,6 @@ int __init cpuset_init(void)
struct dentry *root;
int err;

- top_cpuset.cpus_allowed = cpu_possible_map;
top_cpuset.mems_allowed = node_possible_map;

init_task.cpuset = &top_cpuset;
@@ -1296,6 +1295,17 @@ out:
}

/**
+ * cpuset_init_smp - initialize cpus_allowed
+ *
+ * Description: Initialize cpus_allowed after cpu_possible_map is initialized
+ **/
+
+void __init cpuset_init_smp(void)
+{
+ top_cpuset.cpus_allowed = cpu_possible_map;
+}
+
+/**
* cpuset_fork - attach newly forked task to its parents cpuset.
* @p: pointer to task_struct of forking parent process.
*