On 22/05/2024 18:05, Catalin Marinas wrote: > On Wed, May 22, 2024 at 04:52:45PM +0100, Steven Price wrote: >> On 15/05/2024 12:01, Catalin Marinas wrote: >>> On Fri, Apr 12, 2024 at 09:42:11AM +0100, Steven Price wrote: >>>> @@ -3432,7 +3468,16 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, >>>> nr_ites = max(2, nvecs); >>>> sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1); >>>> sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; >>>> - itt = kzalloc_node(sz, GFP_KERNEL, its->numa_node); >>>> + itt_order = get_order(sz); >>>> + page = its_alloc_shared_pages_node(its->numa_node, >>>> + GFP_KERNEL | __GFP_ZERO, >>>> + itt_order); >>> >>> How much do we waste by going for a full page always if this is going to >>> be used on the host? >> >> sz is a minimum of ITS_ITT_ALIGN*2-1 - which is 511 bytes. So >> potentially PAGE_SIZE-512 bytes could be wasted here (minus kmalloc >> overhead). > > That I figured out as well but how many times is this path called with a > size smaller than a page? > That presumably depends on the number of devices in the guest. For my test guest setup (using kvmtool) this is called 3 times each with sz=511. Steve