From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Tim Chen <tim.c.chen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Juri Lelli <juri.lelli@redhat.com>,
Swapnil Sapkal <Swapnil.Sapkal@amd.com>,
Aaron Lu <aaron.lu@intel.com>,
Julien Desfossez <jdesfossez@digitalocean.com>,
x86@kernel.org
Subject: Re: [RFC PATCH 1/2] sched: Rate limit migrations to 1 per 2ms per task
Date: Wed, 6 Sep 2023 17:55:14 -0400 [thread overview]
Message-ID: <245448a2-6d2c-4c4c-51b3-c610e7e7a68d@efficios.com> (raw)
In-Reply-To: <ae216efc3a71c624fb70c071de4b5e3c096756b4.camel@linux.intel.com>
On 9/6/23 16:51, Tim Chen wrote:
> On Wed, 2023-09-06 at 11:47 +0200, Peter Zijlstra wrote:
>> On Tue, Sep 05, 2023 at 03:44:57PM -0700, Tim Chen wrote:
>>
>>> Reading up on sched_clock() documentation and seems like it should
>>> indeed be monotonic.
>>
>> It tries very hard to be monotonic but cannot guarantee. The moment TSC
>> is found unstable it's too late to fix up everything.
>>
>
> Yes, if TSC becomes unstable and could cause sched_clock to reset and go way backward.
> Perhaps we can add the following check in Mathieu's original
> patch to fix things up:
>
> +static bool should_migrate_task(struct task_struct *p, int prev_cpu)
>> +{
> /* sched_clock reset causing next migration time to be too far ahead */
> if (p->se.next_migration_time > sched_clock_cpu(prev_cpu) + SCHED_MIGRATION_RATELIMIT_WINDOW)
> p->se.next_migration_time = sched_clock_cpu(prev_cpu) + SCHED_MIGRATION_RATELIMIT_WINDOW;
>
>> + /* Rate limit task migration. */
>> + if (sched_clock_cpu(prev_cpu) < p->se.next_migration_time)
>> + return false;
>> + return true;
>> +}
>> +
>
Along those lines I think something like this should work:
static bool should_migrate_task(struct task_struct *p, int prev_cpu)
{
u64 now = sched_clock_cpu(prev_cpu);
/* sched_clock reset causing next migration time to be too far ahead. */
if (now + SCHED_MIGRATION_RATELIMIT_WINDOW < p->se.next_migration_time)
return true;
/* Rate limit task migration. */
if (now >= p->se.next_migration_time)
return true;
return false;
}
It will let migrate_task_rq_fair() update se->next_migration_time.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2023-09-06 21:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 17:11 [RFC PATCH 0/2] sched/eevdf: Rate limit task migration Mathieu Desnoyers
2023-09-05 17:11 ` [RFC PATCH 1/2] sched: Rate limit migrations to 1 per 2ms per task Mathieu Desnoyers
2023-09-05 20:28 ` Tim Chen
2023-09-05 21:16 ` Mathieu Desnoyers
2023-09-05 22:44 ` Tim Chen
2023-09-06 9:47 ` Peter Zijlstra
2023-09-06 20:51 ` Tim Chen
2023-09-06 21:55 ` Mathieu Desnoyers [this message]
2023-09-06 8:44 ` Peter Zijlstra
2023-09-06 13:58 ` Mathieu Desnoyers
2023-09-06 8:41 ` Peter Zijlstra
2023-09-06 13:57 ` Mathieu Desnoyers
2023-09-06 15:38 ` Mathieu Desnoyers
2023-09-10 7:03 ` Chen Yu
2023-09-13 15:46 ` Mathieu Desnoyers
2023-09-05 17:11 ` [RFC PATCH 2/2] sched: Implement adaptative rate limiting of task migrations Mathieu Desnoyers
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=245448a2-6d2c-4c4c-51b3-c610e7e7a68d@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=Swapnil.Sapkal@amd.com \
--cc=aaron.lu@intel.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=jdesfossez@digitalocean.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=x86@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
all inboxes | Powered by JetHome®