Re: [PATCH 1/5] mm: Introduce mm_struct.has_pinned

From: Linus Torvalds
Date: Mon Sep 28 2020 - 12:17:32 EST


On Mon, Sep 28, 2020 at 5:49 AM Jason Gunthorpe <jgg@xxxxxxxx> wrote:
>
> Not seeing an obvious option besides adding a smp_mb() before
> page_maybe_dma_pinned() as Peter once suggested.

That is going to be prohibitively expensive - needing it for each pte
whether it's pinned or not.

I really think the better option is a "don't do that then". This has
_never_ worked before either except by pure luck.

I also doubt anybody does it. forking with threads is a bad idea to
begin with. Doing so while pinning pages even more so.

Linus