Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7419
b: refs/heads/master
c: f68f447
h: refs/heads/master
i:
  7417: c1054a7
  7415: 102f3bc
v: v3
  • Loading branch information
John Hawkes authored and Linus Torvalds committed Sep 7, 2005
1 parent 6c1cb75 commit bc0d691
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 22 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: 38f18527592756d24a12e84c0713e8c902ba7f15
refs/heads/master: f68f447e8389de9a62e3e80c3c5823cce484c2e5
90 changes: 69 additions & 21 deletions trunk/arch/ia64/kernel/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ static int cpu_to_phys_group(int cpu)
* gets dynamically allocated.
*/
static DEFINE_PER_CPU(struct sched_domain, node_domains);
static struct sched_group *sched_group_nodes[MAX_NUMNODES];
static struct sched_group **sched_group_nodes_bycpu[NR_CPUS];

static DEFINE_PER_CPU(struct sched_domain, allnodes_domains);
static struct sched_group sched_group_allnodes[MAX_NUMNODES];
static struct sched_group *sched_group_allnodes_bycpu[NR_CPUS];

static int cpu_to_allnodes_group(int cpu)
{
Expand All @@ -138,6 +138,21 @@ static int cpu_to_allnodes_group(int cpu)
void build_sched_domains(const cpumask_t *cpu_map)
{
int i;
#ifdef CONFIG_NUMA
struct sched_group **sched_group_nodes = NULL;
struct sched_group *sched_group_allnodes = NULL;

/*
* Allocate the per-node list of sched groups
*/
sched_group_nodes = kmalloc(sizeof(struct sched_group*)*MAX_NUMNODES,
GFP_ATOMIC);
if (!sched_group_nodes) {
printk(KERN_WARNING "Can not alloc sched group node list\n");
return;
}
sched_group_nodes_bycpu[first_cpu(*cpu_map)] = sched_group_nodes;
#endif

/*
* Set up domains for cpus specified by the cpu_map.
Expand All @@ -150,8 +165,21 @@ void build_sched_domains(const cpumask_t *cpu_map)
cpus_and(nodemask, nodemask, *cpu_map);

#ifdef CONFIG_NUMA
if (num_online_cpus()
if (cpus_weight(*cpu_map)
> SD_NODES_PER_DOMAIN*cpus_weight(nodemask)) {
if (!sched_group_allnodes) {
sched_group_allnodes
= kmalloc(sizeof(struct sched_group)
* MAX_NUMNODES,
GFP_KERNEL);
if (!sched_group_allnodes) {
printk(KERN_WARNING
"Can not alloc allnodes sched group\n");
break;
}
sched_group_allnodes_bycpu[i]
= sched_group_allnodes;
}
sd = &per_cpu(allnodes_domains, i);
*sd = SD_ALLNODES_INIT;
sd->span = *cpu_map;
Expand Down Expand Up @@ -214,8 +242,9 @@ void build_sched_domains(const cpumask_t *cpu_map)
}

#ifdef CONFIG_NUMA
init_sched_build_groups(sched_group_allnodes, *cpu_map,
&cpu_to_allnodes_group);
if (sched_group_allnodes)
init_sched_build_groups(sched_group_allnodes, *cpu_map,
&cpu_to_allnodes_group);

for (i = 0; i < MAX_NUMNODES; i++) {
/* Set up node groups */
Expand All @@ -226,8 +255,10 @@ void build_sched_domains(const cpumask_t *cpu_map)
int j;

cpus_and(nodemask, nodemask, *cpu_map);
if (cpus_empty(nodemask))
if (cpus_empty(nodemask)) {
sched_group_nodes[i] = NULL;
continue;
}

domainspan = sched_domain_node_span(i);
cpus_and(domainspan, domainspan, *cpu_map);
Expand Down Expand Up @@ -372,25 +403,42 @@ void arch_destroy_sched_domains(const cpumask_t *cpu_map)
{
#ifdef CONFIG_NUMA
int i;
for (i = 0; i < MAX_NUMNODES; i++) {
cpumask_t nodemask = node_to_cpumask(i);
struct sched_group *oldsg, *sg = sched_group_nodes[i];
int cpu;

cpus_and(nodemask, nodemask, *cpu_map);
if (cpus_empty(nodemask))
continue;
for_each_cpu_mask(cpu, *cpu_map) {
struct sched_group *sched_group_allnodes
= sched_group_allnodes_bycpu[cpu];
struct sched_group **sched_group_nodes
= sched_group_nodes_bycpu[cpu];

if (sg == NULL)
if (sched_group_allnodes) {
kfree(sched_group_allnodes);
sched_group_allnodes_bycpu[cpu] = NULL;
}

if (!sched_group_nodes)
continue;
sg = sg->next;

for (i = 0; i < MAX_NUMNODES; i++) {
cpumask_t nodemask = node_to_cpumask(i);
struct sched_group *oldsg, *sg = sched_group_nodes[i];

cpus_and(nodemask, nodemask, *cpu_map);
if (cpus_empty(nodemask))
continue;

if (sg == NULL)
continue;
sg = sg->next;
next_sg:
oldsg = sg;
sg = sg->next;
kfree(oldsg);
if (oldsg != sched_group_nodes[i])
goto next_sg;
sched_group_nodes[i] = NULL;
oldsg = sg;
sg = sg->next;
kfree(oldsg);
if (oldsg != sched_group_nodes[i])
goto next_sg;
}
kfree(sched_group_nodes);
sched_group_nodes_bycpu[cpu] = NULL;
}
#endif
}

0 comments on commit bc0d691

Please sign in to comment.