Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119151
b: refs/heads/master
c: 700018e
h: refs/heads/master
i:
  119149: 4a4efcd
  119147: d3e6bee
  119143: 120d185
  119135: 8fc27e0
v: v3
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Nov 18, 2008
1 parent c1b83fa commit 4a0fbd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 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: ad133ba3dc283300e5b62b5b7211d2f39fbf6ee7
refs/heads/master: 700018e0a77b4113172257fcdaa1c58e27a5074f
12 changes: 8 additions & 4 deletions trunk/kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ static int generate_sched_domains(cpumask_t **domains,
int ndoms; /* number of sched domains in result */
int nslot; /* next empty doms[] cpumask_t slot */

ndoms = 0;
doms = NULL;
dattr = NULL;
csa = NULL;
Expand Down Expand Up @@ -674,10 +673,8 @@ static int generate_sched_domains(cpumask_t **domains,
* Convert <csn, csa> to <ndoms, doms> and populate cpu masks.
*/
doms = kmalloc(ndoms * sizeof(cpumask_t), GFP_KERNEL);
if (!doms) {
ndoms = 0;
if (!doms)
goto done;
}

/*
* The rest of the code, including the scheduler, can deal with
Expand Down Expand Up @@ -732,6 +729,13 @@ static int generate_sched_domains(cpumask_t **domains,
done:
kfree(csa);

/*
* Fallback to the default domain if kmalloc() failed.
* See comments in partition_sched_domains().
*/
if (doms == NULL)
ndoms = 1;

*domains = doms;
*attributes = dattr;
return ndoms;
Expand Down
13 changes: 7 additions & 6 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -7789,13 +7789,14 @@ static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur,
*
* The passed in 'doms_new' should be kmalloc'd. This routine takes
* ownership of it and will kfree it when done with it. If the caller
* failed the kmalloc call, then it can pass in doms_new == NULL,
* and partition_sched_domains() will fallback to the single partition
* 'fallback_doms', it also forces the domains to be rebuilt.
* failed the kmalloc call, then it can pass in doms_new == NULL &&
* ndoms_new == 1, and partition_sched_domains() will fallback to
* the single partition 'fallback_doms', it also forces the domains
* to be rebuilt.
*
* If doms_new==NULL it will be replaced with cpu_online_map.
* ndoms_new==0 is a special case for destroying existing domains.
* It will not create the default domain.
* If doms_new == NULL it will be replaced with cpu_online_map.
* ndoms_new == 0 is a special case for destroying existing domains,
* and it will not create the default domain.
*
* Call with hotplug lock held
*/
Expand Down

0 comments on commit 4a0fbd6

Please sign in to comment.