public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] sched / idle: Call default_idle_call() from cpuidle_enter_state()
Date: Mon, 04 May 2015 23:11:06 +0200	[thread overview]
Message-ID: <2497702.nlVf4K8ZSy@vostro.rjw.lan> (raw)
In-Reply-To: <55478A68.8060902@linaro.org>

On Monday, May 04, 2015 05:04:08 PM Daniel Lezcano wrote:
> On 05/04/2015 03:58 PM, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > The check of the cpuidle_enter() return value against -EBUSY
> > made in call_cpuidle() will not be necessary any more if
> > cpuidle_enter_state() calls default_idle_call() directly when it
> > is about to return -EBUSY, so make that happen and eliminate the
> > check.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>  >
> > ---
> >   drivers/cpuidle/cpuidle.c |    4 +++-
> >   drivers/cpuidle/cpuidle.h |    2 ++
> >   kernel/sched/idle.c       |   14 ++++++--------
> >   3 files changed, 11 insertions(+), 9 deletions(-)
> >
> > Index: linux-pm/drivers/cpuidle/cpuidle.c
> > ===================================================================
> > --- linux-pm.orig/drivers/cpuidle/cpuidle.c
> > +++ linux-pm/drivers/cpuidle/cpuidle.c
> > @@ -167,8 +167,10 @@ int cpuidle_enter_state(struct cpuidle_d
> >   	 * local timer will be shut down.  If a local timer is used from another
> >   	 * CPU as a broadcast timer, this call may fail if it is not available.
> >   	 */
> > -	if (broadcast && tick_broadcast_enter())
> > +	if (broadcast && tick_broadcast_enter()) {
> > +		default_idle_call();
> >   		return -EBUSY;
> > +	}
> >
> >   	trace_cpu_idle_rcuidle(index, dev->cpu);
> >   	time_start = ktime_get();
> > Index: linux-pm/drivers/cpuidle/cpuidle.h
> > ===================================================================
> > --- linux-pm.orig/drivers/cpuidle/cpuidle.h
> > +++ linux-pm/drivers/cpuidle/cpuidle.h
> > @@ -18,6 +18,8 @@ extern int cpuidle_enter_state(struct cp
> >   /* idle loop */
> >   extern void cpuidle_install_idle_handler(void);
> >   extern void cpuidle_uninstall_idle_handler(void);
> > +/* kernel/sched/idle.c */
> > +extern void default_idle_call(void);
> 
> There is a cyclic dependency introduced with this function.
> 
> idle.c <=> cpuidle.c
> 
> Are we sure we want them to be mutually dependent ?

Well, hadn't I think so, I wouldn't have posted the patch in the first place. :-)

Aesthetics is one thing and wasted cycles is another.  A redundant check
in the idle loop means a whole lot of wasted cycles throughout the life time
of a kernel.

Rafael


  reply	other threads:[~2015-05-04 20:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 13:54 [PATCH 0/4] sched / idle: Reduce the number of branches in the idle loop Rafael J. Wysocki
2015-05-04 13:56 ` [PATCH 1/4] sched / idle: Move the default idle call code to a separate function Rafael J. Wysocki
2015-05-04 14:00   ` Daniel Lezcano
2015-05-04 14:22   ` Peter Zijlstra
2015-05-04 21:08     ` Rafael J. Wysocki
2015-05-04 13:57 ` [PATCH 2/4] cpuidle: Check the sign of index in cpuidle_reflect() Rafael J. Wysocki
2015-05-04 14:02   ` Daniel Lezcano
2015-05-04 13:57 ` [PATCH 3/4] sched / idle: Eliminate the "reflect" check from cpuidle_idle_call() Rafael J. Wysocki
2015-05-04 14:49   ` Daniel Lezcano
2015-05-04 13:58 ` [PATCH 4/4] sched / idle: Call default_idle_call() from cpuidle_enter_state() Rafael J. Wysocki
2015-05-04 15:04   ` Daniel Lezcano
2015-05-04 21:11     ` Rafael J. Wysocki [this message]
2015-05-04 14:25 ` [PATCH 0/4] sched / idle: Reduce the number of branches in the idle loop Peter Zijlstra
2015-05-04 21:23   ` Rafael J. Wysocki

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=2497702.nlVf4K8ZSy@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.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