mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: shrikanth hegde <sshegde@linux.vnet.ibm.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: tglx@linutronix.de, peterz@infradead.org, arjan@linux.intel.com,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	svaidy@linux.ibm.com, linux-kernel@vger.kernel.org,
	bigeasy@linutronix.de
Subject: Re: [RFC PATCH] hrtimer: interleave timers for improved single thread performance at low utilization
Date: Tue, 31 Jan 2023 17:39:11 +0530	[thread overview]
Message-ID: <711dc967-b4cf-807b-6c74-5c9d914ab619@linux.vnet.ibm.com> (raw)
In-Reply-To: <Y9jvWCGGICsKGPFt@gmail.com>



On 1/31/23 4:07 PM, Ingo Molnar wrote:
> 
> * shrikanth hegde <sshegde@linux.vnet.ibm.com> wrote:
> 
>> ---
>>  kernel/time/hrtimer.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
>> index 3ae661ab6260..d160f49f0cce 100644
>> --- a/kernel/time/hrtimer.c
>> +++ b/kernel/time/hrtimer.c
>> @@ -1055,6 +1055,17 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
>>
>>  		orun = ktime_divns(delta, incr);
>>  		hrtimer_add_expires_ns(timer, incr * orun);
>> +		/*
>> +		 * Avoid timer round-off, so that all cfs bandwidth timers
>> +		 * don't start at the same time
>> +		 */
>> +		if (incr >= 100000000ULL) {
>> +			s64 interleave = 0;
>> +			interleave = ktime_sub_ns(delta,  incr * orun);
>> +			interleave = interleave - (ktime_to_ns(delta) % (incr/10));
>> +			if (interleave > 0)
>> +				hrtimer_add_expires_ns(timer, interleave);
>> +		}
> 
> Any reason why you did this in the hrtimer code, instead of the 
> (sched_cfs_period_timer?) hrtimer handler itself?
> 
> Thanks,
> 
> 	Ingo


Yes. Thanks for making me think in that way.                                       
This can be done in start_cfs_bandwidth by setting an initial expiry value.     
Tried that change. it works in interleaving the timers.                         
                                                                                
Will do bit more testing and send out the patch.

  reply	other threads:[~2023-01-31 12:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31  5:48 shrikanth hegde
2023-01-31 10:37 ` Ingo Molnar
2023-01-31 12:09   ` shrikanth hegde [this message]
2023-01-31 11:08 ` Thomas Gleixner
2023-01-31 12:27   ` shrikanth hegde
2023-01-31 14:55 ` Arjan van de Ven
2023-01-31 15:50   ` 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=711dc967-b4cf-807b-6c74-5c9d914ab619@linux.vnet.ibm.com \
    --to=sshegde@linux.vnet.ibm.com \
    --cc=arjan@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=svaidy@linux.ibm.com \
    --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®