Re: cpusets: randomize node rotor used in cpuset_mem_spread_node()

From: KOSAKI Motohiro
Date: Fri Apr 15 2011 - 03:19:04 EST


Oops.
I should have look into !mempolicy part too.
I'm sorry.

> diff --git a/kernel/fork.c b/kernel/fork.c
> index e7548de..f59c686 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1119,6 +1119,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> }
> mpol_fix_fork_child_flag(p);
> #endif
> +#ifdef CONFIG_CPUSETS
> + p->cpuset_mem_spread_rotor = node_random(&p->mems_allowed);
> + p->cpuset_slab_spread_rotor = node_random(&p->mems_allowed);
> +#endif

Michal, I think this should be

#ifdef CONFIG_CPUSETS
if (cpuset_do_page_mem_spread())
p->cpuset_mem_spread_rotor = node_random(&p->mems_allowed);
if (cpuset_do_slab_mem_spread())
p->cpuset_slab_spread_rotor = node_random(&p->mems_allowed);
#endif

because 99.999% people don't use cpuset's spread mem/slab feature and
get_random_int() isn't zero cost.

What do you think?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/