From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: peterz@infradead.org, mingo@elte.hu, amit.kucheria@linaro.org,
linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Nicolas Pitre <nicolas.pitre@linaro.org>
Subject: Re: [PATCH V2 1/2] sched: idle: Encapsulate the code to compile it out
Date: Fri, 02 May 2014 14:09:11 +0200 [thread overview]
Message-ID: <5985714.f7hh9Ej59L@vostro.rjw.lan> (raw)
In-Reply-To: <53635E5F.8070100@linaro.org>
On Friday, May 02, 2014 10:59:11 AM Daniel Lezcano wrote:
> On 05/01/2014 12:56 AM, Rafael J. Wysocki wrote:
> > On Thursday, May 01, 2014 12:47:25 AM Rafael J. Wysocki wrote:
> >> On Wednesday, April 30, 2014 02:01:02 PM Daniel Lezcano wrote:
> >>> Encapsulate the large portion of cpuidle_idle_call inside another
> >>> function so when CONFIG_CPU_IDLE=n, the code will be compiled out.
> >>> Also that is benefitial for the clarity of the code as it removes
> >>> a nested indentation level.
> >>>
> >>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >>
> >> Well, this conflicts with
> >>
> >> https://patchwork.kernel.org/patch/4071541/
> >>
> >> which you haven't commented on and I still want cpuidle_select() to be able to
> >> return negative values because of
> >>
> >> https://patchwork.kernel.org/patch/4089631/
> >>
> >> (and I have one more patch on top of these two that requires this).
> >
> > Moreover (along the lines of Nico said) after https://patchwork.kernel.org/patch/4071541/
> > we actually don't need the #ifdef CONFIG_CPU_IDLE in your patch, because cpuidle_select()
> > for CONFIG_CPU_IDLE unset is a static inline returning a negative number and the compiler
> > should optimize out the blocks that depend on it being non-negative.
>
> Thanks for the head up.
>
> Actually that was to solve a compilation issue with the next patch when
> adding the cpuidle state in the struct rq.
>
> When the option CPU_IDLE is not set, the code assinging the cpu idle
> state in the rq is still there while in the struct rq the field is
> compiled out with the ifdef macro. If I rely on the compiler
> optimization, the compilation error will happen.
I see.
If you don't put the new idle_state field in struct_rq under the #ifdef,
you won't need to worry about the build problem.
Alternatively, you can define
#ifdef CONFIG_CPU_IDLE
static inline void rq_set_idle_state(struct rq *rq, struct cpuidle_state *state)
{
rq->idle_state = state;
}
#else
static inline void rq_set_idle_state(struct rq *rq, struct cpuidle_state *state) {}
#endif
and use rq_set_idle_state() to set that field.
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2014-05-02 11:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 12:01 Daniel Lezcano
2014-04-30 12:01 ` [PATCH V2 2/2] sched: idle: Store the idle state the cpu is Daniel Lezcano
2014-04-30 22:47 ` [PATCH V2 1/2] sched: idle: Encapsulate the code to compile it out Rafael J. Wysocki
2014-04-30 22:56 ` Rafael J. Wysocki
2014-05-02 8:59 ` Daniel Lezcano
2014-05-02 12:09 ` Rafael J. Wysocki [this message]
2014-05-02 13:29 ` Daniel Lezcano
2014-05-02 18:20 ` Nicolas Pitre
2014-05-02 8:52 ` Daniel Lezcano
2014-05-02 12:09 ` Rafael J. Wysocki
2014-05-02 13:35 ` Daniel Lezcano
2014-05-02 15:32 ` Rafael J. Wysocki
2014-06-06 8:09 ` Peter Zijlstra
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=5985714.f7hh9Ej59L@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=amit.kucheria@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nicolas.pitre@linaro.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
all inboxes | Powered by JetHome®