From: Peng Liu <pngliu@hotmail.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: tglx@linutronix.de, mingo@kernel.org,
linux-kernel@vger.kernel.org, liupeng17@lenovo.com
Subject: Re: [PATCH v2 1/2] tick/nohz: Remove duplicate between tick_nohz_switch_to_nohz() and tick_setup_sched_timer()
Date: Wed, 29 Nov 2023 17:27:24 +0800 [thread overview]
Message-ID: <TYCP286MB21464057C493F196982232AAC683A@TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <ZWYbqwZrP+WfvT/N@lothringen>
On 2023/11/29 0:56, Frederic Weisbecker wrote:
> On Tue, Nov 28, 2023 at 05:23:54PM +0800, Peng Liu wrote:
>> @@ -1529,7 +1519,9 @@ static enum hrtimer_restart tick_nohz_highres_handler(struct hrtimer *timer)
>>
>> return HRTIMER_RESTART;
>> }
>> +#endif /* HIGH_RES_TIMERS */
>>
>> +#if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
> tick-sched.c is only ever built if CONFIG_TICK_ONESHOT=y and
> CONFIG_TICK_ONESHOT is basically (CONFIG_NO_HZ_COMMON || CONFIG_HIGH_RES_TIMERS)
>
> So probably the above is not needed and if you like you can even send
> a subsequent patch removing such ifdefs within this file :-)
>
>> static int sched_skew_tick;
>>
>> static int __init skew_tick(char *str)
>> @@ -1542,15 +1534,19 @@ early_param("skew_tick", skew_tick);
>>
>> /**
>> * tick_setup_sched_timer - setup the tick emulation timer
>> + * @mode: tick_nohz_mode to setup for
>> */
>> -void tick_setup_sched_timer(void)
>> +void tick_setup_sched_timer(int mode)
>> {
>> struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
>> ktime_t now = ktime_get();
>>
>> /* Emulate tick processing via per-CPU hrtimers: */
>> hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
>> - ts->sched_timer.function = tick_nohz_highres_handler;
>> +#ifdef CONFIG_HIGH_RES_TIMERS
>> + if (mode == NOHZ_MODE_HIGHRES)
>> + ts->sched_timer.function = tick_nohz_highres_handler;
>> +#endif
> That ifdef could simply be removed.
>
>>
>> /* Get the next period (per-CPU) */
>> hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update());
>> @@ -1564,12 +1560,15 @@ void tick_setup_sched_timer(void)
>> }
> That invisible part above is the skew_tick thing, which can probably work
> on low-res mode so why not but please tell about that in the changelog.
>
>>
>> hrtimer_forward(&ts->sched_timer, now, TICK_NSEC);
> Looks like this can be hrtimer_forward_now() and you can remove the now.
>
>> - hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED_HARD);
>> - tick_nohz_activate(ts, NOHZ_MODE_HIGHRES);
>> +#ifdef CONFIG_HIGH_RES_TIMERS
>> + if (mode == NOHZ_MODE_HIGHRES)
>> + hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED_HARD);
>> + else
>> +#endif
> And probably that ifdef could simply be turned to
> IS_ENABLED(CONFIG_HIGH_RES_TIMERS).
>
> Thanks!
Thanks for comments. I will update my patches, and also try removing
(CONFIG_NO_HZ_COMMON || CONFIG_HIGH_RES_TIMERS) in another patch.
Regards,
Peng
prev parent reply other threads:[~2023-11-29 9:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20231127083049.145447-1-pngliu@hotmail.com>
2023-11-28 9:23 ` Peng Liu
2023-11-28 16:56 ` Frederic Weisbecker
2023-11-29 9:27 ` Peng Liu [this message]
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=TYCP286MB21464057C493F196982232AAC683A@TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM \
--to=pngliu@hotmail.com \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liupeng17@lenovo.com \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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®