lkml.org 
[lkml]   [2015]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in init_rootdomain()
On Thu,  3 Dec 2015 12:44:59 +0800
Xunlei Pang <xlpang@redhat.com> wrote:

> root_domain::rto_mask allocated through alloc_cpumask_var()
> contains garbage data with CONFIG_CPUMASK_OFFSTACK set, this
> may cause problems. For instance, When doing pull_rt_task(),
> it may do useless iterations if rto_mask retains some extra
> garbage bits. Worse still, this can violate the isolated domain
> rule for clustered scheduling using cpuset, because the tasks
> (with all the cpus allowed) which belongs to one root domain
> can be pulled away into another root domain.

I really hate the fact that alloc_cpumask_var() behaves differently
depending on weather or not CONFIG_CPUMASK_OFFSTACK is defined or not.
I wonder if the better solution is to pass the __GFP_ZERO into
allocating the cpu mask when CPUMASK_OFFSTACK is defined. This will
prevent other areas from having this same bug. Also, I doubt any
allocations of cpumasks is in performance critical sections.

Or at least see if the address passed in is already null, which tells
us that something already cleared it. Like in this case the
memset(rd, 0, sizeof(*rd)).

Have something like:

bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
{
if ((long)*mask == 0)
flags |= __GFP_ZERO;

Maybe I'll post a patch to do this.

>
> The patch cleans the garbage by passing alloc_cpumask_var()
> with an extra __GFP_ZERO for root_domain::rto_mask allocation,
> thereby addressing the issues.
>
> Do the same thing for root_domain's other cpumask memembers:
> dlo_mask, span, and online.

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

>
> Signed-off-by: Xunlei Pang <xlpang@redhat.com>
> ---


\
 
 \ /
  Last update: 2015-12-03 16:41    [W:0.034 / U:0.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site