hw:mem_page_size Works on Flavors, hw_mem_page_size Doesn't Works on Image

Javier Charne javier at charne.info
Mon Feb 13 19:58:53 UTC 2023


Hello!
I have a question related to flavor:hw_mem_page_size.


I already set a property on flavor m2.medium:

$ openstack flavor set m2.medium --property hw:mem_page_size=2MB

and configured grub on every nova compute node, because we want all 
instances with 2MB pages:

GRUB_CMDLINE_LINUX_DEFAULT="hugepagesz=2MB hugepages=740642 
transparent_hugepage=never"



Now, when I created a new instance, it tooks persistent HugePages.

$ nova show IDxxx
...

| flavor:extra_specs                   | {"hw:mem_page_size": "2MB"}
| flavor:original_name                 | m2.medium
| flavor:ram                           | 4096

...


But in old created instances,  with the same flavor (but before adjust 
the metadata on flavor), the flavor:extra_spec remains empty. So, the 
instance tries to boot with normal (4K) pages...

I can resize the instance to a "new" flavor, but I ask:
Is there a command to change the property on created server? So, I can 
stop and restart instance, and it will take persistent hugepages.

I tried with the command:
$ openstack server set --property 
flavor:extra_specs='{"hw:mem_page_size":"2MB"}' SERVERID
without success...

Is there a workaround to avoid the resize of all the instances already 
created?

Thanks in advance!

Javier.-




El 13/2/23 a las 11:27, Sean Mooney escribió:
> On Mon, 2023-02-13 at 21:21 +0700, Lazuardi Nasution wrote:
>> Hi Sean,
>>
>> Thank you for your explanation. I want to use the 2MB hugepage. So, do you
>> mean that I have to put hw:mem_page_size=large on used flavor and
>> hw_mem_page_size=2MB used image? What is the difference with current
>> hw:mem_page_size=2MB on used flavor only?
> in general we recomend agains using explict page size unless required after extensive performance testing
>
> so generally i would just suggest using hw:mem_page_size=large in the flaovr.
>
> if you need to use exiplcit page size for a specifc VNF we advise that you set hw_mem_page_size=2MB
> on the image.
>
> That way if you hae 1 flavor with hw:mem_page_size=large and 3 images one with hw_mem_page_size=2MB
> another with hw_mem_page_size=1G and a third with hw_mem_page_size not set all 3 images can use the same
> flavor.
>
> you should prefer to keep the flaovrs generic by using hw_mem_page_size=large|small|any and only set explict page
> zises in the images that need that granularity.
>
> you can set explcit pages sizes in the flavor too but it leasds to a combinitorial flavor explostion and is gernerally
> required. in 90% of cases hw:mem_page_size=large in the flavor is all that is requried.
>> Best regards.
>>
>> On Mon, Feb 13, 2023 at 8:45 PM Sean Mooney <smooney at redhat.com> wrote:
>>
>>> On Mon, 2023-02-13 at 18:22 +0700, Lazuardi Nasution wrote:
>>>> Hi,
>>>>
>>>> There is a weird situation if it is not a bug.
>>>>
>>> Its not a bug
>>>
>>> hw_mem_page_size can be used in the image only if
>>> hw:mem_page_size=larage or  hw:mem_page_size=any
>>>
>>> in the case of  hw:mem_page_size=large the image can be used to choose a
>>> speccific hugepage size
>>>
>>> hw:mem_page_size=large  hw_mem_page_size=1G
>>>
>>> hw:mem_page_size=any will by default be the same as hw:mem_page_size=small
>>> and use the smallest pagezise
>>> which is typically 4k. the differnece bettwen hw:mem_page_size=any and
>>> hw:mem_page_size=small is
>>> hw:mem_page_size=any allows the image to set any value for
>>> hw_mem_page_size.
>>> so
>>> hw:mem_page_size=any and hw_mem_page_size=large is valid where as
>>> hw:mem_page_size=small and hw_mem_page_size=large is not and will raise an
>>> error.
>>>
>>> when hugepage support was added it was decided that permission form the
>>> operator was required
>>> to allow you to request hugepages via the image which is why the flavor
>>> must have and hw_mem_page_size=large|any
>>> set.
>>>
>>>>   Hugepage instance launching
>>>> is working if I put hw:mem_page_size on the used flavor. But, when I try
>>>> the same launching configuration and change hw:mem_page_size on used
>>> flavor
>>>> to hw_mem_page_size on used image, it cannot work as expected. It seems
>>>> that this issue is like on
>>>> https://bugzilla.redhat.com/show_bug.cgi?id=1791132, but it still
>>> happens
>>>> on Zed. Is this an old bug? Should I submit a bug report for this?
>>> no we cloased https://bugzilla.redhat.com/show_bug.cgi?id=1791132 as not
>>> a bug because they were not aware of this requriement.
>>>> Best regards.
>>>
>




More information about the openstack-discuss mailing list