lkml.org 
[lkml]   [2009]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 13/15] sched: Detect child domain of NUMA (aka NODE) domain

    On multi-node processors a NUMA node might not span a socket.
    Instead a socket might span several NUMA nodes.

    This patch introduces a check whether NODE domain is parent
    of MC domain and sets s_data.numa_child_level accordingly.
    (See previous patch for further details.)

    Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
    ---
    kernel/sched.c | 43 +++++++++++++++++++++++++++++++++++++++++--
    1 files changed, 41 insertions(+), 2 deletions(-)

    diff --git a/kernel/sched.c b/kernel/sched.c
    index b03701d..0c950dc 100644
    --- a/kernel/sched.c
    +++ b/kernel/sched.c
    @@ -8869,6 +8869,45 @@ static void build_sched_groups(struct s_data *d, enum sched_domain_level l,
    }
    }

    +static enum sched_domain_level get_numa_child_domain_level(struct s_data *d,
    + const struct cpumask *cpu_map)
    +{
    + enum sched_domain_level dl = SD_LV_NONE;
    +#ifdef CONFIG_NUMA
    + int i;
    + int proper_superset = 0;
    + int proper_subset = 0;
    +
    + for_each_cpu(i, cpu_map) {
    + cpumask_and(d->tmpmask, cpu_map, topology_cpu_node_cpumask(i));
    + cpumask_and(d->nodemask, cpu_map,
    + cpumask_of_node(cpu_to_node(i)));
    +
    + /* NUMA node's CPU set is proper subset of socket's CPU set */
    + if (cpumask_subset(d->nodemask, d->tmpmask) &&
    + !cpumask_subset(d->tmpmask, d->nodemask))
    + proper_subset = 1;
    +
    + /* socket's CPU set is proper subset of NUMA node's CPU set */
    + if (!cpumask_subset(d->nodemask, d->tmpmask) &&
    + cpumask_subset(d->tmpmask, d->nodemask))
    + proper_superset = 1;
    + }
    +
    + if (proper_subset && proper_superset)
    + printk(KERN_ERR "sched: inconsistent NUMA hierarchy\n");
    + else if (proper_subset) {
    + printk(KERN_DEBUG "sched: NUMA child domain: MC\n");
    + dl = SD_LV_MC;
    + } else {
    + printk(KERN_DEBUG "sched: NUMA child domain: CPU\n");
    + dl = SD_LV_CPU;
    + }
    +
    +#endif
    + return dl;
    +}
    +
    /*
    * Build sched domains for a given set of cpus and attach the sched domains
    * to the individual cpus
    @@ -8881,13 +8920,13 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
    struct sched_domain *sd;
    int i;

    - d.numa_child_level = SD_LV_NONE;
    -
    alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
    if (alloc_state != sa_rootdomain)
    goto error;
    alloc_state = sa_sched_groups;

    + d.numa_child_level = get_numa_child_domain_level(&d, cpu_map);
    +
    /*
    * Set up domains for cpus specified by the cpu_map.
    */
    --
    1.6.0.4




    \
     
     \ /
      Last update: 2009-08-20 15:47    [W:2.380 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site