[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47b49c1a-6ea9-9b86-e08c-bb6915d79ea2@redhat.com>
Date: Thu, 3 Dec 2020 17:15:04 +0100
From: David Hildenbrand <david@...hat.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>,
linux-hyperv@...r.kernel.org
Cc: Wei Liu <wei.liu@...nel.org>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Michael Kelley <mikelley@...rosoft.com>,
Dexuan Cui <decui@...rosoft.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 1/2] hv_balloon: simplify math in alloc_balloon_pages()
On 02.12.20 17:12, Vitaly Kuznetsov wrote:
> '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 <vkuznets@...hat.com>
> ---
> drivers/hv/hv_balloon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index eb56e09ae15f..da3b6bd2367c 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -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++;
>
Right, alloc_unit is multiples of 4k pages, such that it can directly be
used for page ranges in deflation/inflation paths.
Reviewed-by: David Hildenbrand <david@...hat.com>
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists