From: dmitry.antipov@linaro.org (Dmitry Antipov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] sched: generalize CONFIG_IRQ_TIME_ACCOUNTING for X86 and ARM
Date: Tue, 28 Feb 2012 10:19:32 +0400 [thread overview]
Message-ID: <4F4C71F4.7000604@linaro.org> (raw)
In-Reply-To: <1330337535.11248.45.camel@twins>
On 02/27/2012 02:12 PM, Peter Zijlstra wrote:
>> -extern void enable_sched_clock_irqtime(void);
>> -extern void disable_sched_clock_irqtime(void);
>> +extern int sched_clock_irqtime;
>> +static inline void enable_sched_clock_irqtime(void)
>> +{
>> + if (sched_clock_irqtime == -1)
>> + sched_clock_irqtime = 1;
>> +}
>> +static inline void disable_sched_clock_irqtime(void)
>> +{
>> + sched_clock_irqtime = 0;
>> +}
>> #else
>> static inline void enable_sched_clock_irqtime(void) {}
>> static inline void disable_sched_clock_irqtime(void) {}
>
> Please keep them out-of-line, its not a fast path and it avoids having
> to expose the state variable.
OK
>> +/*
>> + * -1 if not initialized, 0 if disabled with "noirqtime" kernel option
>> + * or after unstable clock was detected, 1 if enabled and active.
>> + */
>
> You forgot to explain what you need the tri-state for.
>
>> +__read_mostly int sched_clock_irqtime = -1;
The comment above should be a sufficient explanation, isn't it?
It's a tri-state just because it "merges" two variables: internal state (enabled/disabled)
and the value passed by "noirqtime" option (turn it on, default/turn it off). It can be
enabled only if it was not turned off explicitly, i.e. -1 => 1 transition is possible,
but 0 -> 1 is not. The same rule applies to a situation when an unstable clock is detected.
Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Antipov <dmitry.antipov@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Russell King <linux@arm.linux.org.uk>,
Rusty Russell <rusty@rustcorp.com.au>,
Ingo Molnar <mingo@redhat.com>,
Yong Zhang <yong.zhang0@gmail.com>,
Venki Pallipadi <venki@google.com>,
x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linaro-dev@lists.linaro.org, patches@linaro.org
Subject: Re: [PATCH] sched: generalize CONFIG_IRQ_TIME_ACCOUNTING for X86 and ARM
Date: Tue, 28 Feb 2012 10:19:32 +0400 [thread overview]
Message-ID: <4F4C71F4.7000604@linaro.org> (raw)
In-Reply-To: <1330337535.11248.45.camel@twins>
On 02/27/2012 02:12 PM, Peter Zijlstra wrote:
>> -extern void enable_sched_clock_irqtime(void);
>> -extern void disable_sched_clock_irqtime(void);
>> +extern int sched_clock_irqtime;
>> +static inline void enable_sched_clock_irqtime(void)
>> +{
>> + if (sched_clock_irqtime == -1)
>> + sched_clock_irqtime = 1;
>> +}
>> +static inline void disable_sched_clock_irqtime(void)
>> +{
>> + sched_clock_irqtime = 0;
>> +}
>> #else
>> static inline void enable_sched_clock_irqtime(void) {}
>> static inline void disable_sched_clock_irqtime(void) {}
>
> Please keep them out-of-line, its not a fast path and it avoids having
> to expose the state variable.
OK
>> +/*
>> + * -1 if not initialized, 0 if disabled with "noirqtime" kernel option
>> + * or after unstable clock was detected, 1 if enabled and active.
>> + */
>
> You forgot to explain what you need the tri-state for.
>
>> +__read_mostly int sched_clock_irqtime = -1;
The comment above should be a sufficient explanation, isn't it?
It's a tri-state just because it "merges" two variables: internal state (enabled/disabled)
and the value passed by "noirqtime" option (turn it on, default/turn it off). It can be
enabled only if it was not turned off explicitly, i.e. -1 => 1 transition is possible,
but 0 -> 1 is not. The same rule applies to a situation when an unstable clock is detected.
Dmitry
next prev parent reply other threads:[~2012-02-28 6:19 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-20 6:04 [PATCH] sched: generalize CONFIG_IRQ_TIME_ACCOUNTING for X86 and ARM Dmitry Antipov
2012-02-20 6:04 ` Dmitry Antipov
2012-02-27 10:12 ` Peter Zijlstra
2012-02-27 10:12 ` Peter Zijlstra
2012-02-28 6:19 ` Dmitry Antipov [this message]
2012-02-28 6:19 ` Dmitry Antipov
-- strict thread matches above, loose matches on Subject: below --
2012-02-28 6:29 Dmitry Antipov
2012-02-28 6:29 ` Dmitry Antipov
2012-02-11 0:02 Dmitry Antipov
2012-02-11 0:02 ` Dmitry Antipov
2012-02-17 11:22 ` Ingo Molnar
2012-02-17 11:22 ` Ingo Molnar
2012-02-09 17:25 Dmitry Antipov
2012-02-09 17:25 ` Dmitry Antipov
2012-02-10 22:28 ` Venki Pallipadi
2012-02-10 22:28 ` Venki Pallipadi
2012-02-08 23:58 Dmitry Antipov
2012-02-08 23:58 ` Dmitry Antipov
2012-02-08 16:08 Dmitry Antipov
2012-02-08 16:08 ` Dmitry Antipov
2012-02-08 22:50 ` Venki Pallipadi
2012-02-08 22:50 ` Venki Pallipadi
2012-02-08 12:48 Dmitry Antipov
2012-02-08 12:48 ` Dmitry Antipov
2012-02-08 13:18 ` Russell King - ARM Linux
2012-02-08 13:18 ` Russell King - ARM Linux
2012-02-08 15:15 ` Dmitry Antipov
2012-02-08 15:15 ` Dmitry Antipov
2012-02-08 15:24 ` Russell King - ARM Linux
2012-02-08 15:24 ` Russell King - ARM Linux
2012-02-09 2:51 ` Yong Zhang
2012-02-09 2:51 ` Yong Zhang
2012-02-09 2:48 ` Yong Zhang
2012-02-09 2:48 ` Yong Zhang
2012-02-07 18:06 Dmitry Antipov
2012-02-07 18:06 ` Dmitry Antipov
2012-02-07 22:56 ` Venki Pallipadi
2012-02-07 22:56 ` Venki Pallipadi
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=4F4C71F4.7000604@linaro.org \
--to=dmitry.antipov@linaro.org \
--cc=linux-arm-kernel@lists.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 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.