Default the cache_domain mask to that of the cpu creating it

Currently, if a cpu creates a cache domain in do_one_cpu, and if that cpu has
not cache information ennumerated in sysfs, the result is a garbage cache_domain
mask, because the cache attribute set doesn't exist, leading to a cache mask of
whatever garbage is on the stack.  Default the behavior to give new
cache_domains the same mask that the child creating the cpu has.  This will
create a situation in which each cpu belongs to one unique cache domain in the
absence of other affinity information, which seems like a sane default

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Neil Horman 2011-10-27 09:46:31 -04:00
parent d8823b7565
commit cc0e3dac40

View file

@ -182,6 +182,12 @@ static void do_one_cpu(char *path)
cpu_set(cpu->number, cpu->mask);
/*
* Default the cache_domain mask to be equal to the cpu
*/
cpus_clear(cache_mask);
cpu_set(cpu->number, cache_mask);
/* if the cpu is on the banned list, just don't add it */
if (cpus_intersects(cpu->mask, banned_cpus)) {
free(cpu);