Re: [PATCH 4/5] exit: add internal include file with helpers

Jens Axboe
2023-07-14T20:21:15Z

On 7/14/23 2:16?PM, Jens Axboe wrote:
> On 7/14/23 9:38?AM, Christian Brauner wrote:
>>> diff --git a/kernel/exit.h b/kernel/exit.h
>>> new file mode 100644
>>> index 000000000000..f10207ba1341
>>> --- /dev/null
>>> +++ b/kernel/exit.h
>>> @@ -0,0 +1,30 @@
>>> +// SPDX-License-Identifier: GPL-2.0-only
>>> +#ifndef LINUX_WAITID_H
>>> +#define LINUX_WAITID_H
>>> +
>>> +struct waitid_info {
>>> + pid_t pid;
>>> + uid_t uid;
>>> + int status;
>>> + int cause;
>>> +};
>>> +
>>> +struct wait_opts {
>>> + enum pid_type wo_type;
>>> + int wo_flags;
>>> + struct pid *wo_pid;
>>> +
>>> + struct waitid_info *wo_info;
>>> + int wo_stat;
>>> + struct rusage *wo_rusage;
>>> +
>>> + wait_queue_entry_t child_wait;
>>> + int notask_error;
>>> +};
>>> +
>>> +bool pid_child_should_wake(struct wait_opts *wo, struct task_struct *p);
>>> +long __do_wait(struct wait_opts *wo);
>>> +int kernel_waitid_prepare(struct wait_opts *wo, int which, pid_t upid,
>>> + struct waitid_info *infop, int options,
>>> + struct rusage *ru, unsigned int *f_flags);
>>
>> I know this isn't your mess obviously but could you try and see whether
>> you can expose a nicer, dedicated struct and helper suited to io_uring's
>> needs instead of exposing the messy kernel/exit.c format?
>
> From a quick look, I think the wait_opts is pretty much what we need,
> not much to cut from that. For waitid_info, we can make do with just a
> forward declaration, we don't need the whole thing.

I'm wrong obviously, we do need waitid_info as well as that is the
output side... Seems to me that none of them have anything redundant wrt
io_uring. They could be combined into one thing, but is it worth it?

--
Jens Axboe