lkml.org 
[lkml]   [2018]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] mm: Remove redundant test from find_get_pages_contig
Date
After we establish a reference on the page, we check the pointer continues
to be in the correct position in i_pages. There's no need to check the
page->mapping or page->index afterwards; if those can change after we've
got the reference, they can change after we return the page to the caller.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
---
mm/filemap.c | 10 ----------
1 file changed, 10 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 81adec8ee02cc..538531590ef2d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1776,16 +1776,6 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
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;
- }
-
pages[ret] = page;
if (++ret == nr_pages)
break;
--
2.19.1
\
 
 \ /
  Last update: 2018-11-22 22:33    [W:0.119 / U:2.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site