From: "Nico Boehr" <nrb@linux.ibm.com>
To: "Christoph Schlameuss" <schlameuss@linux.ibm.com>,
"Janosch Frank" <frankja@linux.ibm.com>, <kvm@vger.kernel.org>
Cc: <linux-s390@vger.kernel.org>, <imbrenda@linux.ibm.com>,
<borntraeger@linux.ibm.com>, <nrb@linux.ibm.com>
Subject: Re: [kvm-unit-tests PATCH v2 2/4] lib: s390x: sie: Allocate physical guest memory via memalign
Date: Wed, 22 Apr 2026 08:04:31 +0200 [thread overview]
Message-ID: <DHZGGHFIB3HM.23YH58OREC8WD@linux.ibm.com> (raw)
In-Reply-To: <DHYXKO2IPF13.1SJ3D8S49W7BZ@linux.ibm.com>
On Tue Apr 21, 2026 at 5:16 PM CEST, Christoph Schlameuss wrote:
> On Mon Apr 20, 2026 at 10:44 AM CEST, Janosch Frank wrote:
>> alloc_pages_flags() alignes the allocation on the same order as its
>> requested size. Since we use virtual memory for SIE we can instead
>> align to 1MB by using memalign() which is less wasteful.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>> lib/s390x/sie.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
>> index 47d4cdde..b1b0a8a0 100644
>> --- a/lib/s390x/sie.c
>> +++ b/lib/s390x/sie.c
>> @@ -171,7 +171,8 @@ uint8_t *sie_guest_alloc(uint64_t guest_size)
>> guest_virt = (uint8_t *)ALIGN(get_ram_size() + guest_counter * 4UL * SZ_1G, SZ_2G);
>> guest_counter++;
>>
>> - guest_phys = alloc_pages(get_order(guest_size) - 12);
>> + guest_phys = memalign_pages_flags(SZ_1M, guest_size, 0);
>
> There is a const for that:
>
> guest_phys = memalign_pages_flags(SZ_1M, guest_size, AREA_ANY);
Or just
guest_phys = memalign_pages(SZ_1M, guest_size);
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
next prev parent reply other threads:[~2026-04-22 6:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 8:44 [kvm-unit-tests PATCH v2 0/4] s390x: Cleanup virtualization library Janosch Frank
2026-04-20 8:44 ` [kvm-unit-tests PATCH v2 1/4] lib: s390x: Add function to get page root Janosch Frank
2026-04-21 15:12 ` Christoph Schlameuss
2026-04-22 6:02 ` Nico Boehr
2026-04-20 8:44 ` [kvm-unit-tests PATCH v2 2/4] lib: s390x: sie: Allocate physical guest memory via memalign Janosch Frank
2026-04-21 15:16 ` Christoph Schlameuss
2026-04-21 15:31 ` Christoph Schlameuss
2026-04-22 6:04 ` Nico Boehr [this message]
2026-04-20 8:44 ` [kvm-unit-tests PATCH v2 3/4] lib: s390x: sie: Memory rework Janosch Frank
2026-04-21 15:25 ` Christoph Schlameuss
2026-04-20 8:44 ` [kvm-unit-tests PATCH v2 4/4] lib: s390x: snippet: Add function to create a guest of specific length Janosch Frank
2026-04-21 15:30 ` Christoph Schlameuss
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=DHZGGHFIB3HM.23YH58OREC8WD@linux.ibm.com \
--to=nrb@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=schlameuss@linux.ibm.com \
/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.