lkml.org 
[lkml]   [2021]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 03/10] userfaultfd/shmem: support UFFDIO_CONTINUE for shmem
Axel,

On Thu, Apr 22, 2021 at 01:22:02PM -0700, Axel Rasmussen wrote:
> > + if (page_in_cache)
> > + page_add_file_rmap(page, false);
> > + else
> > + page_add_new_anon_rmap(page, dst_vma, dst_addr, false);
> > +
> > + /*
> > + * Must happen after rmap, as mm_counter() checks mapping (via
> > + * PageAnon()), which is set by __page_set_anon_rmap().
> > + */
> > + inc_mm_counter(dst_mm, mm_counter(page));
>
> Actually, I've noticed that this is still slightly incorrect.
>
> As Hugh pointed out, this works for the anon case, because
> page_add_new_anon_rmap() sets page->mapping.
>
> But for the page_in_cache case, it doesn't work: unlike its anon
> counterpart, page_add_file_rmap() *does not* set page->mapping.

If it's already in the page cache, shouldn't it be set already in e.g. one
previous call to shmem_add_to_page_cache()? Thanks,

--
Peter Xu

\
 
 \ /
  Last update: 2021-04-22 23:19    [W:0.082 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site