Skip to content

Commit 7f3f227

Browse files
vittyvkliuw
authored andcommitted
hv_balloon: simplify math in alloc_balloon_pages()
'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]>
1 parent 5c641fe commit 7f3f227

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hv/hv_balloon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm,
12381238
split_page(pg, get_order(alloc_unit << PAGE_SHIFT));
12391239

12401240
/* mark all pages offline */
1241-
for (j = 0; j < (1 << get_order(alloc_unit << PAGE_SHIFT)); j++)
1241+
for (j = 0; j < alloc_unit; j++)
12421242
__SetPageOffline(pg + j);
12431243

12441244
bl_resp->range_count++;

0 commit comments

Comments
 (0)