]> Git Repo - linux.git/commitdiff
hv_balloon: simplify math in alloc_balloon_pages()
authorVitaly Kuznetsov <[email protected]>
Wed, 2 Dec 2020 16:12:44 +0000 (17:12 +0100)
committerWei Liu <[email protected]>
Sun, 13 Dec 2020 15:06:05 +0000 (15:06 +0000)
'alloc_unit' in alloc_balloon_pages() is either '512' for 2M allocations or
'1' for 4k allocations. So

1 << get_order(alloc_unit << PAGE_SHIFT)

equals to 'alloc_unit' and the for loop basically sets all them offline.
Simplify the math to improve the readability.

Signed-off-by: Vitaly Kuznetsov <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Wei Liu <[email protected]>
drivers/hv/hv_balloon.c

index eb56e09ae15f3999478b0e75f601836c92ad175a..da3b6bd2367c8916b07fceae85ce70ea21c06311 100644 (file)
@@ -1238,7 +1238,7 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm,
                        split_page(pg, get_order(alloc_unit << PAGE_SHIFT));
 
                /* mark all pages offline */
-               for (j = 0; j < (1 << get_order(alloc_unit << PAGE_SHIFT)); j++)
+               for (j = 0; j < alloc_unit; j++)
                        __SetPageOffline(pg + j);
 
                bl_resp->range_count++;
This page took 0.089129 seconds and 4 git commands to generate.