Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282782

Re: [PATCH] sched/core: Clear the root_domain cpumasks in init_rootdomain()

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] sched/core: Clear the root_domain cpumasks in init_rootdomain()
Date 2015-12-03 09:30 +0100
Message-ID <qBxr4-2rt-21@gated-at.bofh.it> (permalink)
References <qBeeK-6GK-13@gated-at.bofh.it> <qBeRs-79R-19@gated-at.bofh.it> <qBfu9-7Ey-1@gated-at.bofh.it> <qBis3-19N-29@gated-at.bofh.it> <qBs81-7iq-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Xunlei Pang <xlpang@redhat.com> wrote:

> Hi Peter,
> 
> On 12/03/2015 at 12:25 AM, Peter Zijlstra wrote:
> > On Wed, Dec 02, 2015 at 09:12:30PM +0800, Xunlei Pang wrote:
> >> Hi Peter,
> >>
> >> On 12/02/2015 at 08:34 PM, Peter Zijlstra wrote:
> >>> On Wed, Dec 02, 2015 at 07:52:59PM +0800, Xunlei Pang wrote:
> >>>> The patch cleans the garbage by using zalloc_cpumask_var()
> >>>> instead of alloc_cpumask_var() for root_domain::rto_mask
> >>>> allocation, thereby addressing the issues.
> >>> How did you notice this? Also do we want to do the same for the kmalloc
> >> When doing review.
> > Nice, will you be looking for similar issues elsewhere in the scheduler
> > too?
> 
> Sure :-)

Hm, is the alloc_cpumask_var() done in alloc_sched_domains() safe?

At least the usage pattern in init_sched_domains() looks unsafe:

        doms_cur = alloc_sched_domains(ndoms_cur);
        if (!doms_cur)
                doms_cur = &fallback_doms;
        cpumask_andnot(doms_cur[0], cpu_map, cpu_isolated_map);

I think alloc_cpumask_var() is a fundamentally unsafe or at least fragile 
operation, because the uninitialized variable bug will only happen on large CPU 
count kernels AFAICS - so it's inviting such bugs.

How about we rename alloc_cpumask_var() to alloc_cpumask_var_noinit() or at least 
__alloc_cpumask_var(), to make this property easier to see?

Thanks,

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] sched/core: Clear the root_domain cpumasks in init_rootdomain() Xunlei Pang <xlpang@redhat.com> - 2015-12-02 13:00 +0100
  Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Peter Zijlstra <peterz@infradead.org> - 2015-12-02 13:40 +0100
    Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Xunlei Pang <xlpang@redhat.com> - 2015-12-02 14:20 +0100
      Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Peter Zijlstra <peterz@infradead.org> - 2015-12-02 17:30 +0100
        Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Xunlei Pang <xlpang@redhat.com> - 2015-12-03 03:50 +0100
          Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Ingo Molnar <mingo@kernel.org> - 2015-12-03 09:30 +0100
            Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Xunlei Pang <xlpang@redhat.com> - 2015-12-03 13:00 +0100
              Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Ingo Molnar <mingo@kernel.org> - 2015-12-04 09:10 +0100
                Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Peter Zijlstra <peterz@infradead.org> - 2015-12-04 09:30 +0100
                Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Ingo Molnar <mingo@kernel.org> - 2015-12-04 09:40 +0100
                Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Xunlei Pang <xlpang@redhat.com> - 2015-12-04 09:30 +0100
                Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Ingo Molnar <mingo@kernel.org> - 2015-12-04 09:40 +0100
          Re: [PATCH] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Peter Zijlstra <peterz@infradead.org> - 2015-12-03 10:40 +0100
  [tip:locking/core] sched/core:   Clear the root_domain cpumasks in init_rootdomain() tip-bot for Xunlei Pang <tipbot@zytor.com> - 2015-12-04 13:00 +0100

csiph-web