Re: [GIT PULL] keys: Miscellaneous fixes/changes

From: Jens Axboe
Date: Tue Mar 21 2023 - 15:33:20 EST


On 3/21/23 1:21?PM, Linus Torvalds wrote:
> On Tue, Mar 21, 2023 at 12:16?PM Jens Axboe <axboe@xxxxxxxxx> wrote:
>>
>> I haven't seen the patch yet as it hasn't been pushed,
>
> Well, it went out a couple of minutes before your email, so it's out now.

Yep I see it now, looks as expected.

>> It may make sense to add some debug check for
>> PF_KTHREAD having TIF_NOTIFY_RESUME set, or task_work pending for that
>> matter, as that is generally not workable without doing something to
>> handle it explicitly.
>
> Yeah, I guess we could have some generic check for that. I'm not sure
> where it would be. Scheduler?

Off the top of my head, two options, both in kernel/sched/core.c:

1) Add it to schedule_debug()

2) Add it to sched_submit_work(), adding PF_KTHREAD to the flags checked
for PF_IO_WORKER | PF_WQ_WORKER to avoid adding any extra fast-path
overhead.

Alternatively, I guess it could go in kthread_exit() as well. But for
workloads with a persistent kthread that doesn't really go away, that
won't catch it.

--
Jens Axboe