linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Ankur Arora <ankur.a.arora@oracle.com>
Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
	npiggin@gmail.com, christophe.leroy@csgroup.eu,
	maddy@linux.ibm.com, linux-kernel@vger.kernel.org,
	vschneid@redhat.com, mark.rutland@arm.com
Subject: Re: [PATCH v2 2/2] powerpc: Large user copy aware of full:rt:lazy preemption
Date: Wed, 20 Nov 2024 21:03:11 +0530	[thread overview]
Message-ID: <b98b7795-070a-4d9c-9599-445c2ff55fd7@linux.ibm.com> (raw)
In-Reply-To: <20241120080312.uHw4eJcQ@linutronix.de>



On 11/20/24 13:33, Sebastian Andrzej Siewior wrote:
> On 2024-11-19 13:08:31 [-0800], Ankur Arora wrote:
>>
>> Shrikanth Hegde <sshegde@linux.ibm.com> writes:
>>

Thanks Ankur and Sebastian for taking a look.

>>> Large user copy_to/from (more than 16 bytes) uses vmx instructions to
>>> speed things up. Once the copy is done, it makes sense to try schedule
>>> as soon as possible for preemptible kernels. So do this for
>>> preempt=full/lazy and rt kernel.
>>
>> Note that this check will also fire for PREEMPT_DYNAMIC && preempt=none.
>> So when power supports PREEMPT_DYNAMIC this will need to change
>> to preempt_model_*() based checks.

Yes. This and return to kernel both needs to change when PowerPC support PREEMPT_DYNAMIC.
I have a patch in work in which I essentially do check for the preemption model.
Either below or based on static key.

-	if (IS_ENABLED(CONFIG_PREEMPTION) && need_resched())
+	if (preempt_model_preemptible() && need_resched())



+mark +valentin

More looking into how PREEMPPT_DYNAMIC works with static key, I have one query.
This is more on PREEMPT_DYNAMIC than anything to with LAZY.

I see many places use static_key based check instead of using preempt_model_preemptible such as
dynamic_preempt_schedule, is it because static_key is faster?

On the other hand, using preempt_model_preemptible could make the code simpler.

>>
>>> Not checking for lazy bit here, since it could lead to unnecessary
>>> context switches.
>>
>> Maybe:
>> Not checking for lazy bit here, since we only want to schedule when
>> a context switch is imminently required.
> 
> Isn't his behaviour here exactly what preempt_enable() would do?
> If the LAZY bit is set, it is delayed until return to userland or an
> explicit schedule() because it is done. If this LAZY bit turned into an
> actual scheduling request then it is acted upon.
> 
> Sebastian



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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 19:23 [PATCH v2 0/2] powerpc: Enable lazy preemption Shrikanth Hegde
2024-11-16 19:23 ` [PATCH v2 1/2] powerpc: Add preempt lazy support Shrikanth Hegde
2024-11-26 10:53   ` Christophe Leroy
2024-12-01 19:28     ` Shrikanth Hegde
2024-12-09  7:43       ` Luming Yu
2024-11-16 19:23 ` [PATCH v2 2/2] powerpc: Large user copy aware of full:rt:lazy preemption Shrikanth Hegde
2024-11-19 21:08   ` Ankur Arora
2024-11-20  8:03     ` Sebastian Andrzej Siewior
2024-11-20 15:33       ` Shrikanth Hegde [this message]
2024-11-20  8:00   ` Sebastian Andrzej Siewior
2024-11-20 18:10     ` Shrikanth Hegde
2024-12-10 11:22 ` [PATCH v2 0/2] powerpc: Enable lazy preemption Shrikanth Hegde
2025-01-01  9:08 ` Madhavan Srinivasan

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=b98b7795-070a-4d9c-9599-445c2ff55fd7@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=bigeasy@linutronix.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mark.rutland@arm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=vschneid@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).