[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb0df409-ebbf-4970-b10c-4ea9f863ff00@uliege.be>
Date: Thu, 3 Apr 2025 21:08:12 +0200
From: Justin Iurman <justin.iurman@...ege.be>
To: Stanislav Fomichev <stfomichev@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, horms@...nel.org, kuniyu@...zon.com,
Alexei Starovoitov <alexei.starovoitov@...il.com>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH net] net: lwtunnel: disable preemption when required
On 4/3/25 18:24, Stanislav Fomichev wrote:
> On 04/03, Justin Iurman wrote:
>> In lwtunnel_{input|output|xmit}(), dev_xmit_recursion() may be called in
>> preemptible scope for PREEMPT kernels. This patch disables preemption
>> before calling dev_xmit_recursion(). Preemption is re-enabled only at
>> the end, since we must ensure the same CPU is used for both
>> dev_xmit_recursion_inc() and dev_xmit_recursion_dec() (and any other
>> recursion levels in some cases) in order to maintain valid per-cpu
>> counters.
>
> Dummy question: CONFIG_PREEMPT_RT uses current->net_xmit.recursion to
> track the recursion. Any reason not to do it in the generic PREEMPT case?
I'd say PREEMPT_RT is a different beast. IMO, softirqs can be
preempted/migrated in RT kernels, which is not true for non-RT kernels.
Maybe RT kernels could use __this_cpu_* instead of "current" though, but
it would be less trivial. For example, see commit ecefbc09e8ee ("net:
softnet_data: Make xmit per task.") on why it makes sense to use
"current" in RT kernels. I guess the opposite as you suggest (i.e.,
non-RT kernels using "current") would be technically possible, but there
must be a reason it is defined the way it is... so probably incorrect or
inefficient?
Powered by blists - more mailing lists