Readahead fixes
Subsystems (2)
cover Readahead fixes
Minor readahead fixes, details in respective patch mails
Raghavendra D Prabhu (3):
Change the check for PageReadahead into an else-if Remove file_ra_state from arguments of count_history_pages. Move the check for ra_pages after VM_SequentialReadHint()
mm/filemap.c | 8 ++++---- mm/readahead.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.6
PATCH 1/3 mm/readahead: Change the check for PageReadahead into an else-if
Quoted 1 line
From
51daa88ebd8e0d437289f589af29d4b39379ea76,page_sync_readaheadcoalesces
async readahead into its readahead window, so another checking for that again is not required.
--- mm/filemap.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
mm/filemap.c +1 -2
@@ -1115,8 +1115,7 @@ find_page: page =find_get_page (mapping, index);if (unlikely (page ==NULL )) goto no_cached_page; - } -if (PageReadahead (page)) { + }else if (PageReadahead (page)) {page_cache_async_readahead (mapping, ra, filp, page, index, last_index - index);
Signature · 8 lines
1.7.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/3] mm/readahead: Change the check for PageReadahead into an else-if
Quoted 5 lines · Raghavendra D Prabhu
Quoted 1 line
From
51daa88ebd8e0d437289f589af29d4b39379ea76,page_sync_readaheadcoalescesasync readahead into its readahead window, so another checking for that again is not required.
Signed-off-by Raghavendra D Prabhu <[email protected]>
Thank you!
PATCH 2/3 mm/readahead: Remove file_ra_state from arguments of count_history_pages.
In reply to Raghavendra D Prabhucount_history_pages doesn't require readahead state to calculate the offset from history.
--- mm/readahead.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
mm/readahead.c +1 -2
@@ -343,7 +343,6 @@ static unsigned long get_next_ra_size(struct file_ra_state *ra,* - thrashing threshold in memory tight systems */ static pgoff_t count_history_pages (struct address_space *mapping, -struct file_ra_state *ra,pgoff_t offset,unsigned long max) {pgoff_t head;
@@ -366,7 +365,7 @@ static int try_context_readahead(struct address_space *mapping, {pgoff_t size; - size =count_history_pages (mapping, ra, offset, max); + size =count_history_pages (mapping, offset, max);/* * no history pages:
Signature · 8 lines
1.7.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] mm/readahead: Remove file_ra_state from arguments of count_history_pages.
Quoted 3 lines · Raghavendra D Prabhu
count_history_pagesdoesn't require readahead state to calculate the offset from history.Signed-off-by Raghavendra D Prabhu <[email protected]>
Thank you!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/3 mm/readahead: Move the check for ra_pages after VM_SequentialReadHint()
In reply to Raghavendra D Prabhupage_cache_sync_readahead checks for ra->ra_pages again, so moving the check after VM_SequentialReadHint.
--- mm/filemap.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
mm/filemap.c +3 -2
@@ -1566,8 +1566,6 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,/* If we don't want any read-ahead, don't bother */ if (VM_RandomReadHint (vma))return ; -if (!ra->ra_pages) -return ;if (VM_SequentialReadHint (vma)) { page_cache_sync_readahead(mapping, ra, file, offset,
@@ -1575,6 +1573,9 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,return ; } +if (!ra->ra_pages) +return ; +/* Avoid banging the cache line if not needed */ if (ra->mmap_miss <MMAP_LOTSAMISS *10 ) ra->mmap_miss++;
Signature · 8 lines
1.7.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 3/3] mm/readahead: Move the check for ra_pages after VM_SequentialReadHint()
Quoted 1 line · Raghavendra D Prabhu
page_cache_sync_readaheadchecks forra->ra_pagesagain, so moving the check afterVM_SequentialReadHint.
NAK. This patch adds nothing but overheads.
Quoted 12 lines
mm/filemap.c +0
-2@@ -1566,8 +1566,6 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,/* If we don't want any read-ahead, don't bother */ if (VM_RandomReadHint (vma))return ; -if (!ra->ra_pages) -return ;if (VM_SequentialReadHint (vma)) { page_cache_sync_readahead(mapping, ra, file, offset,
mm/filemap.c static void do_sync_mmap_readahead(struct vm_area_struct *vma, · line 1578
Quoted 6 lines
mm/filemap.c +3
-0@@ -1575,6 +1573,9 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,return ; } +if (!ra->ra_pages) +return ; +
page_cache_sync_readahead() has the same
if (!ra->ra_pages) return;
So the patch adds the call into page_cache_sync_readahead() just to return..
Thanks,
Fengguang
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [TOME] Re: [PATCH 3/3] mm/readahead: Move the check for ra_pages after VM_SequentialReadHint()
Quoted 20 lines · * On Sat, Jul 09, 2011 at 01:53:08PM -0700, Wu Fengguang…
Quoted 1 line · Raghavendra D Prabhu
page_cache_sync_readaheadchecks forra->ra_pagesagain, so moving the check afterVM_SequentialReadHint.NAK. This patch adds nothing but overheads.
Quoted 14 lines
mm/filemap.c +0
-2@@ -1566,8 +1566,6 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,/* If we don't want any read-ahead, don't bother */ if (VM_RandomReadHint (vma))return ; -if (!ra->ra_pages) -return ;if (VM_SequentialReadHint (vma)) { page_cache_sync_readahead(mapping, ra, file, offset,@@ -1575,6 +1573,9 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,return ; }
Quoted 8 lines
mm/filemap.c static void do_sync_mmap_readahead(struct vm_area_struct *vma, · line 1578
Quoted 3 lines
mm/filemap.c +3
-0+if (!ra->ra_pages) +return ; +
page_cache_sync_readahead()has the sameif (!ra->ra_pages) return;
1. Yes, I saw that and that is why I moved it after the condition, so that duplicate checks are not needed -- ie., if VM_SequentialReadHint is true, then
(!ra->ra_pages) is checked twice otherwise.
2. Also, another thought, is the check needed at its original place (if not it can be removed), reasons being -- filesystems like tmpfs which have ra_pages set to 0 don't use filemap_fault in their VMA ops and also do_sync_mmap_readahead is called in a major page fault context.
Quoted 6 lines
So the patch adds the call into
page_cache_sync_readahead()just to return..Thanks,
Fengguang
--------------------------
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net
Re: [TOME] Re: [PATCH 3/3] mm/readahead: Move the check for ra_pages after VM_SequentialReadHint()
Quoted 27 lines · Raghavendra D Prabhu
Quoted 26 lines · * On Sat, Jul 09, 2011 at 01:53:08PM -0700, Wu Fengguang…
Quoted 1 line · Raghavendra D Prabhu
page_cache_sync_readaheadchecks forra->ra_pagesagain, so moving the check afterVM_SequentialReadHint.NAK. This patch adds nothing but overheads.
Quoted 12 lines
mm/filemap.c +0
-2@@ -1566,8 +1566,6 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,/* If we don't want any read-ahead, don't bother */ if (VM_RandomReadHint (vma))return ; -if (!ra->ra_pages) -return ;if (VM_SequentialReadHint (vma)) { page_cache_sync_readahead(mapping, ra, file, offset,mm/filemap.c static void do_sync_mmap_readahead(struct vm_area_struct *vma, · line 1578
Quoted 6 lines
mm/filemap.c +3
-0@@ -1575,6 +1573,9 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,return ; } +if (!ra->ra_pages) +return ; +
page_cache_sync_readahead()has the same
Quoted 5 lines
Quoted 2 lines
if (!ra->ra_pages) return;1. Yes, I saw that and that is why I moved it after the condition, so that duplicate checks are not needed -- ie., if
VM_SequentialReadHintis true, then
(!ra->ra_pages) is checked twice otherwise.
Ok, I see.
Quoted 3 lines
2. Also, another thought, is the check needed at its original place (if not it can be removed), reasons being -- filesystems like tmpfs which have
ra_pagesset to 0 don't usefilemap_faultin their VMA ops and also
Good point. tmpfs is using shmem_fault().. Can you remove the test?
Quoted 1 line
do_sync_mmap_readaheadis called in a major page fault context.
Right. This is irrelevant however, because if pa_pages==0, the page faults will normally be major ones.
Thanks,
Fengguang
Quoted 10 lines
Quoted 5 lines
So the patch adds the call into
page_cache_sync_readahead()just to return..Thanks,
Fengguang--------------------------
Raghavendra Prabhu
GPG Id :0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re. Revised [PATCH 3/3] mm/readahead: Remove the check for ra->ra_pages
Quoted 34 lines · * On Sun, Jul 10, 2011 at 08:59:06AM -0700, Wu Fengguang…
Quoted 27 lines · Raghavendra D Prabhu
Quoted 25 lines · * On Sat, Jul 09, 2011 at 01:53:08PM -0700, Wu Fengguang…
Quoted 1 line · Raghavendra D Prabhu
page_cache_sync_readaheadchecks forra->ra_pagesagain, so moving the check afterVM_SequentialReadHint.NAK. This patch adds nothing but overheads.
Quoted 12 lines
mm/filemap.c +0
-2@@ -1566,8 +1566,6 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,/* If we don't want any read-ahead, don't bother */ if (VM_RandomReadHint (vma))return ; -if (!ra->ra_pages) -return ;if (VM_SequentialReadHint (vma)) { page_cache_sync_readahead(mapping, ra, file, offset,mm/filemap.c static void do_sync_mmap_readahead(struct vm_area_struct *vma, · line 1578
Quoted 6 lines
mm/filemap.c +3
-0@@ -1575,6 +1573,9 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,return ; } +if (!ra->ra_pages) +return ; +
page_cache_sync_readahead()has the sameQuoted 5 lines
Quoted 2 lines
if (!ra->ra_pages) return;1. Yes, I saw that and that is why I moved it after the condition, so that duplicate checks are not needed -- ie., if
VM_SequentialReadHintis true, then
(!ra->ra_pages) is checked twice otherwise.
Quoted 7 lines
Ok, I see.
Quoted 3 lines
2. Also, another thought, is the check needed at its original place (if not it can be removed), reasons being -- filesystems like tmpfs which have
ra_pagesset to 0 don't usefilemap_faultin their VMA ops and alsoGood point. tmpfs is using
shmem_fault().. Can you remove the test?
I have removed that test. Patch attached.
Quoted 21 lines
Quoted 2 lines
do_sync_mmap_readaheadis called in a major page fault context.Right. This is irrelevant however, because if pa_pages==0, the page faults will normally be major ones.
Thanks,
FengguangQuoted 10 lines
Quoted 4 lines
So the patch adds the call into
page_cache_sync_readahead()just to return..Thanks,
Fengguang--------------------------
Raghavendra Prabhu
GPG Id :0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net
======================================================================
The check for ra->ra_pages is not required since fs like tmpfs which have ra_pages set to 0 don't use filemap_fault as part of their VMA ops (it uses shmem_fault). Also, page_cache_sync_readahead does its own check for ra_pages.
---
mm/filemap.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 074c23d..0bcd276 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1566,8 +1566,6 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,
/* If we don't want any read-ahead, don't bother */
if (VM_RandomReadHint(vma))
return; - if (!ra->ra_pages)
- return;
if (VM_SequentialReadHint(vma)) {
page_cache_sync_readahead(mapping, ra, file, offset,
--
1.7.6
--------------------------
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Wu Fengguang
Acked-byRe: Re. Revised [PATCH 3/3] mm/readahead: Remove the check for ra->ra_pages
Quoted 5 lines
The check for
ra->ra_pagesis not required since fs like tmpfs which havera_pagesset to 0 don't usefilemap_faultas part of their VMA ops (it usesshmem_fault). Also,page_cache_sync_readaheaddoes its own check forra_pages.Signed-off-by Raghavendra D Prabhu <[email protected]>
Thank you!