[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YpPYkzbrQmy4FjrI@osiris>
Date: Sun, 29 May 2022 22:33:23 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Peter Xu <peterx@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Will Deacon <will@...nel.org>,
Matt Turner <mattst88@...il.com>, linux-s390@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Brian Cain <bcain@...cinc.com>, Borislav Petkov <bp@...en8.de>,
linux-alpha@...r.kernel.org, Alistair Popple <apopple@...dia.com>,
Jonas Bonn <jonas@...thpole.se>,
linux-arm-kernel@...ts.infradead.org, linux-ia64@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
linux-snps-arc@...ts.infradead.org,
Vineet Gupta <vgupta@...nel.org>,
Vasily Gorbik <gor@...ux.ibm.com>,
Vlastimil Babka <vbabka@...e.cz>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Rich Felker <dalias@...c.org>, sparclinux@...r.kernel.org,
Russell King <linux@...linux.org.uk>,
David Hildenbrand <david@...hat.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Nicholas Piggin <npiggin@...il.com>,
"James E . J . Bottomley" <James.Bottomley@...senpartnership.com>,
linux-xtensa@...ux-xtensa.org, linux-sh@...r.kernel.org,
Paul Walmsley <paul.walmsley@...ive.com>,
linux-m68k@...ts.linux-m68k.org, linuxppc-dev@...ts.ozlabs.org,
Richard Henderson <rth@...ddle.net>,
Guo Ren <guoren@...nel.org>, linux-parisc@...r.kernel.org,
Andrea Arcangeli <aarcange@...hat.com>,
Helge Deller <deller@....de>,
Al Viro <viro@...iv.linux.org.uk>,
Albert Ou <aou@...s.berkeley.edu>,
linux-um@...ts.infradead.org, "H . Peter Anvin" <hpa@...or.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
openrisc@...ts.librecores.org,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
linux-hexagon@...r.kernel.org, Andy Lutomirski <luto@...nel.org>,
Stafford Horne <shorne@...il.com>, linux-csky@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
linux-mips@...r.kernel.org, Paul Mackerras <paulus@...ba.org>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Dinh Nguyen <dinguyen@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>,
"David S . Miller" <davem@...emloft.net>,
Johannes Weiner <hannes@...xchg.org>,
Hugh Dickins <hughd@...gle.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-riscv@...ts.infradead.org, Max Filippov <jcmvbkbc@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Johannes Berg <johannes@...solutions.net>,
Chris Zankel <chris@...kel.net>,
Michal Simek <monstr@...str.eu>, x86@...nel.org,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Richard Weinberger <richard@....at>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared
memory types
On Fri, May 27, 2022 at 03:39:36PM -0400, Peter Xu wrote:
> diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
> index e173b6187ad5..4608cc962ecf 100644
> --- a/arch/s390/mm/fault.c
> +++ b/arch/s390/mm/fault.c
> @@ -433,6 +433,17 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
> goto out_up;
> goto out;
> }
> +
> + /* The fault is fully completed (including releasing mmap lock) */
> + if (fault & VM_FAULT_COMPLETED) {
> + /*
> + * Gmap will need the mmap lock again, so retake it. TODO:
> + * only conditionally take the lock when CONFIG_PGSTE set.
> + */
> + mmap_read_lock(mm);
> + goto out_gmap;
> + }
> +
> if (unlikely(fault & VM_FAULT_ERROR))
> goto out_up;
>
Guess the patch below on top of your patch is what we want.
Just for clarification: if gmap is not NULL then the process is a kvm
process. So, depending on the workload, this optimization makes sense.
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 4608cc962ecf..e1d40ca341b7 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -436,12 +436,11 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
/* The fault is fully completed (including releasing mmap lock) */
if (fault & VM_FAULT_COMPLETED) {
- /*
- * Gmap will need the mmap lock again, so retake it. TODO:
- * only conditionally take the lock when CONFIG_PGSTE set.
- */
- mmap_read_lock(mm);
- goto out_gmap;
+ if (gmap) {
+ mmap_read_lock(mm);
+ goto out_gmap;
+ }
+ goto out;
}
if (unlikely(fault & VM_FAULT_ERROR))
Powered by blists - more mailing lists