From: shrikanth hegde <sshegde@linux.vnet.ibm.com>
To: Hillf Danton <hdanton@sina.com>
Cc: mingo@redhat.com, peterz@infradead.org,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
bsegall@google.com, tglx@linutronix.de,
srikar@linux.vnet.ibm.com, arjan@linux.intel.com,
svaidy@linux.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3] sched/fair: Interleave cfs bandwidth timers for improved single thread performance at low utilization
Date: Fri, 24 Feb 2023 11:55:23 +0530 [thread overview]
Message-ID: <df3c173b-977c-0d45-bfb0-5ffc02f5dac4@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230224014922.2883-1-hdanton@sina.com>
On 2/24/23 7:19 AM, Hillf Danton wrote:
> On Fri, 24 Feb 2023 00:29:18 +0530 Shrikanth Hegde <sshegde@linux.vnet.ibm.com>
>> @@ -5923,6 +5923,10 @@ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
>> INIT_LIST_HEAD(&cfs_b->throttled_cfs_rq);
>> hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
>> cfs_b->period_timer.function = sched_cfs_period_timer;
>> +
>> + /* Add a random offset so that timers interleave */
>> + hrtimer_set_expires(&cfs_b->period_timer,
>> + get_random_u32_below(cfs_b->period));
>> hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>> cfs_b->slack_timer.function = sched_cfs_slack_timer;
>> cfs_b->slack_started = false;
>> --
>> 2.31.1
>
> Could you specify what sense this makes, given hrtimer_forward_now() in
> start_cfs_bandwidth() and sched_cfs_period_timer(), which makes the
> timer expire after now? Why does the randomness at init time play a role
> at start time and run time?
Currently, Initial value is not set for period_timer. Expiry is calculated as
expiry = $INITIAL_EXPIRYVALUE + $N * $PERIOD
Hence, when there are two or more CPU cgroup's using bandwidth controller,
two period_timers would align at expiry.
Adding a random offset play a role only at the start time, and no impact on the
run time. By adding offset, the different period_timer interleave, and we would get
the benefit of SMT folding, less context switch's and less hypervisor preemptions.
More details are in RFC PATCH:
https://lore.kernel.org/lkml/9c57c92c-3e0c-b8c5-4be9-8f4df344a347@linux.vnet.ibm.com/
next parent reply other threads:[~2023-02-24 6:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230224014922.2883-1-hdanton@sina.com>
2023-02-24 6:25 ` shrikanth hegde [this message]
2023-02-23 18:59 Shrikanth Hegde
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=df3c173b-977c-0d45-bfb0-5ffc02f5dac4@linux.vnet.ibm.com \
--to=sshegde@linux.vnet.ibm.com \
--cc=arjan@linux.intel.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=svaidy@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.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®