All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Eric Chanudet <echanude@redhat.com>, Mike Rapoport <rppt@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Baoquan He <bhe@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	Yajun Deng <yajun.deng@linux.dev>,
	Zhang Jianhua <chris.zjh@huawei.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Nick Piggin <npiggin@gmail.com>
Subject: Re: [PATCH] arm64: init: override deferred_page_init_max_threads
Date: Wed, 22 May 2024 23:41:07 +1000	[thread overview]
Message-ID: <87plte2ccs.fsf@mail.lhotse> (raw)
In-Reply-To: <xu2rcjwh35zdxx7c52ygep26dox3glnurfcuxuhj3sjqbopzij@zrazmowdb3x2>

Eric Chanudet <echanude@redhat.com> writes:
> On Tue, May 21, 2024 at 07:10:07PM +0300, Mike Rapoport wrote:
>> (added powerpc folks)

Thanks Mike.

>> On Mon, May 20, 2024 at 07:15:59PM -0400, Eric Chanudet wrote:
>> > This was the behavior prior to making the function arch-specific with
>> > commit ecd096506922 ("mm: make deferred init's max threads
>> > arch-specific")
>> > 
>> > Architectures can override the generic implementation that uses only one
>> > CPU. Setting DEFERRED_STRUCT_PAGE_INIT and testing on a few arm64
>> > platforms shows faster deferred_init_memmap completions:
>> > 
>> > |         | x13s        | SA8775p-ride | Ampere R137-P31 | Ampere HR330 |
>> > |         | Metal, 32GB | VM, 36GB     | VM, 58GB        | Metal, 128GB |
>> > |         | 8cpus       | 8cpus        | 8cpus           | 32cpus       |
>> > |---------|-------------|--------------|-----------------|--------------|
>> > | threads |  ms     (%) | ms       (%) |  ms         (%) |  ms      (%) |
>> > |---------|-------------|--------------|-----------------|--------------|
>> > | 1       | 108    (0%) | 72      (0%) | 224        (0%) | 324     (0%) |
>> > | cpus    |  24  (-77%) | 36    (-50%) |  40      (-82%) |  56   (-82%) |

How did you measure this, just some printks in page_alloc_init_late() or
something more sophisticated? Just so I can do some comparable measurements.

>> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> > index 9b5ab6818f7f..71f5188fe63d 100644
>> > --- a/arch/arm64/mm/init.c
>> > +++ b/arch/arm64/mm/init.c
>> > @@ -158,6 +158,13 @@ static void __init zone_sizes_init(void)
>> >  	free_area_init(max_zone_pfns);
>> >  }
>> >  
>> > +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
>> > +int __init deferred_page_init_max_threads(const struct cpumask *node_cpumask)
>> > +{
>> > +	return max_t(int, cpumask_weight(node_cpumask), 1);
>> > +}
>> > +#endif
>> > +
>> 
>> Maybe we should make this default and let architectures that want a single
>> thread override deferred_page_init_max_threads() to return 1?
>
> It would affect more archs than I can try this on. Currently, only x86
> (with this change, arm64) return more than one thread.

I can test powerpc and we can find someone to test s390. No other arches
have it enabled in their defconfig.

> I'm happy to send a v2 inverting the logic if you find it preferable.

That seems preferable. It's a scalability feature, it makes no sense for
the default to be a single thread AFAICS.

cheers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Eric Chanudet <echanude@redhat.com>, Mike Rapoport <rppt@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Baoquan He <bhe@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	Yajun Deng <yajun.deng@linux.dev>,
	Zhang Jianhua <chris.zjh@huawei.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Nick Piggin <npiggin@gmail.com>
Subject: Re: [PATCH] arm64: init: override deferred_page_init_max_threads
Date: Wed, 22 May 2024 23:41:07 +1000	[thread overview]
Message-ID: <87plte2ccs.fsf@mail.lhotse> (raw)
In-Reply-To: <xu2rcjwh35zdxx7c52ygep26dox3glnurfcuxuhj3sjqbopzij@zrazmowdb3x2>

