Re: [GIT PULL] x86/mm for 6.2

From: Linus Torvalds
Date: Fri Dec 16 2022 - 10:43:37 EST


On Fri, Dec 16, 2022 at 9:05 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
>
> Below is preliminary fixup that suppose to address the issue. It does not
> include change to untagged_addr() interface to avoid the clutter.

Looks like the right direction.

And once you change untagged_addr() to take 'tsk', you should then be
able to cache all the information in the thread struct, and avoid the
'tsk->mm' dereference entirely.

> kthread_use_mm() should be safe as long as no arch actually implements
> per-thread tagging enabling.

I think in a perfect world the (few) users of kthread_use_mm() would
also just make sure they did the locking of thing, so that they can't
have that race with somebody that then would enable LAM later.

Linus