From: Jan Kara <jack@suse.cz>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>,
Nadia Yvette Chambers <nyc@holomorphy.com>
Subject: [PATCH 07/10] hugetlbfs: Use pagevec_lookup_range() in remove_inode_hugepages()
Date: Wed, 26 Jul 2017 13:47:01 +0200 [thread overview]
Message-ID: <20170726114704.7626-8-jack@suse.cz> (raw)
In-Reply-To: <20170726114704.7626-1-jack@suse.cz>
We want only pages from given range in remove_inode_hugepages(). Use
pagevec_lookup_range() instead of pagevec_lookup().
CC: Nadia Yvette Chambers <nyc@holomorphy.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/hugetlbfs/inode.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index b9678ce91e25..8931236f3ef4 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -403,7 +403,6 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
struct pagevec pvec;
pgoff_t next, index;
int i, freed = 0;
- long lookup_nr = PAGEVEC_SIZE;
bool truncate_op = (lend == LLONG_MAX);
memset(&pseudo_vma, 0, sizeof(struct vm_area_struct));
@@ -412,30 +411,17 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
next = start;
while (next < end) {
/*
- * Don't grab more pages than the number left in the range.
- */
- if (end - next < lookup_nr)
- lookup_nr = end - next;
-
- /*
* When no more pages are found, we are done.
*/
- if (!pagevec_lookup(&pvec, mapping, &next, lookup_nr))
+ if (!pagevec_lookup_range(&pvec, mapping, &next, end - 1,
+ PAGEVEC_SIZE))
break;
for (i = 0; i < pagevec_count(&pvec); ++i) {
struct page *page = pvec.pages[i];
u32 hash;
- /*
- * The page (index) could be beyond end. This is
- * only possible in the punch hole case as end is
- * max page offset in the truncate case.
- */
index = page->index;
- if (index >= end)
- break;
-
hash = hugetlb_fault_mutex_hash(h, current->mm,
&pseudo_vma,
mapping, index, 0);
--
2.12.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-07-26 11:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 11:46 [PATCH 0/10 v2] Ranged pagevec lookup Jan Kara
2017-07-26 11:46 ` [PATCH 01/10] fscache: Remove unused ->now_uncached callback Jan Kara
2017-07-26 11:46 ` [PATCH 02/10] mm: Make pagevec_lookup() update index Jan Kara
2017-07-26 11:46 ` [PATCH 03/10] mm: Implement find_get_pages_range() Jan Kara
2017-07-26 11:46 ` [PATCH 04/10] fs: Fix performance regression in clean_bdev_aliases() Jan Kara
2017-07-26 11:46 ` [PATCH 05/10] ext4: Use pagevec_lookup_range() in ext4_find_unwritten_pgoff() Jan Kara
2017-07-26 11:47 ` [PATCH 06/10] ext4: Use pagevec_lookup_range() in writeback code Jan Kara
2017-07-26 11:47 ` Jan Kara [this message]
2017-07-27 19:10 ` [PATCH 07/10] hugetlbfs: Use pagevec_lookup_range() in remove_inode_hugepages() Mike Kravetz
2017-07-26 11:47 ` [PATCH 08/10] fs: Use pagevec_lookup_range() in page_cache_seek_hole_data() Jan Kara
2017-07-26 11:47 ` [PATCH 09/10] mm: Use find_get_pages_range() in filemap_range_has_page() Jan Kara
2017-07-26 11:47 ` [PATCH 10/10] mm: Remove nr_pages argument from pagevec_lookup{,_range}() Jan Kara
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=20170726114704.7626-8-jack@suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=nyc@holomorphy.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;
as well as URLs for NNTP newsgroup(s).