]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: reduce lock contention of pcp buffer refill
authorAlexander Halbuer <halbuer@sra.uni-hannover.de>
Wed, 1 Feb 2023 16:25:49 +0000 (17:25 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 10 Feb 2023 23:36:08 +0000 (15:36 -0800)
commiteef0f8a292753f40101df7b581de77303b4ac434
treeb68b2c3f052a4cc43b8b64f24e264473b866ccbf
parentd9a0956908217cfd866d1b6e1e7dd14c25921519
mm: reduce lock contention of pcp buffer refill

rmqueue_bulk() batches the allocation of multiple elements to refill the
per-CPU buffers into a single hold of the zone lock.  Each element is
allocated and checked using check_pcp_refill().  The check touches every
related struct page which is especially expensive for higher order
allocations (huge pages).

This patch reduces the time holding the lock by moving the check out of
the critical section similar to rmqueue_buddy() which allocates a single
element.

Measurements of parallel allocation-heavy workloads show a reduction of
the average huge page allocation latency of 50 percent for two cores and
nearly 90 percent for 24 cores.

Link: https://lkml.kernel.org/r/20230201162549.68384-1-halbuer@sra.uni-hannover.de
Signed-off-by: Alexander Halbuer <halbuer@sra.uni-hannover.de>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c