[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161025001342.76126-13-kirill.shutemov@linux.intel.com>
Date: Tue, 25 Oct 2016 03:13:11 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: "Theodore Ts'o" <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Jan Kara <jack@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Hugh Dickins <hughd@...gle.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Dave Hansen <dave.hansen@...el.com>,
Vlastimil Babka <vbabka@...e.cz>,
Matthew Wilcox <willy@...radead.org>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-block@...r.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: [PATCHv4 12/43] truncate: make sure invalidate_mapping_pages() can discard huge pages
invalidate_inode_page() has expectation about page_count() of the page
-- if it's not 2 (one to caller, one to radix-tree), it will not be
dropped. That condition almost never met for THPs -- tail pages are
pinned to the pagevec.
Let's drop them, before calling invalidate_inode_page().
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
---
mm/truncate.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/truncate.c b/mm/truncate.c
index a01cce450a26..393bf9447231 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -504,10 +504,22 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
/* 'end' is in the middle of THP */
if (index == round_down(end, HPAGE_PMD_NR))
continue;
+ /*
+ * invalidate_inode_page() expects
+ * page_count(page) == 2 to drop page from page
+ * cache -- drop tail pages references.
+ */
+ get_page(page);
+ pagevec_remove_exceptionals(&pvec);
+ pagevec_release(&pvec);
}
ret = invalidate_inode_page(page);
unlock_page(page);
+
+ if (PageTransHuge(page))
+ put_page(page);
+
/*
* Invalidation is a hint that the page is no longer
* of interest and try to speed up its reclaim.
--
2.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists