mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Prakash Sangappa <prakash.sangappa@oracle.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	Daniel Jordan <daniel.m.jordan@oracle.com>
Subject: Re: [RFC PATCH 0/4] Scheduler time slice extension
Date: Fri, 15 Nov 2024 09:13:35 -0500	[thread overview]
Message-ID: <d86d463c-14ea-47cf-adc6-d3e9caa4ebf1@efficios.com> (raw)
In-Reply-To: <CF032474-7725-48C1-BA31-A8728C6C06E7@oracle.com>

On 2024-11-14 14:42, Prakash Sangappa wrote:
> 
> 
>> On Nov 14, 2024, at 2:28 AM, Peter Zijlstra <peterz@infradead.org> wrote:

[...]

>>
>> See:
>>
>>   https://lkml.kernel.org/r/20220113233940.3608440-4-posk@google.com
>>
>> for a more elaborate scheme.
>>
>>>> Peter, was there anything fundamentally wrong with your approach based
>>>> on rseq ? https://lore.kernel.org/lkml/20231030132949.GA38123@noisy.programming.kicks-ass.net
>>>>
>>>> The main thing I wonder is whether loading the rseq delay resched flag
>>>> on return to userspace is too late in your patch. Also, I'm not sure it is
>>>> realistic to require that no system calls should be done within time extension
>>>> slice. If we have this scenario:
>>>
>>> I am also not sure if we need to prevent system calls in this scenario.
>>> Was that restriction mainly because of restartable sequence API implements it?
>>
>> No, the whole premise of delaying resched was because people think that
>> syscalls are too slow. If you do not think this, then you shouldn't be
>> using this.
> 
> Agree.

I only partially agree with Peter here. I agree that we don't want to
add system calls on the delay-resched critical section fast path,
because this would have a significant performance hit.

But there are scenarios where issuing system calls from within that
critical section would be needed, even though those would not belong
to the fast path:

1) If a signal handler nests over a delay-resched critical section.
    That signal handler is allowed to issue system calls.

2) If the critical section fast-path is calling GNU C library API and/or
    a vDSO, which is typically fast, but can end up calling a system call
    as fallback. e.g. clock_gettime, sched_getcpu. Preventing use of a
    system call by killing the application punches a hole in the
    abstractions meant to be provided by GNU libc and vDSO.

I would recommend that we allow issuing system calls while the
delay-resched bit is set. However, we may not strictly need to honor
the delay-resched hint from a system call context, as those would
be expected to be either infrequent or a portability fallback,
which means the enhanced performance provided by delay-resched
really won't matter.

Another scenario to keep in mind are page faults happening within a
delay-resched critical section. This is a scenario where page fault
handling can explicitly reschedule. If this happens, I suspect we
really don't care about the delay-resched hint, but we should consider
whether this hint should be left as-is or cleared.

Thoughts ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


  reply	other threads:[~2024-11-15 14:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13  0:01 Prakash Sangappa
2024-11-13  0:01 ` [RFC PATCH 1/4] Introduce per thread user-kernel shared structure Prakash Sangappa
2024-11-13  0:01 ` [RFC PATCH 2/4] Scheduler time extention Prakash Sangappa
2024-11-13  3:57   ` K Prateek Nayak
2024-11-13 17:40     ` Prakash Sangappa
2024-11-13  0:01 ` [RFC PATCH 3/4] Indicate if schedular preemption delay request is granted Prakash Sangappa
2024-11-13  0:01 ` [RFC PATCH 4/4] Add scheduler preemption delay granted stats Prakash Sangappa
2024-11-13  5:43 ` [RFC PATCH 0/4] Scheduler time slice extension K Prateek Nayak
2024-11-13 19:56   ` Prakash Sangappa
2024-11-13 18:50 ` Peter Zijlstra
2024-11-13 19:36   ` Mathieu Desnoyers
2024-11-13 20:10     ` Prakash Sangappa
2024-11-13 20:57       ` Mathieu Desnoyers
2024-11-13 23:24         ` Prakash Sangappa
2024-11-14 10:28       ` Peter Zijlstra
2024-11-14 19:42         ` Prakash Sangappa
2024-11-15 14:13           ` Mathieu Desnoyers [this message]
2024-11-15 17:20             ` Prakash Sangappa
2024-12-09 20:36           ` Prakash Sangappa
2024-12-09 21:17             ` Mathieu Desnoyers
2024-12-16 18:59               ` Prakash Sangappa
2025-02-04  3:04                 ` Prakash Sangappa
2024-11-14 10:14     ` Peter Zijlstra
2024-11-15 14:41       ` Mathieu Desnoyers
2024-11-15 17:49         ` Prakash Sangappa
2024-11-13 19:50   ` Prakash Sangappa

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=d86d463c-14ea-47cf-adc6-d3e9caa4ebf1@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=prakash.sangappa@oracle.com \
    --cc=rostedt@goodmis.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®