Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318398
b: refs/heads/master
c: d35be8b
h: refs/heads/master
v: v3
  • Loading branch information
Srivatsa S. Bhat authored and Ingo Molnar committed Jul 24, 2012
1 parent 50fc4cc commit e593674
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee08d1284ea9235b29bd2d9b7493b4b4cf3da09c
refs/heads/master: d35be8bab9b0ce44bed4b9453f86ebf64062721e
3 changes: 3 additions & 0 deletions trunk/kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,9 @@ static void scan_for_empty_cpusets(struct cpuset *root)
* (of no affect) on systems that are actively using CPU hotplug
* but making no active use of cpusets.
*
* The only exception to this is suspend/resume, where we don't
* modify cpusets at all.
*
* This routine ensures that top_cpuset.cpus_allowed tracks
* cpu_active_mask on each CPU hotplug (cpuhp) event.
*
Expand Down
40 changes: 36 additions & 4 deletions trunk/kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -7097,34 +7097,66 @@ void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
mutex_unlock(&sched_domains_mutex);
}

static int num_cpus_frozen; /* used to mark begin/end of suspend/resume */

/*
* Update cpusets according to cpu_active mask. If cpusets are
* disabled, cpuset_update_active_cpus() becomes a simple wrapper
* around partition_sched_domains().
*
* If we come here as part of a suspend/resume, don't touch cpusets because we
* want to restore it back to its original state upon resume anyway.
*/
static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
switch (action) {
case CPU_ONLINE_FROZEN:
case CPU_DOWN_FAILED_FROZEN:

/*
* num_cpus_frozen tracks how many CPUs are involved in suspend
* resume sequence. As long as this is not the last online
* operation in the resume sequence, just build a single sched
* domain, ignoring cpusets.
*/
num_cpus_frozen--;
if (likely(num_cpus_frozen)) {
partition_sched_domains(1, NULL, NULL);
break;
}

/*
* This is the last CPU online operation. So fall through and
* restore the original sched domains by considering the
* cpuset configurations.
*/

case CPU_ONLINE:
case CPU_DOWN_FAILED:
cpuset_update_active_cpus();
return NOTIFY_OK;
break;
default:
return NOTIFY_DONE;
}
return NOTIFY_OK;
}

static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
switch (action) {
case CPU_DOWN_PREPARE:
cpuset_update_active_cpus();
return NOTIFY_OK;
break;
case CPU_DOWN_PREPARE_FROZEN:
num_cpus_frozen++;
partition_sched_domains(1, NULL, NULL);
break;
default:
return NOTIFY_DONE;
}
return NOTIFY_OK;
}

void __init sched_init_smp(void)
Expand Down

0 comments on commit e593674

Please sign in to comment.