linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	viresh kumar <viresh.kumar@linaro.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-tip-commits@vger.kernel.org, douly.fnst@cn.fujitsu.com,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Subject: Re: [tip:sched/core] sched/fair: Remove #ifdefs from scale_rt_capacity()
Date: Sat, 15 Sep 2018 14:29:56 +0200	[thread overview]
Message-ID: <20180915122956.GA12378@gmail.com> (raw)
In-Reply-To: <CAKfTPtD-vAw9=aDS83eEB56JOPV74R-oG1LAKKPXkDfxPDt1vw@mail.gmail.com>


* Vincent Guittot <vincent.guittot@linaro.org> wrote:

> Hi Ingo,
> 
> On Sat, 15 Sep 2018 at 13:47, Ingo Molnar <mingo@kernel.org> wrote:
> >
> >
> > * tip-bot for Vincent Guittot <tipbot@zytor.com> wrote:
> >
> > > Commit-ID:  2e62c4743adc4c7bfcbc1f45118fc7bec58cf30a
> > > Gitweb:     https://git.kernel.org/tip/2e62c4743adc4c7bfcbc1f45118fc7bec58cf30a
> > > Author:     Vincent Guittot <vincent.guittot@linaro.org>
> > > AuthorDate: Thu, 19 Jul 2018 14:00:06 +0200
> > > Committer:  Ingo Molnar <mingo@kernel.org>
> > > CommitDate: Wed, 25 Jul 2018 11:41:05 +0200
> > >
> > > sched/fair: Remove #ifdefs from scale_rt_capacity()
> > >
> > > Reuse cpu_util_irq() that has been defined for schedutil and set irq util
> > > to 0 when !CONFIG_IRQ_TIME_ACCOUNTING.
> > >
> > > But the compiler is not able to optimize the sequence (at least with
> > > aarch64 GCC 7.2.1):
> > >
> > >       free *= (max - irq);
> > >       free /= max;
> > >
> > > when irq is fixed to 0
> > >
> > > Add a new inline function scale_irq_capacity() that will scale utilization
> > > when irq is accounted. Reuse this funciton in schedutil which applies
> > > similar formula.
> > >
> > > Suggested-by: Ingo Molnar <mingo@redhat.com>
> > > Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> > > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > > Cc: Peter Zijlstra <peterz@infradead.org>
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: rjw@rjwysocki.net
> > > Link: http://lkml.kernel.org/r/1532001606-6689-1-git-send-email-vincent.guittot@linaro.org
> > > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > > ---
> > >  kernel/sched/core.c              |  2 +-
> > >  kernel/sched/cpufreq_schedutil.c |  3 +--
> > >  kernel/sched/fair.c              | 13 +++----------
> > >  kernel/sched/sched.h             | 20 ++++++++++++++++++--
> > >  4 files changed, 23 insertions(+), 15 deletions(-)
> >
> > This commit introduced a build warning in the SMP=n case, could we please fix that? (Probably
> > the best to maintain variant would be to mark it as __maybe_unused.)
> 
> Dou sent a fix for this warning
> https://lkml.org/lkml/2018/8/10/22
> This one remove one HAVE_SCHED_AVG_IRQ which is at the opposite of
> what yyou propose below

Yeah, that's a bad patch because it moves one step back, beyond also having an obvious typo in 
the title and overall atrocious spelling that shows that not much thought must have gone into 
the patch - yet you acked it, which makes me unhappy as a maintainer: please don't ack 
obviously triple-flawed patches!

> and Miguel also made a proposal:
> https://lkml.org/lkml/2018/9/8/215
> based on __maybe_unused

That solution is probably better, but:

> >
> > Also, while at it, there's a number of other places that use this pattern:
> >
> > > -#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
> > > +#ifdef HAVE_SCHED_AVG_IRQ
> >
> > Could we convert those to HAVE_SCHED_AVG_IRQ as well?
> 
> I'm not sure that we can convert all to HAVE_SCHED_AVG_IRQ
> 
> >
> > dagon:~/tip> git grep 'defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)' kernel/sched/
> > kernel/sched/core.c:#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
> 
> we can't replace one because the variables can be used when
> HAVE_SCHED_AVG_IRQ is undefined

Well, firstly, why is HAVE_SCHED_AVG_IRQ defined in a header and not in the Kconfig space as I 
originally suggested?

Secondly, HAVE_SCHED_AVG_IRQ is defined poorly AFAICS, it should be 0/1 so it can be used as a 
replacement pattern in #if sequences - not in #ifdef sequences as your patch did.

I.e. this needs to be sorted out and done properly, the concerns you voice are simply a side 
effect of this having been done badly.

Thanks,

	Ingo

  reply	other threads:[~2018-09-15 12:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 12:00 [PATCH] sched/fair: remove #ifdefs from scale_rt_capacity Vincent Guittot
2018-07-20  4:55 ` Viresh Kumar
2018-07-20 12:31 ` Peter Zijlstra
2018-07-30 16:04   ` Vincent Guittot
2018-07-25 14:22 ` [tip:sched/core] sched/fair: Remove #ifdefs from scale_rt_capacity() tip-bot for Vincent Guittot
2018-09-15 11:46   ` Ingo Molnar
2018-09-15 12:17     ` Vincent Guittot
2018-09-15 12:29       ` Ingo Molnar [this message]
2018-09-15 14:35         ` Vincent Guittot
2018-09-18  6:38           ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180915122956.GA12378@gmail.com \
    --to=mingo@kernel.org \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).