mm:remove useless code
Subsystems (3)
PATCH 1/1 mm:remove useless code
From: YangHui <[email protected]>
remove useless code
--- mm/vmscan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mm/vmscan.c +2 -3
@@ -1234,8 +1234,8 @@ static unsigned int shrink_page_list(struct list_head *page_list,* Try to allocate it some swap space here. * Lazyfree page could be freed directly */ -if (PageAnon (page) &&PageSwapBacked (page)) { -if (!PageSwapCache (page)) { +if (PageAnon (page) &&PageSwapBacked (page) && + !PageSwapCache (page)) {if (!(sc->gfp_mask & __GFP_IO)) goto keep_locked;if (PageTransHuge (page)) {
@@ -1270,7 +1270,6 @@ static unsigned int shrink_page_list(struct list_head *page_list,/* Adding to swap updated mapping */ mapping =page_mapping (page); - } }else if (unlikely (PageTransHuge (page))) {/* Split file THP */ if (split_huge_page_to_list (page, page_list))
Signature · 1 line
2.7.4
Quoted 15 lines · hui yang
From: YangHui <[email protected]>
remove useless code
Signed-off-by YangHui <[email protected]>--- mm/vmscan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)mm/vmscan.c +0
-0
mm/vmscan.c static unsigned int shrink_page_list(struct list_head *page_list, · line 1238
Quoted 7 lines
mm/vmscan.c +2
-2@@ -1234,8 +1234,8 @@ static unsigned int shrink_page_list(struct list_head *page_list,* Try to allocate it some swap space here. * Lazyfree page could be freed directly */ -if (PageAnon (page) &&PageSwapBacked (page)) { -if (!PageSwapCache (page)) { +if (PageAnon (page) &&PageSwapBacked (page) && + !PageSwapCache (page)) {
I think this is incorrect.
Consider this scenario:
PageAnon(page) && PageSwapBacked(page) is true
!PageSwapCache(page) is false
In original logic, this snippet will run into the first if branch which does nothing actually. However, in your logic, this snippet will run into else if branch.
Regards,
Hao Lee
Quoted 15 lines
mm/vmscan.c +0
-2if (!(sc->gfp_mask & __GFP_IO)) goto keep_locked;if (PageTransHuge (page)) {@@ -1270,7 +1270,6 @@ static unsigned int shrink_page_list(struct list_head *page_list,/* Adding to swap updated mapping */ mapping =page_mapping (page); - } }else if (unlikely (PageTransHuge (page))) {/* Split file THP */ if (split_huge_page_to_list (page, page_list)) --2.7.4
Quoted 4 lines · hui yang
From: YangHui <[email protected]>
remove useless code
Change logs need to be more descriptive.
Quoted 11 lines
Signed-off-by YangHui <[email protected]>--- mm/vmscan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)mm/vmscan.c +0
-0
mm/vmscan.c static unsigned int shrink_page_list(struct list_head *page_list, · line 1238
Quoted 7 lines
mm/vmscan.c +2
-2@@ -1234,8 +1234,8 @@ static unsigned int shrink_page_list(struct list_head *page_list,* Try to allocate it some swap space here. * Lazyfree page could be freed directly */ -if (PageAnon (page) &&PageSwapBacked (page)) { -if (!PageSwapCache (page)) { +if (PageAnon (page) &&PageSwapBacked (page) && + !PageSwapCache (page)) {
This will change the original behaviour of the code.
Quoted 15 lines
mm/vmscan.c +0
-2if (!(sc->gfp_mask & __GFP_IO)) goto keep_locked;if (PageTransHuge (page)) {@@ -1270,7 +1270,6 @@ static unsigned int shrink_page_list(struct list_head *page_list,/* Adding to swap updated mapping */ mapping =page_mapping (page); - } }else if (unlikely (PageTransHuge (page))) {/* Split file THP */ if (split_huge_page_to_list (page, page_list)) --2.7.4