Re: [PATCH] Document that PF_KTHREAD _is_ ABI

From: Stefan Metzmacher
Date: Thu Apr 01 2021 - 14:06:36 EST



Am 31.03.21 um 21:23 schrieb Alexey Dobriyan:
> On Mon, Mar 22, 2021 at 07:53:10AM +0000, Christoph Hellwig wrote:
>> On Sat, Mar 20, 2021 at 10:23:12AM -0700, Andy Lutomirski wrote:
>>>> https://github.com/systemd/systemd/blob/main/src/basic/process-util.c#L354
>>>> src/basic/process-util.c:is_kernel_thread()
>>>
>>> Eww.
>>>
>>> Could we fix it differently and more permanently by modifying the proc
>>> code to display the values systemd expects?
>>
>> Yes, do_task_stat needs a mapping from kernel flags to UABI flags. And
>> we should already discard everything we think we can from the UABI
>> now, and only add the ones back that are required to not break
>> userspace.
>
> Sure we do. Who is going to find all the flags? I found PF_KTHREAD. :^)
>
> More seriously,
>
> /proc/$pid/stat was expanded to include tsk->flags in 0.99.1 (!!!)
>
> Developers kept adding and shuffling flags probably not even realising
> what's going on. The last incident happened at 5.10 when PF_IO_WORKER
> was exchanged with PF_VCPU for smaller codegen.

With the create_io_thread(), the impact of PF_IO_WORKER becomes more broadly
visible and userspace might start to look at it in order to find the difference
between userspace and kernel io threads. (I also think it should actually be renamed to
PF_IO_THREAD...)

Jens, what do you think about that?

metze