Re: [PATCH 1/5] mm: Introduce mm_struct.has_pinned
From: Peter Xu
Date: Fri Sep 25 2020 - 17:13:29 EST
On Fri, Sep 25, 2020 at 12:56:05PM -0700, Linus Torvalds wrote:
> So I think we can simply add a
>
> if (page_mapcount(page) != 1)
> return false;
>
> to page_maybe_dma_pinned(), and that very naturally protects against
> the "is the page count perhaps elevated due to a lot of forking?"
How about the MAP_SHARED case where the page is pinned by some process but also
shared (so mapcount can be >1)?
> And honestly, since this is all getting fairly late in the rc, and it
> took longer than I thought, I think we should do the GFP_ATOMIC
> approach for now - not great, but since it only triggers for this case
> that really should never happen anyway, I think it's probably the best
> thing for 5.9, and we can improve on things later.
Sorry for that. Maybe I should have moved even faster.
Would the ATOMIC version always work? I mean, I thought it could fail anytime,
so any fork() can start to fail for the tests too.
PS. I do plan to post a GFP_KERNEL version soon today, no matter for this
release or the next one.
--
Peter Xu