Re: [PATCH 02/10] rcu: Move rcu_preempt_depth_set() to rcupdate.h
From: Alan Huang
Date: Mon Apr 01 2024 - 07:58:06 EST
2024年4月1日 19:40,Alan Huang <mmpgouride@xxxxxxxxx> wrote:
>
> 2024年4月1日 00:16,Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
>>
>> On Sun, Mar 31, 2024 at 7:10 PM Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
>>>
>>>
>>>
>>>> On Mar 28, 2024, at 1:20 PM, Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
>>>>
>>>> From: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx>
>>>>
>>>> Prepare for arch-specific-defined rcu_preempt_depth_set().
>>>>
>>>> No functionality change intended, but it has to be defined as a macro
>>>> as rcupdate.h is a very low level header included from areas that don't
>>>> even know about the task struct "current".
>>>
>>> Sorry I did not follow changelog. If some rcupdate.h includers do not know
>>> about task_struct, how does adding a macro that uses current help?
>>>
>>
>> Hello
>>
>> This is how macro works and it expands blindly based on tokens on the
>> usage-sites.
>
> But ‘current’ still needs to be expanded at last, it seems to me that it only affects
> the including order of the header files?
>
> Or what am I missing?
Get the missing part: if the user don’t need to use rcu_preempt_depth()
and rcu_preempt_depth_set() but other parts of rcupdate.h, then the two
has to be defined as a macro to avoid including linux/sched.h.
Sorry for the bother.
>
>>
>> And rcu_preempt_depth() & rcu_preempt_depth_set() are not universally
>> used wrappers, the user can simply also include linux/sched.h to make
>> they work.
>>
>> Thanks
>> Lai