From: Andrew Morton <akpm@linux-foundation.org>
To: Alexander Halbuer <halbuer@sra.uni-hannover.de>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Vlastimil Babka <vbabka@suse.cz>,
Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [PATCH] mm: reduce lock contention of pcp buffer refill
Date: Thu, 2 Feb 2023 15:25:01 -0800 [thread overview]
Message-ID: <20230202152501.297639031e96baad35cdab17@linux-foundation.org> (raw)
In-Reply-To: <20230201162549.68384-1-halbuer@sra.uni-hannover.de>
On Wed, 1 Feb 2023 17:25:49 +0100 Alexander Halbuer <halbuer@sra.uni-hannover.de> wrote:
> The `rmqueue_bulk` function 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 the `check_pcp_refill` function.
> 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 the `rmqueue_buddy` function 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.
Sounds nice.
Were you able to test how much benefit we get by simply removing the
check_new_pages() call from rmqueue_bulk()?
Vlastimil, I find this quite confusing:
#ifdef CONFIG_DEBUG_VM
/*
* With DEBUG_VM enabled, order-0 pages are checked for expected state when
* being allocated from pcp lists. With debug_pagealloc also enabled, they are
* also checked when pcp lists are refilled from the free lists.
*/
static inline bool check_pcp_refill(struct page *page, unsigned int order)
{
if (debug_pagealloc_enabled_static())
return check_new_pages(page, order);
else
return false;
}
static inline bool check_new_pcp(struct page *page, unsigned int order)
{
return check_new_pages(page, order);
}
#else
/*
* With DEBUG_VM disabled, free order-0 pages are checked for expected state
* when pcp lists are being refilled from the free lists. With debug_pagealloc
* enabled, they are also checked when being allocated from the pcp lists.
*/
static inline bool check_pcp_refill(struct page *page, unsigned int order)
{
return check_new_pages(page, order);
}
static inline bool check_new_pcp(struct page *page, unsigned int order)
{
if (debug_pagealloc_enabled_static())
return check_new_pages(page, order);
else
return false;
}
#endif /* CONFIG_DEBUG_VM */
and the 4462b32c9285b5 changelog is a struggle to follow.
Why are we performing *any* checks when CONFIG_DEBUG_VM=n and when
debug_pagealloc_enabled is false?
Anyway, these checks sounds quite costly so let's revisit their
desirability?
next prev parent reply other threads:[~2023-02-02 23:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 16:25 [PATCH] mm: reduce lock contention of pcp buffer refill Alexander Halbuer
2023-02-02 23:25 ` Andrew Morton [this message]
2023-02-07 16:11 ` Alexander Halbuer
2023-02-08 15:11 ` Vlastimil Babka
2023-02-09 10:34 ` Alexander Halbuer
2023-02-08 10:45 ` Vlastimil Babka
2023-02-14 17:27 ` Kees Cook
2023-02-08 15:20 ` Vlastimil Babka
2023-03-29 9:31 ` Mel Gorman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230202152501.297639031e96baad35cdab17@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=halbuer@sra.uni-hannover.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).