* find_get_pages_contig
@ 2018-11-21 18:33 Matthew Wilcox
0 siblings, 0 replies; only message in thread
From: Matthew Wilcox @ 2018-11-21 18:33 UTC (permalink / raw)
To: Nick Piggin; +Cc: linux-mm
Hi Nick,
Sorry to trouble you about a patch from 2011, but even cregit can't find
a mailing list discussion to guide me. The commit is
9cbb4cb21b19fff46cf1174d0ed699ef710e641c (mm: find_get_pages_contig fixlet)
I understand that checking mapping and index before taking the ref can
lead to false positives & negatives, but here's what the current code
looks like:
head = compound_head(page);
if (!page_cache_get_speculative(head))
goto retry;
/* The page was split under us? */
if (compound_head(page) != head)
goto put_page;
/* Has the page moved? */
if (unlikely(page != xas_reload(&xas)))
goto put_page;
/*
* must check mapping and index after taking the ref.
* otherwise we can get both false positives and false
* negatives, which is just confusing to the caller.
*/
if (!page->mapping || page_to_pgoff(page) != xas.xa_index) {
put_page(page);
break;
}
After checking that page is still at the right location (done by the
xas_reload() call up there), does checking mapping and page_to_pgoff
really check anything new? It's my understanding that after I have a
ref on a page, it can't be moved within the mapping or to a new mapping.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-11-21 18:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 18:33 find_get_pages_contig Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox