Re: [Intel-gfx] [PATCH 5/6] kernel: better document the use_mm/unuse_mm API contract

From: Pavel Begunkov
Date: Sat Apr 04 2020 - 09:08:56 EST


On 04/04/2020 12:41, Christoph Hellwig wrote:
> Switch the function documentation to kerneldoc comments, and add
> WARN_ON_ONCE asserts that the calling thread is a kernel thread and
> does not have ->mm set (or has ->mm set in the case of unuse_mm).
>
> Also give the functions a kthread_ prefix to better document the
> use case.
>

io_uring and io-wq bits LGTM.

> --- a/include/linux/kthread.h
> +++ b/include/linux/kthread.h
...
> -/*
> - * unuse_mm
> - * Reverses the effect of use_mm, i.e. releases the
> - * specified mm context which was earlier taken on
> - * by the calling kernel thread
> - * (Note: this routine is intended to be called only
> - * from a kernel thread context)
> +/**
> + * kthread_use_mm - reverse the effect of kthread_use_mm()

s/kthread_use_mm/kthread_unuse_mm/
for the first one

> + * @mm: address space to operate on
> */
> -void unuse_mm(struct mm_struct *mm)
> +void kthread_unuse_mm(struct mm_struct *mm)
> {

--
Pavel Begunkov