reiser4 releasepage fix
PATCH 1/1 reiser4 releasepage fix
Hi Andrew,
Can you put the following in -mm please? I cc'ed Hans about it earlier. Basically, resier4 does not present a good reason why pagecache should be dropped here. Basically the exact same operations are performed by releasepage callers (reclaim or truncate). If there is some atomicity problem, the code removed here wouldn't solve it anyway.
And unless reiser4 performs some of its own special synchronisation, I can't see how it gets the pagecache removal sequence right for the reclaim case (ie. careful checks of page_count and PageDirty under tree_lock).
With this patch in place, reiser4-reget-page-mapping.patch can go. I would also be worried about exporting remove_from_page_cache... at least the __ variant can stop being exported now.
--
fs/reiser4/as_ops.c +0 -13
@@ -358,11 +358,6 @@ int reiser4_releasepage(struct page *pagassert ("reiser4-4" , page->mapping !=NULL );assert ("reiser4-5" , page->mapping->host !=NULL ); -/* is_page_cache_freeable() check -(mapping + private + page_cache_get() by shrink_cache()) */ -if (page_count (page) >3 ) -return 0 ; -if (PageDirty (page))return 0 ;
@@ -385,14 +380,6 @@ int reiser4_releasepage(struct page *pag/* we are under memory pressure so release jnode also. */ jput (node); -write_lock_irq (&mapping->tree_lock); -/* shrink_list() + radix-tree */ -if (page_count (page) ==2 ) { -__remove_from_page_cache (page); -atomic_dec (&page->_count); - } -write_unlock_irq (&mapping->tree_lock); -return 1 ; }else {spin_unlock (&(node->load));
Quoted 3 lines · Nick Piggin
Hi Andrew,
Can you put the following in -mm please? I cc'ed Hans about it earlier.
I did test it under reclaim pressure, btw. Seems to be working OK.
hello,
Quoted 5 lines · Nick Piggin
Hi Andrew,
Can you put the following in -mm please? I cc'ed Hans about it earlier. Basically, resier4 does not present a good reason why pagecache should be dropped here.
correct. it duplicates remove_mapping().
we tested similar patch recently and found no problems.
Quoted 21 lines
Basically the exact same operations
are performed by releasepage callers (reclaim or truncate). If there is some atomicity problem, the code removed here wouldn't solve it anyway.And unless reiser4 performs some of its own special synchronisation, I can't see how it gets the pagecache removal sequence right for the reclaim case (ie. careful checks of
page_countand PageDirty undertree_lock).With this patch in place, reiser4-reget-page-mapping.patch can go. I would also be worried about exporting
remove_from_page_cache... at least the __ variant can stop being exported now.--
Index:linux-2.6/fs/reiser4/as_ops.c
===================================================================
fs/reiser4/as_ops.c int reiser4_releasepage(struct page *pag · line 360
Quoted 3 lines
fs/reiser4/as_ops.c +0
-0@@ -358,11 +358,6 @@ int reiser4_releasepage(struct page *pagassert ("reiser4-4" , page->mapping !=NULL );assert ("reiser4-5" , page->mapping->host !=NULL );
Except my patch didn't remove the page ref count check from reiser4_releasepage.
Nick, does the check conflict with the lockless pagecache patches? Reiser4 just tries to avoid unnecessary detaching private page objects if the page_count doesn't allow page removal.
Quoted 23 lines
fs/reiser4/as_ops.c +0
-13-/* is_page_cache_freeable() check -(mapping + private + page_cache_get() by shrink_cache()) */ -if (page_count (page) >3 ) -return 0 ; -if (PageDirty (page))return 0 ;@@ -385,14 +380,6 @@ int reiser4_releasepage(struct page *pag/* we are under memory pressure so release jnode also. */ jput (node); -write_lock_irq (&mapping->tree_lock); -/* shrink_list() + radix-tree */ -if (page_count (page) ==2 ) { -__remove_from_page_cache (page); -atomic_dec (&page->_count); - } -write_unlock_irq (&mapping->tree_lock); -return 1 ; }else {spin_unlock (&(node->load));
Signature · 1 line
Alex.
Quoted 5 lines · Alexander Zarochentsev
hello,
Quoted 2 lines · Nick Piggin
Hi Andrew,
Quoted 7 lines
Quoted 3 lines
Can you put the following in -mm please? I cc'ed Hans about it earlier. Basically, resier4 does not present a good reason why pagecache should be dropped here.
correct. it duplicates
remove_mapping().we tested similar patch recently and found no problems.
Oh good :)
Quoted 13 lines
fs/reiser4/as_ops.c int reiser4_releasepage(struct page *pag · line 360
Quoted 9 lines
--
Index:linux-2.6/fs/reiser4/as_ops.c
===================================================================fs/reiser4/as_ops.c +0
-0@@ -358,11 +358,6 @@ int reiser4_releasepage(struct page *pagassert ("reiser4-4" , page->mapping !=NULL );assert ("reiser4-5" , page->mapping->host !=NULL );Except my patch didn't remove the page ref count check from
reiser4_releasepage.
Quoted 3 lines
Nick, does the check conflict with the lockless pagecache patches? Reiser4 just tries to avoid unnecessary detaching private page objects if the
page_countdoesn't allow page removal.
Well the check is racy anyway because if the page is in pagecache, then there is nothing to prevent find_get_page from running (eg. page fault, or read(2)).
So strictly, no, the check does not conflict with lockless pagecache. It is simply nice to cut down the number of places where it isn't immediately obvious.
I'd also like to think about removing page_count from outside mm/, in favour of a pagecache API which gives us more confidence that the caller is sane and has taken correct locks, etc.
Anway, if you can "ack" this for Andrew, I'm sure he'd sleep a bit better (as would I)!
Quoted 9 lines
fs/reiser4/as_ops.c int reiser4_releasepage(struct page *pag · line 363
Quoted 9 lines
fs/reiser4/as_ops.c +0
-5-/* is_page_cache_freeable() check -(mapping + private + page_cache_get() by shrink_cache()) */ -if (page_count (page) >3 ) -return 0 ; -if (PageDirty (page))return 0 ;
BTW. the PageDirty check is also racy, so it can probably go too. I didn't have the courage to remove it because I don't know whether your page dirtying functions try to somehow synchronise against this.
Thanks,
Nick