mm: change may_enter_fs check condition
Subsystems (3)
PATCH 1/1 mm: change may_enter_fs check condition
Add page_is_file_cache() for __GFP_FS check,
otherwise, a Pageswapcache() && PageDirty() page can always be write back if the gfp flag is __GFP_FS, this is not the expected behavior.
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -930,7 +930,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,if (page_mapped (page) ||PageSwapCache (page)) sc->nr_scanned++; - may_enter_fs = (sc->gfp_mask & __GFP_FS) || + may_enter_fs = (page_is_file_cache (page) && (sc->gfp_mask & __GFP_FS)) || (PageSwapCache (page) && (sc->gfp_mask & __GFP_IO));/*
Signature · 7 lines
1.9.1 -- 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/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · yalin wang
Add
page_is_file_cache()for__GFP_FScheck,
otherwise, aPageswapcache()&&PageDirty()page can always be write back if the gfp flag is__GFP_FS, this is not the expected behavior.
I'm not sure I understand your point correctly *), but you seem to imply that there would be an allocation that has __GFP_FS but doesn't have __GFP_IO? Are there such allocations and does it make sense?
*) It helps to state which problem you actually observed and are trying to fix. Or was this found by code inspection? In that case describe the theoretical problem, as "expected behavior" isn't always understood by everyone the same.
Quoted 11 lines
Signed-off-by yalin wang <[email protected]>--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/vmscan.c +0
-0
mm/vmscan.c static unsigned long shrink_page_list(struct list_head *page_list, · line 936
Quoted 8 lines
mm/vmscan.c +1
-1@@ -930,7 +930,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,if (page_mapped (page) ||PageSwapCache (page)) sc->nr_scanned++; - may_enter_fs = (sc->gfp_mask & __GFP_FS) || + may_enter_fs = (page_is_file_cache (page) && (sc->gfp_mask & __GFP_FS)) || (PageSwapCache (page) && (sc->gfp_mask & __GFP_IO));/*
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Michal Hocko
reviewerQuoted 8 lines · Vlastimil Babka
Quoted 3 lines · yalin wang
Add
page_is_file_cache()for__GFP_FScheck,
otherwise, aPageswapcache()&&PageDirty()page can always be write back if the gfp flag is__GFP_FS, this is not the expected behavior.I'm not sure I understand your point correctly *), but you seem to imply that there would be an allocation that has
__GFP_FSbut doesn't have__GFP_IO? Are there such allocations and does it make sense?
No it doesn't. There is a natural layering here and __GFP_FS allocations should contain __GFP_IO.
The patch as is makes only little sense to me. Are you seeing any issue which this is trying to fix?
Quoted 24 lines
*) It helps to state which problem you actually observed and are trying to fix. Or was this found by code inspection? In that case describe the theoretical problem, as "expected behavior" isn't always understood by everyone the same.
Quoted 19 lines
Signed-off-by yalin wang <[email protected]>--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/vmscan.c +1
-1@@ -930,7 +930,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,if (page_mapped (page) ||PageSwapCache (page)) sc->nr_scanned++; - may_enter_fs = (sc->gfp_mask & __GFP_FS) || + may_enter_fs = (page_is_file_cache (page) && (sc->gfp_mask & __GFP_FS)) || (PageSwapCache (page) && (sc->gfp_mask & __GFP_IO));/*
Signature · 8 lines
Michal Hocko SUSE Labs -- 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/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 13 lines · Michal Hocko
Quoted 8 lines · Vlastimil Babka
Quoted 3 lines · yalin wang
Add
page_is_file_cache()for__GFP_FScheck,
otherwise, aPageswapcache()&&PageDirty()page can always be write back if the gfp flag is__GFP_FS, this is not the expected behavior.I'm not sure I understand your point correctly *), but you seem to imply that there would be an allocation that has
__GFP_FSbut doesn't have__GFP_IO? Are there such allocations and does it make sense?
Quoted 5 lines
No it doesn't. There is a natural layering here and
__GFP_FSallocations should contain__GFP_IO.The patch as is makes only little sense to me. Are you seeing any issue which this is trying to fix?
mm..
i don’t see issue for this part ,
just feel confuse when i see code about this part ,
then i make a patch for this .
i am not sure if __GFP_FS will make sure __GFP_IO flag must be always set. if it is , i think can add comment here to make people clear . :)
Thanks
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>