Eric Chanudet <echanude@redhat.com> writes:
> On Tue, May 21, 2024 at 07:10:07PM +0300, Mike Rapoport wrote:
>> (added powerpc folks)

Thanks Mike.

>> On Mon, May 20, 2024 at 07:15:59PM -0400, Eric Chanudet wrote:
>> > This was the behavior prior to making the function arch-specific with
>> > commit ecd096506922 ("mm: make deferred init's max threads
>> > arch-specific")
>> > 
>> > Architectures can override the generic implementation that uses only one
>> > CPU. Setting DEFERRED_STRUCT_PAGE_INIT and testing on a few arm64
>> > platforms shows faster deferred_init_memmap completions:
>> > 
>> > |         | x13s        | SA8775p-ride | Ampere R137-P31 | Ampere HR330 |
>> > |         | Metal, 32GB | VM, 36GB     | VM, 58GB        | Metal, 128GB |
>> > |         | 8cpus       | 8cpus        | 8cpus           | 32cpus       |
>> > |---------|-------------|--------------|-----------------|--------------|
>> > | threads |  ms     (%) | ms       (%) |  ms         (%) |  ms      (%) |
>> > |---------|-------------|--------------|-----------------|--------------|
>> > | 1       | 108    (0%) | 72      (0%) | 224        (0%) | 324     (0%) |
>> > | cpus    |  24  (-77%) | 36    (-50%) |  40      (-82%) |  56   (-82%) |

How did you measure this, just some printks in page_alloc_init_late() or
something more sophisticated? Just so I can do some comparable measurements.

>> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> > index 9b5ab6818f7f..71f5188fe63d 100644
>> > --- a/arch/arm64/mm/init.c
>> > +++ b/arch/arm64/mm/init.c
>> > @@ -158,6 +158,13 @@ static void __init zone_sizes_init(void)
>> >  	free_area_init(max_zone_pfns);
>> >  }
>> >  
>> > +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
>> > +int __init deferred_page_init_max_threads(const struct cpumask *node_cpumask)
>> > +{
>> > +	return max_t(int, cpumask_weight(node_cpumask), 1);
>> > +}
>> > +#endif
>> > +
>> 
>> Maybe we should make this default and let architectures that want a single
>> thread override deferred_page_init_max_threads() to return 1?
>
> It would affect more archs than I can try this on. Currently, only x86
> (with this change, arm64) return more than one thread.

I can test powerpc and we can find someone to test s390. No other arches
have it enabled in their defconfig.

> I'm happy to send a v2 inverting the logic if you find it preferable.

That seems preferable. It's a scalability feature, it makes no sense for
the default to be a single thread AFAICS.

cheers

  reply	other threads:[~2024-05-22 13:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 23:15 [PATCH] arm64: init: override deferred_page_init_max_threads Eric Chanudet
2024-05-20 23:15 ` Eric Chanudet
2024-05-21 14:47 ` Baoquan He
2024-05-21 14:47   ` Baoquan He
2024-05-21 16:10 ` Mike Rapoport
2024-05-21 16:10   ` Mike Rapoport
2024-05-21 22:21   ` Eric Chanudet
2024-05-21 22:21     ` Eric Chanudet
2024-05-22 13:41     ` Michael Ellerman [this message]
2024-05-22 13:41       ` Michael Ellerman
2024-05-22 13:54       ` Eric Chanudet
2024-05-22 13:54         ` Eric Chanudet

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=87plte2ccs.fsf@mail.lhotse \
    --to=mpe@ellerman.id.au \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=chris.zjh@huawei.com \
    --cc=echanude@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@gmail.com \
    --cc=rppt@kernel.org \
    --cc=thunder.leizhen@huawei.com \
    --cc=will@kernel.org \
    --cc=yajun.deng@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.