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

Linus Torvalds
2020-09-26T01:16:04Z

On Fri, Sep 25, 2020 at 5:41 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> I don't completely grok the consequences of the anon_vma check. We
> can exclude file backed mappings as they are broken for pinning
> anyhow, so what is left that could be MAP_PRIVATE of a non-anon_vma?

It really shouldn't ever happen.

The only way a COW vma can have a NULL anon_vma should be if it has no
pages mapped at all.

Technically I think it could happen if you only ever mapped the
special zero page in there (but that shouldn't then get to the
"vm_normal_page()").

> Otherwise, I do prefer Peter's version because of the GFP_KERNEL. To
> touch on your other email..

Yeah, no, I just hadn't seen a new version, so I started getting antsy
and that's when I decided to see what a minimal patch looks like.

I think that over the weekend I'll do Peter's version but with the
"page_mapcount() == 1" check, because I'm starting to like that
better than the mm->has_pinned.

Comments on that plan?

Linus