From: Nicolas Saenz Julienne <nsaenzju@redhat.com>
To: Mel Gorman <mgorman@techsingularity.net>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>,
Michal Hocko <mhocko@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH 5/6] mm/page_alloc: Protect PCP lists with a spinlock
Date: Fri, 13 May 2022 14:22:28 +0200 [thread overview]
Message-ID: <400f896ae17c66f9f68d9b5f248c13cd5ece6158.camel@redhat.com> (raw)
In-Reply-To: <20220512085043.5234-6-mgorman@techsingularity.net>
On Thu, 2022-05-12 at 09:50 +0100, Mel Gorman wrote:
> Currently the PCP lists are protected by using local_lock_irqsave to
> prevent migration and IRQ reentrancy but this is inconvenient. Remote
> draining of the lists is impossible and a workqueue is required and
> every task allocation/free must disable then enable interrupts which
> is
> expensive.
>
> As preparation for dealing with both of those problems, protect the
> lists with a spinlock. The IRQ-unsafe version of the lock is used
> because IRQs are already disabled by local_lock_irqsave. spin_trylock
> is used in preparation for a time when local_lock could be used
> instead
> of lock_lock_irqsave.
>
> The per_cpu_pages still fits within the same number of cache lines
> after
> this patch relative to before the series.
>
> struct per_cpu_pages {
> spinlock_t lock; /* 0
> 4 */
> int count; /* 4
> 4 */
> int high; /* 8
> 4 */
> int batch; /* 12
> 4 */
> short int free_factor; /* 16
> 2 */
> short int expire; /* 18
> 2 */
>
> /* XXX 4 bytes hole, try to pack */
>
> struct list_head lists[13]; /* 24
> 208 */
>
> /* size: 256, cachelines: 4, members: 7 */
> /* sum members: 228, holes: 1, sum holes: 4 */
> /* padding: 24 */
> } __attribute__((__aligned__(64)));
>
> There is overhead in the fast path due to acquiring the spinlock even
> though the spinlock is per-cpu and uncontended in the common case.
> Page
> Fault Test (PFT) running on a 1-socket reported the following results
> on
> a 1 socket machine.
>
> 5.18.0-rc1 5.18.0-
> rc1
> vanilla mm-pcpdrain-
> v2r1
> Hmean faults/sec-1 886331.5718 ( 0.00%) 885462.7479 ( -
> 0.10%)
> Hmean faults/sec-3 2337706.1583 ( 0.00%) 2332130.4909 * -
> 0.24%*
> Hmean faults/sec-5 2851594.2897 ( 0.00%) 2844123.9307 ( -
> 0.26%)
> Hmean faults/sec-7 3543251.5507 ( 0.00%) 3516889.0442 * -
> 0.74%*
> Hmean faults/sec-8 3947098.0024 ( 0.00%) 3916162.8476 * -
> 0.78%*
> Stddev faults/sec-1 2302.9105 ( 0.00%) 2065.0845 (
> 10.33%)
> Stddev faults/sec-3 7275.2442 ( 0.00%) 6033.2620 (
> 17.07%)
> Stddev faults/sec-5 24726.0328 ( 0.00%) 12525.1026 (
> 49.34%)
> Stddev faults/sec-7 9974.2542 ( 0.00%) 9543.9627 (
> 4.31%)
> Stddev faults/sec-8 9468.0191 ( 0.00%) 7958.2607 (
> 15.95%)
> CoeffVar faults/sec-1 0.2598 ( 0.00%) 0.2332 (
> 10.24%)
> CoeffVar faults/sec-3 0.3112 ( 0.00%) 0.2587 (
> 16.87%)
> CoeffVar faults/sec-5 0.8670 ( 0.00%) 0.4404 (
> 49.21%)
> CoeffVar faults/sec-7 0.2815 ( 0.00%) 0.2714 (
> 3.60%)
> CoeffVar faults/sec-8 0.2399 ( 0.00%) 0.2032 (
> 15.28%)
>
> There is a small hit in the number of faults per second but given
> that
> the results are more stable, it's borderline noise.
>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> Tested-by: Minchan Kim <minchan@kernel.org>
> Acked-by: Minchan Kim <minchan@kernel.org>
> ---
Reviewed-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Thanks,
--
Nicolás Sáenz
next prev parent reply other threads:[~2022-05-13 12:22 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 8:50 [PATCH 0/6] Drain remote per-cpu directly v3 Mel Gorman
2022-05-12 8:50 ` [PATCH 1/6] mm/page_alloc: Add page->buddy_list and page->pcp_list Mel Gorman
2022-05-13 11:59 ` Nicolas Saenz Julienne
2022-05-19 9:36 ` Vlastimil Babka
2022-05-12 8:50 ` [PATCH 2/6] mm/page_alloc: Use only one PCP list for THP-sized allocations Mel Gorman
2022-05-19 9:45 ` Vlastimil Babka
2022-05-12 8:50 ` [PATCH 3/6] mm/page_alloc: Split out buddy removal code from rmqueue into separate helper Mel Gorman
2022-05-13 12:01 ` Nicolas Saenz Julienne
2022-05-19 9:52 ` Vlastimil Babka
2022-05-23 16:09 ` Qais Yousef
2022-05-24 11:55 ` Mel Gorman
2022-05-25 11:23 ` Qais Yousef
2022-05-12 8:50 ` [PATCH 4/6] mm/page_alloc: Remove unnecessary page == NULL check in rmqueue Mel Gorman
2022-05-13 12:03 ` Nicolas Saenz Julienne
2022-05-19 10:57 ` Vlastimil Babka
2022-05-19 12:13 ` Mel Gorman
2022-05-19 12:26 ` Vlastimil Babka
2022-05-12 8:50 ` [PATCH 5/6] mm/page_alloc: Protect PCP lists with a spinlock Mel Gorman
2022-05-13 12:22 ` Nicolas Saenz Julienne [this message]
2022-05-12 8:50 ` [PATCH 6/6] mm/page_alloc: Remotely drain per-cpu lists Mel Gorman
2022-05-12 19:37 ` Andrew Morton
2022-05-13 15:04 ` Mel Gorman
2022-05-13 15:19 ` Nicolas Saenz Julienne
2022-05-13 18:23 ` Mel Gorman
2022-05-17 12:57 ` Mel Gorman
2022-05-12 19:43 ` [PATCH 0/6] Drain remote per-cpu directly v3 Andrew Morton
2022-05-13 14:23 ` Mel Gorman
2022-05-13 19:38 ` Andrew Morton
2022-05-16 10:53 ` Mel Gorman
2022-05-13 12:24 ` Nicolas Saenz Julienne
2022-05-17 23:35 ` Qian Cai
2022-05-18 12:51 ` Mel Gorman
2022-05-18 16:27 ` Qian Cai
2022-05-18 17:15 ` Paul E. McKenney
2022-05-19 13:29 ` Qian Cai
2022-05-19 19:15 ` Paul E. McKenney
2022-05-19 21:05 ` Qian Cai
2022-05-19 21:29 ` Paul E. McKenney
2022-05-18 17:26 ` Marcelo Tosatti
2022-05-18 17:44 ` Marcelo Tosatti
2022-05-18 18:01 ` Nicolas Saenz Julienne
2022-05-26 17:19 ` Qian Cai
2022-05-27 8:39 ` Mel Gorman
2022-05-27 12:58 ` Qian Cai
-- strict thread matches above, loose matches on Subject: below --
2022-05-09 13:07 [RFC PATCH 0/6] Drain remote per-cpu directly v2 Mel Gorman
2022-05-09 13:08 ` [PATCH 5/6] mm/page_alloc: Protect PCP lists with a spinlock Mel Gorman
2022-05-22 2:49 ` Hugh Dickins
2022-05-24 12:12 ` Mel Gorman
2022-05-24 12:19 ` Mel Gorman
2022-04-20 9:59 [RFC PATCH 0/6] Drain remote per-cpu directly Mel Gorman
2022-04-20 9:59 ` [PATCH 5/6] mm/page_alloc: Protect PCP lists with a spinlock Mel Gorman
2022-04-26 16:42 ` Nicolas Saenz Julienne
2022-04-26 16:48 ` Vlastimil Babka
2022-04-29 9:13 ` Mel Gorman
2022-04-26 19:24 ` Minchan Kim
2022-04-29 9:05 ` Mel Gorman
[not found] ` <20220420140214.2330-1-hdanton@sina.com>
2022-04-20 14:35 ` Nicolas Saenz Julienne
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=400f896ae17c66f9f68d9b5f248c13cd5ece6158.camel@redhat.com \
--to=nsaenzju@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=mtosatti@redhat.com \
--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).