* [PATCH 0/10 v2] Ranged pagevec lookup
@ 2017-07-26 11:46 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
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kara @ 2017-07-26 11:46 UTC (permalink / raw)
To: linux-mm
Cc: Andrew Morton, Jan Kara, Theodore Ts'o, linux-ext4,
Nadia Yvette Chambers, linux-fsdevel
Hello,
This patch series was split out of the larger series to clean up pagevec APIs
and provide ranged lookups. In this series I make pagevec_lookup() update the
index (to be consistent with pagevec_lookup_tag() and also as a preparation
for ranged lookups), provide ranged variant of pagevec_lookup() and use it
in places where it makes sense. This not only removes some common code but
is also a measurable performance win for some use cases (see patch 4/10) where
radix tree is sparse and searching & grabing of a page after the end of the
range has measurable overhead.
Andrew, can you please consider merging this series?
Full series including dependencies can be also obtained from my git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git find_get_pages_range
Opinions and review welcome!
Honza
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 05/10] ext4: Use pagevec_lookup_range() in ext4_find_unwritten_pgoff()
2017-07-26 11:46 [PATCH 0/10 v2] Ranged pagevec lookup Jan Kara
@ 2017-07-26 11:46 ` Jan Kara
2017-07-26 11:47 ` [PATCH 06/10] ext4: Use pagevec_lookup_range() in writeback code Jan Kara
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2017-07-26 11:46 UTC (permalink / raw)
To: linux-mm; +Cc: Andrew Morton, Jan Kara, linux-ext4, Theodore Ts'o
Use pagevec_lookup_range() in ext4_find_unwritten_pgoff() since we are
interested only in pages in the given range. Simplify the logic as a
result of not getting pages out of range and index getting automatically
advanced.
CC: linux-ext4@vger.kernel.org
CC: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/file.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index ab09cb6fcce3..ac39a6a1ea5d 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -494,12 +494,11 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
pagevec_init(&pvec, 0);
do {
- int i, num;
+ int i;
unsigned long nr_pages;
- num = min_t(pgoff_t, end - index, PAGEVEC_SIZE - 1) + 1;
- nr_pages = pagevec_lookup(&pvec, inode->i_mapping, &index,
- (pgoff_t)num);
+ nr_pages = pagevec_lookup_range(&pvec, inode->i_mapping,
+ &index, end, PAGEVEC_SIZE);
if (nr_pages == 0)
break;
@@ -518,9 +517,6 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
goto out;
}
- if (page->index > end)
- goto out;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 06/10] ext4: Use pagevec_lookup_range() in writeback code
2017-07-26 11:46 [PATCH 0/10 v2] Ranged pagevec lookup 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 ` Jan Kara
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2017-07-26 11:47 UTC (permalink / raw)
To: linux-mm; +Cc: Andrew Morton, Jan Kara, Theodore Ts'o, linux-ext4
Both occurences of pagevec_lookup() actually want only pages from a
given range. Use pagevec_lookup_range() for the lookup.
CC: "Theodore Ts'o" <tytso@mit.edu>
CC: linux-ext4@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/inode.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 68d0166d5ebc..eb86c1baf40c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1676,13 +1676,13 @@ static void mpage_release_unused_pages(struct mpage_da_data *mpd,
pagevec_init(&pvec, 0);
while (index <= end) {
- nr_pages = pagevec_lookup(&pvec, mapping, &index, PAGEVEC_SIZE);
+ nr_pages = pagevec_lookup_range(&pvec, mapping, &index, end,
+ PAGEVEC_SIZE);
if (nr_pages == 0)
break;
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
- if (page->index > end)
- break;
+
BUG_ON(!PageLocked(page));
BUG_ON(PageWriteback(page));
if (invalidate) {
@@ -2303,15 +2303,13 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
pagevec_init(&pvec, 0);
while (start <= end) {
- nr_pages = pagevec_lookup(&pvec, inode->i_mapping, &start,
- PAGEVEC_SIZE);
+ nr_pages = pagevec_lookup_range(&pvec, inode->i_mapping,
+ &start, end, PAGEVEC_SIZE);
if (nr_pages == 0)
break;
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
- if (page->index > end)
- break;
bh = head = page_buffers(page);
do {
if (lblk < mpd->map.m_lblk)
--
2.12.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-26 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 11:46 [PATCH 0/10 v2] Ranged pagevec lookup 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
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).