public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: psodagud@codeaurora.org
To: Thomas Gleixner <tglx@linutronix.de>
Cc: john.stultz@linaro.org, sboyd@kernel.org, tj@kernel.org,
	linux-kernel@vger.kernel.org, saravanak@google.com,
	pkondeti@codeaurora.org, Joonwoo Park <joonwoop@codeaurora.org>
Subject: Re: [PATCH v3 1/2] timer: make deferrable cpu unbound timers really not bound to a cpu
Date: Wed, 13 May 2020 13:55:31 -0700	[thread overview]
Message-ID: <ba1e3e84f0a77d550898222e94844ca7@codeaurora.org> (raw)
In-Reply-To: <87d0771swr.fsf@nanos.tec.linutronix.de>

On 2020-05-13 13:28, Thomas Gleixner wrote:
> psodagud@codeaurora.org writes:
>> On 2020-05-06 06:28, Thomas Gleixner wrote:
>>>>  #ifdef CONFIG_SMP
>>>> +struct timer_base timer_base_deferrable;
>>>>  unsigned int sysctl_timer_migration = 1;
>>>> 
>>>>  DEFINE_STATIC_KEY_FALSE(timers_migration_enabled);
>>>> @@ -841,8 +842,14 @@ static inline struct timer_base
>>>> *get_timer_cpu_base(u32 tflags, u32 cpu)
>>>>  	 * If the timer is deferrable and NO_HZ_COMMON is set then we need
>>>>  	 * to use the deferrable base.
>>>>  	 */
>>>> -	if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & 
>>>> TIMER_DEFERRABLE))
>>>> -		base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu);
>>>> +	if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & 
>>>> TIMER_DEFERRABLE))
>>>> {
>>>> +#ifdef CONFIG_SMP
>>>> +		base = &timer_base_deferrable;
>>>> +#endif
>>> 
>>> There are definitely smarter ways of solving this than sprinkling
>>> #ifdef's around the code.
>> 
>> I am able to understand all other comments and I will address all 
>> those
>> comments in the next patch set.
>> It is not clear to me how to avoid #ifdef's in this case. Could you
>> please share an example here?
> 
> The answer is further down already:

Thanks Tglx for quick response.

I think, you are referring stub functions. Yes. I can reduce some of the 
#ifdefs with stub functions as you mentioned and not all the cases 
right?
I have introduced two variables timer_base_deferrable and 
deferrable_pending and I can put stub function where ever is possible. 
But it may not be appropriate to have stub function for all the 
references of these variables right? Correct me if my understanding is 
wrong.

-Thanks, Prasad

> 
>>> Stub functions exist to avoid this unreadable #ifdef garbage.

  reply	other threads:[~2020-05-13 20:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02 18:28 [PATCH v3 0/2] timer: make deferrable cpu unbound timers really not bound to a cpu Prasad Sodagudi
2020-05-02 18:28 ` [PATCH v3 1/2] " Prasad Sodagudi
2020-05-04 18:11   ` kbuild test robot
2020-05-05  0:08   ` kbuild test robot
2020-05-06 13:28   ` Thomas Gleixner
2020-05-13 19:53     ` psodagud
2020-05-13 20:28       ` Thomas Gleixner
2020-05-13 20:55         ` psodagud [this message]
2020-05-13 21:34           ` Thomas Gleixner
2020-05-02 18:28 ` [PATCH v3 2/2] sched: Add a check for cpu unbound deferrable timers Prasad Sodagudi
2020-05-04 19:11   ` kbuild test robot
2020-05-06 14:03   ` Thomas Gleixner

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=ba1e3e84f0a77d550898222e94844ca7@codeaurora.org \
    --to=psodagud@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=joonwoop@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pkondeti@codeaurora.org \
    --cc=saravanak@google.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.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