• Huang Ying's avatar
    mm, page_alloc: scale the number of pages that are batch allocated · c0a24239
    Huang Ying authored
    When a task is allocating a large number of order-0 pages, it may acquire
    the zone->lock multiple times allocating pages in batches.  This may
    unnecessarily contend on the zone lock when allocating very large number
    of pages.  This patch adapts the size of the batch based on the recent
    pattern to scale the batch size for subsequent allocations.
    
    On a 2-socket Intel server with 224 logical CPU, we run 8 kbuild instances
    in parallel (each with `make -j 28`) in 8 cgroup.  This simulates the
    kbuild server that is used by 0-Day kbuild service.  With the patch, the
    cycles% of the spinlock contention (mostly for zone lock) decreases from
    12.6% to 11.0% (with PCP size == 367).
    
    Link: https://lkml.kernel.org/r/20231016053002.756205-6-ying.huang@intel.comSigned-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
    Suggested-by: default avatarMel Gorman <mgorman@techsingularity.net>
    Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Johannes Weiner <jweiner@redhat.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Arjan van de Ven <arjan@linux.intel.com>
    Cc: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    c0a24239
page_alloc.c 187 KB