All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>, linux-hyperv@vger.kernel.org
Cc: Wei Liu <wei.liu@kernel.org>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Michael Kelley <mikelley@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/2] hv_balloon: simplify math in alloc_balloon_pages()
Date: Thu, 3 Dec 2020 17:15:04 +0100	[thread overview]
Message-ID: <47b49c1a-6ea9-9b86-e08c-bb6915d79ea2@redhat.com> (raw)
In-Reply-To: <20201202161245.2406143-2-vkuznets@redhat.com>

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@redhat.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@redhat.com>

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2020-12-03 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 16:12 [PATCH 0/2] hv_balloon: hide ballooned out memory in stats Vitaly Kuznetsov
2020-12-02 16:12 ` [PATCH 1/2] hv_balloon: simplify math in alloc_balloon_pages() Vitaly Kuznetsov
2020-12-03 16:15   ` David Hildenbrand [this message]
2020-12-02 16:12 ` [PATCH 2/2] hv_balloon: do adjust_managed_page_count() when ballooning/un-ballooning Vitaly Kuznetsov
2020-12-03 16:13   ` David Hildenbrand
2020-12-03 17:49     ` Vitaly Kuznetsov
2020-12-03 17:49       ` David Hildenbrand
2020-12-09 13:17 ` [PATCH 0/2] hv_balloon: hide ballooned out memory in stats Wei Liu
2020-12-13 15:07   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47b49c1a-6ea9-9b86-e08c-bb6915d79ea2@redhat.com \
    --to=david@redhat.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mikelley@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.