From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
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 15:29:45 +0200 [thread overview]
Message-ID: <53639DC9.2000701@linaro.org> (raw)
In-Reply-To: <5985714.f7hh9Ej59L@vostro.rjw.lan>
On 05/02/2014 02:09 PM, Rafael J. Wysocki wrote:
> 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.
Thanks, I will look at one or another solution.
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2014-05-02 13:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 12:01 [PATCH V2 1/2] sched: idle: Encapsulate the code to compile it out 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
2014-05-02 13:29 ` Daniel Lezcano [this message]
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=53639DC9.2000701@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amit.kucheria@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 \
--cc=rjw@rjwysocki.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.