mm: Improve readability of clear_huge_page
Subsystems (2)
PATCH 1/1 mm: Improve readability of clear_huge_page
From: Huang Ying <[email protected]>
The optimized clear_huge_page() isn't easy to read and understand. This is suggested by Michael Hocko to improve it.
Suggested-by Michal Hocko <[email protected]>
Signed-off-by "Huang, Ying" <[email protected]>
--- mm/memory.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
mm/memory.c +7 -4
@@ -4507,12 +4507,15 @@ void clear_huge_page(struct page *page,* towards the sub-page to access */ for (i =0 ; i < l; i++) { +int left_idx = base + i; +int right_idx = base +2 * l -1 - i; +cond_resched (); -clear_user_highpage (page + base + i, - addr + (base + i) *PAGE_SIZE ); +clear_user_highpage (page + left_idx, + addr + left_idx *PAGE_SIZE );cond_resched (); -clear_user_highpage (page + base +2 * l -1 - i, - addr + (base +2 * l -1 - i) *PAGE_SIZE ); +clear_user_highpage (page + right_idx, + addr + right_idx *PAGE_SIZE ); } }
Signature · 7 lines
2.13.2 -- 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>