sched: convert struct cpupri_vec cpumask_var_t.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 24 Nov 2008 16:05:13 +0000 (02:35 +1030)
committerIngo Molnar <mingo@elte.hu>
Mon, 24 Nov 2008 16:52:22 +0000 (17:52 +0100)
Impact: stack usage reduction, (future) size reduction for large NR_CPUS.

Dynamically allocating cpumasks (when CONFIG_CPUMASK_OFFSTACK) saves
space for small nr_cpu_ids but big CONFIG_NR_CPUS.

The fact cpupro_init is called both before and after the slab is
available makes for an ugly parameter unfortunately.

We also use cpumask_any_and to get rid of a temporary in cpupri_find.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c
kernel/sched_cpupri.c
kernel/sched_cpupri.h

index 42588ad..94fa333 100644 (file)
@@ -6792,6 +6792,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
 
 static void free_rootdomain(struct root_domain *rd)
 {
+       cpupri_cleanup(&rd->cpupri);
+
        free_cpumask_var(rd->rto_mask);
        free_cpumask_var(rd->online);
        free_cpumask_var(rd->span);
@@ -6834,7 +6836,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem)
                alloc_bootmem_cpumask_var(&def_root_domain.span);
                alloc_bootmem_cpumask_var(&def_root_domain.online);
                alloc_bootmem_cpumask_var(&def_root_domain.rto_mask);
-               cpupri_init(&rd->cpupri);
+               cpupri_init(&rd->cpupri, true);
                return 0;
        }
 
@@ -6845,9 +6847,12 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem)
        if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
                goto free_online;
 
-       cpupri_init(&rd->cpupri);
+       if (cpupri_init(&rd->cpupri, false) != 0)
+               goto free_rto_mask;
        return 0;
 
+free_rto_mask:
+       free_cpumask_var(rd->rto_mask);
 free_online:
        free_cpumask_var(rd->online);
 free_span:
Simple merge
Simple merge