From: Matthew Wilcox <willy@infradead.org>
To: Nick Piggin <npiggin@au1.ibm.com>
Cc: linux-mm@kvack.org
Subject: find_get_pages_contig
Date: Wed, 21 Nov 2018 10:33:02 -0800 [thread overview]
Message-ID: <20181121183302.GJ3065@bombadil.infradead.org> (raw)
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.
reply other threads:[~2018-11-21 18:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121183302.GJ3065@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@au1.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox