[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250513170844.03ef5752@kernel.org>
Date: Tue, 13 May 2025 17:08:44 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Samiullah Khawaja <skhawaja@...gle.com>
Cc: "David S . Miller " <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
almasrymina@...gle.com, willemb@...gle.com, jdamato@...tly.com,
mkarsten@...terloo.ca, weiwan@...gle.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: stop napi kthreads when THREADED napi is
disabled
On Tue, 13 May 2025 00:26:31 +0000 Samiullah Khawaja wrote:
> @@ -7463,6 +7482,15 @@ static int napi_thread_wait(struct napi_struct *napi)
> return 0;
> }
>
> + /* Since the SCHED_THREADED is not set so we do not own this
> + * napi and it is safe to stop here if we are asked to. Checking
> + * the SCHED_THREADED before stopping here makes sure that this
> + * napi was not schedule again while napi threaded was being
> + * disabled.
> + */
Not sure if this works:
CPU 0 (IRQ) CPU 1 (NAPI thr) CPU 2 (config)
____napi_schedule()
if (test_bit(NAPI_STATE_THREADED))
clear_bit(NAPI_STATE_THREADED)
kthread_stop(thread)
if (test_bit(NAPI_STATE_SCHED_THREADED))
..
if (kthread_should_stop())
exit
set_bit(NAPI_STATE_SCHED_THREADED)
wake_up_process(thread);
> + if (kthread_should_stop())
> + break;
> +
> schedule();
> set_current_state(TASK_INTERRUPTIBLE);
Powered by blists - more mailing lists