public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Ryan Roberts <ryan.roberts@arm.com>, linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Dinh Nguyen <dinguyen@kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
	linux-s390@vger.kernel.org, sparclinux@vger.kernel.org
Subject: Re: [PATCH v3 00/15] mm/memory: optimize fork() with PTE-mapped THP
Date: Wed, 31 Jan 2024 14:38:09 +0100	[thread overview]
Message-ID: <c63870b0-690a-4051-b4f5-296cf3b73be2@redhat.com> (raw)
In-Reply-To: <de975655-8f8f-40dc-b281-75c40dd1e2c1@arm.com>

>>> Nope: looks the same. I've taken my test harness out of the picture and done
>>> everything manually from the ground up, with the old tests and the new. Headline
>>> is that I see similar numbers from both.
>>
>> I took me a while to get really reproducible numbers on Intel. Most importantly:
>> * Set a fixed CPU frequency, disabling any boost and avoiding any
>>    thermal throttling.
>> * Pin the test to CPUs and set a nice level.
> 
> I'm already pinning the test to cpu 0. But for M2, at least, I'm running in a VM
> on top of macos, and I don't have a mechanism to pin the QEMU threads to the
> physical CPUs. Anyway, I don't think these are problems because for a given
> kernel build I can accurately repro numbers.

Oh, you do have a layer of virtualization in there. I *suspect* that 
might amplify some odd things regarding code layout, caching effects, etc.

I guess especially the fork() benchmark is too sensible (fast) for 
things like that, so I would just focus on bare metal results where you 
can control the environment completely.

Note that regarding NUMA effects, I mean when some memory access within 
the same socket is faster/slower even with only a single node. On AMD 
EPYC that's possible, depending on which core you are running and on 
which memory controller the memory you want to access is located. If 
both are in different quadrants IIUC, the access latency will be different.

>> But yes: I was observing something similar on AMD EPYC, where you get
>> consecutive pages from the buddy, but once you allocate from the PCP it might no
>> longer be consecutive.
>>
>>>    - test is 5-10% slower when output is printed to terminal vs when redirected to
>>>      file. I've always effectively been redirecting. Not sure if this overhead
>>>      could start to dominate the regression and that's why you don't see it?
>>
>> That's weird, because we don't print while measuring? Anyhow, 5/10% variance on
>> some system is not the end of the world.
> 
> I imagine its cache effects? More work to do to print the output could be
> evicting some code that's in the benchmark path?

Maybe. Do you also see these oddities on the bare metal system?

> 
>>
>>>
>>> I'm inclined to run this test for the last N kernel releases and if the number
>>> moves around significantly, conclude that these tests don't really matter.
>>> Otherwise its an exercise in randomly refactoring code until it works well, but
>>> that's just overfitting to the compiler and hw. What do you think?
>>
>> Personally, I wouldn't lose sleep if you see weird, unexplainable behavior on
>> some system (not even architecture!). Trying to optimize for that would indeed
>> be random refactorings.
>>
>> But I would not be so fast to say that "these tests don't really matter" and
>> then go wild and degrade them as much as you want. There are use cases that care
>> about fork performance especially with order-0 pages -- such as Redis.
> 
> Indeed. But also remember that my fork baseline time is ~2.5ms, and I think you
> said yours was 14ms :)

Yes, no idea why M2 is that fast (BTW, which page size? 4k or 16k? ) :)

> 
> I'll continue to mess around with it until the end of the day. But I'm not
> making any headway, then I'll change tack; I'll just measure the performance of
> my contpte changes using your fork/zap stuff as the baseline and post based on that.

You should likely not focus on M2 results. Just pick a representative 
bare metal machine where you get consistent, explainable results.

Nothing in the code is fine-tuned for a particular architecture so far, 
only order-0 handling is kept separate.

BTW: I see the exact same speedups for dontneed that I see for munmap. 
For example, for order-9, it goes from 0.023412s -> 0.009785, so -58%. 
So I'm curious why you see a speedup for munmap but not for dontneed.

-- 
Cheers,

David / dhildenb


  reply	other threads:[~2024-01-31 13:38 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 12:46 [PATCH v3 00/15] mm/memory: optimize fork() with PTE-mapped THP David Hildenbrand
2024-01-29 12:46 ` [PATCH v3 01/15] arm64/mm: Make set_ptes() robust when OAs cross 48-bit boundary David Hildenbrand
2024-02-08  6:10   ` Mike Rapoport
2024-02-09 22:36     ` David Hildenbrand
2024-01-29 12:46 ` [PATCH v3 02/15] arm/pgtable: define PFN_PTE_SHIFT David Hildenbrand
2024-02-08  6:11   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 03/15] nios2/pgtable: " David Hildenbrand
2024-02-08  6:12   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 04/15] powerpc/pgtable: " David Hildenbrand
2024-02-08  6:13   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 05/15] riscv/pgtable: " David Hildenbrand
2024-02-08  6:14   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 06/15] s390/pgtable: " David Hildenbrand
2024-02-08  6:15   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 07/15] sparc/pgtable: " David Hildenbrand
2024-02-08  6:18   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 08/15] mm/pgtable: make pte_next_pfn() independent of set_ptes() David Hildenbrand
2024-02-08  6:19   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 09/15] arm/mm: use pte_next_pfn() in set_ptes() David Hildenbrand
2024-02-08  6:20   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 10/15] powerpc/mm: " David Hildenbrand
2024-02-08  6:20   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 11/15] mm/memory: factor out copying the actual PTE in copy_present_pte() David Hildenbrand
2024-02-08  6:29   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 12/15] mm/memory: pass PTE to copy_present_pte() David Hildenbrand
2024-02-08  6:27   ` Mike Rapoport
2024-02-14 22:40   ` David Hildenbrand
2024-01-29 12:46 ` [PATCH v3 13/15] mm/memory: optimize fork() with PTE-mapped THP David Hildenbrand
2024-02-08  6:41   ` Mike Rapoport
2024-01-29 12:46 ` [PATCH v3 14/15] mm/memory: ignore dirty/accessed/soft-dirty bits in folio_pte_batch() David Hildenbrand
2024-01-29 12:46 ` [PATCH v3 15/15] mm/memory: ignore writable bit " David Hildenbrand
2024-01-31 10:43 ` [PATCH v3 00/15] mm/memory: optimize fork() with PTE-mapped THP Ryan Roberts
2024-01-31 11:06   ` David Hildenbrand
2024-01-31 11:16     ` Ryan Roberts
2024-01-31 11:28       ` David Hildenbrand
2024-01-31 11:49         ` Ryan Roberts
2024-01-31 12:37           ` Ryan Roberts
2024-01-31 12:56             ` David Hildenbrand
2024-01-31 13:16               ` Ryan Roberts
2024-01-31 13:38                 ` David Hildenbrand [this message]
2024-01-31 13:58                   ` Ryan Roberts
2024-01-31 14:29                     ` David Hildenbrand
2024-01-31 15:02                       ` Ryan Roberts
2024-01-31 15:05                         ` David Hildenbrand
2024-01-31 15:08                           ` Ryan Roberts
2024-01-31 15:11                             ` David Hildenbrand
2024-01-31 12:59           ` David Hildenbrand
2024-03-25  4:42 ` patchwork-bot+linux-riscv

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=c63870b0-690a-4051-b4f5-296cf3b73be2@redhat.com \
    --to=david@redhat.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=borntraeger@linux.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=dinguyen@kernel.org \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=ryan.roberts@arm.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    /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