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


Groups > linux.kernel > #1659301

Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in cpudl_maximum_cpu()

From Byungchul Park <byungchul.park@lge.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in cpudl_maximum_cpu()
Date 2017-06-07 01:50 +0200
Message-ID <tPwox-7a2-3@gated-at.bofh.it> (permalink)
References <tNPlE-6o8-31@gated-at.bofh.it> <tNPlE-6o8-29@gated-at.bofh.it> <tPor0-24q-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 06, 2017 at 04:12:25PM +0100, Juri Lelli wrote:
> Hi,
> 
> On 02/06/17 16:31, Byungchul Park wrote:
> > When the heap tree is empty, cp->elements[0].cpu has meaningless value.

Hi,

The meaningless value is 0.

> > We need to consider the case.
> > 
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> >  kernel/sched/cpudeadline.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> > index d4a6963..9b314a9 100644
> > --- a/kernel/sched/cpudeadline.c
> > +++ b/kernel/sched/cpudeadline.c
> > @@ -110,7 +110,8 @@ static void cpudl_heapify(struct cpudl *cp, int idx)
> >  
> >  static inline int cpudl_maximum_cpu(struct cpudl *cp)
> >  {
> > -	return cp->elements[0].cpu;
> > +	int cpu = cp->elements[0].cpu;
> > +	return cp->elements[cpu].idx == IDX_INVALID ? -1 : cpu;
> 
> Mmm, don't we get a WARN from cpumask_check() if we return -1 here?

The function does not return -1 without my patch.

Right?

> 
> Thanks,
> 
> - Juri

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


Thread

[PATCH 2/2] sched/deadline: Don't return invalid cpu in cpudl_maximum_cpu() Byungchul Park <byungchul.park@lge.com> - 2017-06-02 09:40 +0200
  Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in  cpudl_maximum_cpu() Juri Lelli <juri.lelli@arm.com> - 2017-06-06 17:20 +0200
    Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in  cpudl_maximum_cpu() Byungchul Park <byungchul.park@lge.com> - 2017-06-07 01:50 +0200
      Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in  cpudl_maximum_cpu() Byungchul Park <byungchul.park@lge.com> - 2017-06-07 02:20 +0200

csiph-web