From: David Hildenbrand <david@redhat.com>
To: Michael Kelley <mhklinux@outlook.com>,
"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"decui@microsoft.com" <decui@microsoft.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>
Subject: Re: [PATCH 1/1] hv_balloon: Enable hot-add for memblock sizes > 128 Mbytes
Date: Tue, 30 Apr 2024 10:52:50 +0200 [thread overview]
Message-ID: <c911ab92-1bec-4e5d-9bc8-5a6044f4948b@redhat.com> (raw)
In-Reply-To: <SN6PR02MB4157D5BB1C140D229875AB50D41B2@SN6PR02MB4157.namprd02.prod.outlook.com>
On 29.04.24 17:30, Michael Kelley wrote:
> From: Michael Kelley <mhklinux@outlook.com> Sent: Friday, April 26, 2024 9:36 AM
>>>> @@ -505,8 +505,9 @@ enum hv_dm_state {
>>>>
>>>> static __u8 recv_buffer[HV_HYP_PAGE_SIZE];
>>>> static __u8 balloon_up_send_buffer[HV_HYP_PAGE_SIZE];
>>>> +static unsigned long ha_chunk_pgs;
>>>
>>> Why not stick to PAGES_IN_2M and call this
>>>
>>> ha_pages_in_chunk? Much easier to get than "pgs".
>>
>> OK. I was trying to keep the new identifier short so that
>> mechanically substituting it for HA_CHUNK didn't blow up
>> the line length.
>>
>>>
>>> Apart from that looks good. Some helper macros to convert size to chunks
>>> etc. might make the code even more readable.
>>
>> I'll look at this. Might help the line length problem too.
>>
>
> I didn't see any particular complexity in converting size to chunks. But
> this slightly opaque sequence is repeated in three places:
>
> new_inc = (residual / HA_CHUNK) * HA_CHUNK;
> if (residual % HA_CHUNK)
> new_inc += HA_CHUNK;
>
> If HA_CHUNK (or the new memblock size based variable) is a
> power of 2, then these can become:
>
> new_inc = ALIGN(residual, HA_CHUNK);
>
> which is a lot better. I'll make that change, and a couple of other
> changes where things are open coded that could be existing
> kernel macros.
Cool! Make sure to CC me on v2.
>
> Question: Is memblock size guaranteed to be a power of 2? It looks
> to be so in the x86 code, but I can't tell on s390 and ppc. For safety,
> I'll add a check in the Hyper-V balloon driver init code, as the
> communication with Hyper-V expects a power of 2.
Yes, in memory_dev_init() we make sure that the size is a power of 2,
and if it is not, we would panic().
--
Cheers,
David / dhildenb
prev parent reply other threads:[~2024-04-30 8:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 18:12 [PATCH 1/1] hv_balloon: Enable hot-add for memblock sizes > 128 Mbytes mhkelley58
2024-04-25 14:31 ` Michael Kelley
2024-04-26 8:58 ` David Hildenbrand
2024-04-26 16:35 ` Michael Kelley
2024-04-29 15:30 ` Michael Kelley
2024-04-30 8:52 ` David Hildenbrand [this message]
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=c911ab92-1bec-4e5d-9bc8-5a6044f4948b@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=mhklinux@outlook.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.