Jeff,

On Mon, Jan 06, 2020 at 02:51:19AM +0000, Jeff Roberson wrote:
J> Modified: head/sys/vm/vm_page.c
J> 
==============================================================================
J> --- head/sys/vm/vm_page.c    Mon Jan  6 01:51:23 2020        (r356392)
J> +++ head/sys/vm/vm_page.c    Mon Jan  6 02:51:19 2020        (r356393)
J> @@ -613,10 +613,17 @@ vm_page_startup(vm_offset_t vaddr)
J>          slab_ipers(sizeof(struct vm_map), UMA_ALIGN_PTR));
J>  
J>      /*
J> -     * Before going fully functional kmem_init() does allocation
J> -     * from "KMAP ENTRY" and vmem_create() does allocation from "vmem".
J> +     * Before we are fully boot strapped we need to account for the
J> +     * following allocations:
J> +     *
J> +     * "KMAP ENTRY" from kmem_init()
J> +     * "vmem btag" from vmem_startup()
J> +     * "vmem" from vmem_create()
J> +     * "KMAP" from vm_map_startup()
J> +     *
J> +     * Each needs at least one page per-domain.
J>       */
J> -    boot_pages += 2;
J> +    boot_pages += 4 * vm_ndomains;
J>  #endif
J>      /*
J>       * CTFLAG_RDTUN doesn't work during the early boot process, so we must

I think this chunk brings many extraneous pages per domain. Allocations
for "vmem btag" from vmem_startup() are covered by vmem_startup_count(),
and allocations for "KMAP" from vm_map_startup() are also counted just a
few lines above:

        /* vmem_startup() calls uma_prealloc(). */
        boot_pages += vmem_startup_count();
        /* vm_map_startup() calls uma_prealloc(). */
        boot_pages += howmany(MAX_KMAP,
            slab_ipers(sizeof(struct vm_map), UMA_ALIGN_PTR));

The uma_prealloc() allocates as much memory as asked, it may not populate
all domains. So, on NUMA it will allocate same amount of pages. Not sure
if this is a right decision, but at lease the counting is correct. So, change
from 2 pages to 4 isn't needed.

The vm_ndomains multiplicator also seems incorrect, since at early stage
we run with buckets disabled, and this single allocation will end with
calling zone_alloc_item() calling zone_import() with count of 1, which
will short-circuit into keg_fetch_slab() before entering domain aware code.
Then keg_fetch_slab() will short circuit into startup_alloc().

Do machines with NUMA and lack of UMA_MD_SMALL_ALLOC exist? Interesting
to see dmesg with DIAGNOSTIC and this change.

-- 
Gleb Smirnoff
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to