[PATCH] powerpc: Add preempt lazy support

Shrikanth Hegde sshegde at linux.ibm.com
Fri Nov 15 18:04:02 AEDT 2024



On 11/14/24 07:31, Michael Ellerman wrote:
> Shrikanth Hegde <sshegde at linux.ibm.com> writes:
>> Thank you Sebastian for taking a look and rwb tag.
>>
>>> On 2024-11-08 15:48:53 [+0530], Shrikanth Hegde wrote:
>>>> Define preempt lazy bit for Powerpc. Use bit 9 which is free and within
>>>> 16 bit range of NEED_RESCHED, so compiler can issue single andi.
>>>>
>>>> Since Powerpc doesn't use the generic entry/exit, add lazy check at exit
>>>> to user. CONFIG_PREEMPTION is defined for lazy/full/rt so use it for
>>>> return to kernel.
>>>>
>>>> Ran a few benchmarks and db workload on Power10. Performance is close to
>>>> preempt=none/voluntary. It is possible that some patterns would
>>>> differ in lazy[2]. More details of preempt lazy is here [1]
>>>>
>>>> Since Powerpc system can have large core count and large memory,
>>>> preempt lazy is going to be helpful in avoiding soft lockup issues.
>>>>
>>>> [1]: https://lore.kernel.org/lkml/20241007074609.447006177@infradead.org/
>>>> [2]: https://lore.kernel.org/all/1a973dda-c79e-4d95-935b-e4b93eb077b8@linux.ibm.com/
>>>
>>> The lazy bits are only in tip.
>>

I have added change suggested by sebastian. I think it makes sense since 
the large user copy using vmx could take sometime and in preemptible 
kernel it needs to resched as soon as possible. However i am not making 
it consider lazy since it would lead to quite a bit of context switches 
which is not necessary.

-       if (IS_ENABLED(CONFIG_PREEMPT) && need_resched())
+       if (IS_ENABLED(CONFIG_PREEMPTION) && need_resched())
                 set_dec(1);
         return 0;


>> Hi Michael, I sent it to powerpc tree since all the changes were in
>> arch/powerpc. Please let me know if i have send it to tip tree instead.
> 
> I think I'd like it to have a full cycle of testing in next before going
> into mainline. So I'll plan to take this via the powerpc tree for the
> next cycle.
> 

Make sense.

> I assume you haven't tested 32-bit at all?
>

Yes, 32 bit isn't tested.  it would be better if it goes through  a test 
cycle. I will send out v2 soon.

> cheers



More information about the Linuxppc-dev mailing list