Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33646
b: refs/heads/master
c: 4c4d50f
h: refs/heads/master
v: v3
  • Loading branch information
Paul Jackson authored and Linus Torvalds committed Aug 27, 2006
1 parent 1e78133 commit 8a48152
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6394cca54894f6a9bcf927ab78d28985944298ff
refs/heads/master: 4c4d50f7b39cc58f1064b93a61ad617451ae41df
6 changes: 6 additions & 0 deletions trunk/Documentation/cpusets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ exclusive cpuset. Also, the use of a Linux virtual file system (vfs)
to represent the cpuset hierarchy provides for a familiar permission
and name space for cpusets, with a minimum of additional kernel code.

The cpus file in the root (top_cpuset) cpuset is read-only.
It automatically tracks the value of cpu_online_map, using a CPU
hotplug notifier. If and when memory nodes can be hotplugged,
we expect to make the mems file in the root cpuset read-only
as well, and have it track the value of node_online_map.


1.4 What are exclusive cpusets ?
--------------------------------
Expand Down
33 changes: 33 additions & 0 deletions trunk/kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ static int update_cpumask(struct cpuset *cs, char *buf)
struct cpuset trialcs;
int retval, cpus_unchanged;

/* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */
if (cs == &top_cpuset)
return -EACCES;

trialcs = *cs;
retval = cpulist_parse(buf, trialcs.cpus_allowed);
if (retval < 0)
Expand Down Expand Up @@ -2033,6 +2037,33 @@ int __init cpuset_init(void)
return err;
}

/*
* The top_cpuset tracks what CPUs and Memory Nodes are online,
* period. This is necessary in order to make cpusets transparent
* (of no affect) on systems that are actively using CPU hotplug
* but making no active use of cpusets.
*
* This handles CPU hotplug (cpuhp) events. If someday Memory
* Nodes can be hotplugged (dynamically changing node_online_map)
* then we should handle that too, perhaps in a similar way.
*/

#ifdef CONFIG_HOTPLUG_CPU
static int cpuset_handle_cpuhp(struct notifier_block *nb,
unsigned long phase, void *cpu)
{
mutex_lock(&manage_mutex);
mutex_lock(&callback_mutex);

top_cpuset.cpus_allowed = cpu_online_map;

mutex_unlock(&callback_mutex);
mutex_unlock(&manage_mutex);

return 0;
}
#endif

/**
* cpuset_init_smp - initialize cpus_allowed
*
Expand All @@ -2043,6 +2074,8 @@ void __init cpuset_init_smp(void)
{
top_cpuset.cpus_allowed = cpu_online_map;
top_cpuset.mems_allowed = node_online_map;

hotcpu_notifier(cpuset_handle_cpuhp, 0);
}

/**
Expand Down

0 comments on commit 8a48152

Please sign in to comment.