Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4121841ioo; Mon, 30 May 2022 18:58:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv9QvS1TBF8RDlpJavZ7YFvqVKBnAzMBerVqJnncS71O0Uv9BeYZcec4IlVsqZ1vl4jI8x X-Received: by 2002:a63:f407:0:b0:3fa:91cf:270 with SMTP id g7-20020a63f407000000b003fa91cf0270mr31941554pgi.428.1653962311842; Mon, 30 May 2022 18:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653962311; cv=none; d=google.com; s=arc-20160816; b=0RP5uAYPWrgCUP6Pp5MWa6ok9roCGehzR7dsNGtJgW0V/AM5X4xXyTTsWSxkvYfyAs fCUABC0r79VkZUdCeyrwmCgh9Hiv153bs1Mx0uO4VgQzh9alQi4uQnn2nFcvOYo/N5st kH6rDvPeH6nOolPKQiMdPVEshuJdhtQ4iFdzKqYYplwvxaVhnksFUDovzwVJW0V401Y6 N9qBhu9hkD0IcRoymTuyS0yd3pm6uIZiM/4jTXKDAsHa2rhjC5BDW1v4Qxm0RBYbpvi+ IA3ijwLxdha4ewQrEjyyRS23fjLP+pp79EkGfY+qy4i+/0klkZiUiiFdqHW4BFvh6plw VixQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bDYue/Afd3VGZHzU7tYF7qy5xBeBUpqe85rLuoAiRcE=; b=zUsSxXhFVOHLfu7cXa8kZ49A7bywItFHH235gCVhDPdtO6EMG4kXuK8Tg4Nt577GPy eXHJTPbdoir9quxwQ0/Yg6wnITSGY3zgufYeD8sbaKuAH4Xfqb+6DE5cNRJKgGt4roKt GEL9KwoqTPX/ioqCUu5vY6scih/arqtn40+hRVMIsVRifVPcBLljGhtjkYLrffhSSsQy kG9yXAkK+tpqz5N1jLJwIMsIo+w1C8bHEgWmMCBKORrU54zOm6lq4CYZeaMOiJtVmQ/Z npq/e4ZYW7Eq7PyZ3fmxmym67KDKHbkiV+4ArrmiDml80ZAFmsjepBTU22O71PxnYEw2 sAnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AkXHNJKv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z26-20020aa7949a000000b005105cb7e94fsi16369399pfk.271.2022.05.30.18.58.20; Mon, 30 May 2022 18:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AkXHNJKv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238400AbiE3P7z (ORCPT + 99 others); Mon, 30 May 2022 11:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241127AbiE3P7g (ORCPT ); Mon, 30 May 2022 11:59:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7122C22BDB for ; Mon, 30 May 2022 08:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653925982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bDYue/Afd3VGZHzU7tYF7qy5xBeBUpqe85rLuoAiRcE=; b=AkXHNJKvAQRHb5OqI+OhXnw4AlFTHU7SQ25I25r8DrkTB9nwXx2U3S7uy3yWEhfxPKMgZ0 MCHoCCU4ElbTk7DKNd2mXmRpWE6tOdwsDRWpn7scMraYzymGuve2EYFM1vMWpJYkKpJQS0 OjtcJUf23O2R/uhMV8v3cei4In0oe2Y= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-JXIUKUVtNoSifQX8E4lzFQ-1; Mon, 30 May 2022 11:53:01 -0400 X-MC-Unique: JXIUKUVtNoSifQX8E4lzFQ-1 Received: by mail-io1-f72.google.com with SMTP id n19-20020a056602341300b0066850b49e09so3662090ioz.12 for ; Mon, 30 May 2022 08:53:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bDYue/Afd3VGZHzU7tYF7qy5xBeBUpqe85rLuoAiRcE=; b=GYBoQ4BLZwgavD0YrQ3fP6ENDrjnpkDGTKp1DEcYFgM2A1F5FhYh6xA+zi9xV2YRfm MCuAyBxe3x2oJC4mTaqCEfudUDQLw8aZ94nWUIu9WcKZbhXZqMMHGPU1lIbMOOFvORQT q0KKM2mBrXbWMEtz4vC685JR3X+krm+zG6BT1F80tIbk/2cu1MXGY5tAm80MwCfeAdCi hDOVkVc95KuNoiSbYn7l7k/tvGycJvo/ZrBfH8aeF7Z3NEVyEMfkcKFKTQxcpXyisY6F nGkM321zzNcTb6Pu6LdPNPBIkPUmQyY9zwW+mCkmEC7zu8qWJAhnI5fuMnPXTNZdj5Cd Ydng== X-Gm-Message-State: AOAM532dWIcSH0lzGwdFw8QgJpnyQct6y4Nbsgiqi5uovvrchTgAhLEJ Uhhe7N5CP67Z2wkXhD0eH6BiftjtaYVhrHx60OVmPpU4d3pkJBaI7CKp1Q38gIA7t6M0be1L53i ZXFs5cPc6yjaDVc145ilqygYJ X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857364iow.192.1653925980593; Mon, 30 May 2022 08:53:00 -0700 (PDT) X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857337iow.192.1653925980357; Mon, 30 May 2022 08:53:00 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id 66-20020a021d45000000b0032e75bfe344sm2781109jaj.171.2022.05.30.08.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 08:52:59 -0700 (PDT) Date: Mon, 30 May 2022 11:52:54 -0400 From: Peter Xu To: Christian Borntraeger Cc: Heiko Carstens , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Will Deacon , Matt Turner , linux-s390@vger.kernel.org, Andrew Morton , Brian Cain , Borislav Petkov , linux-alpha@vger.kernel.org, Alistair Popple , Jonas Bonn , linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, Michael Ellerman , Stefan Kristiansson , linux-snps-arc@lists.infradead.org, Vineet Gupta , Vasily Gorbik , Vlastimil Babka , Ivan Kokshaysky , Rich Felker , sparclinux@vger.kernel.org, Russell King , David Hildenbrand , Benjamin Herrenschmidt , Nicholas Piggin , "James E . J . Bottomley" , linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org, Paul Walmsley , linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, Richard Henderson , Guo Ren , linux-parisc@vger.kernel.org, Andrea Arcangeli , Helge Deller , Al Viro , Albert Ou , linux-um@lists.infradead.org, "H . Peter Anvin" , Janosch Frank , Sven Schnelle , Anton Ivanov , openrisc@lists.librecores.org, Thomas Bogendoerfer , linux-hexagon@vger.kernel.org, Andy Lutomirski , Stafford Horne , linux-csky@vger.kernel.org, Thomas Gleixner , linux-mips@vger.kernel.org, Paul Mackerras , Alexander Gordeev , Dinh Nguyen , Palmer Dabbelt , "David S . Miller" , Johannes Weiner , Hugh Dickins , Ingo Molnar , Peter Zijlstra , linux-riscv@lists.infradead.org, Max Filippov , Catalin Marinas , Geert Uytterhoeven , Johannes Berg , Chris Zankel , Michal Simek , x86@kernel.org, Yoshinori Sato , Dave Hansen , Richard Weinberger , Ingo Molnar Subject: Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types Message-ID: References: <20220527193936.30678-1-peterx@redhat.com> <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: > > > Am 29.05.22 um 22:33 schrieb Heiko Carstens: > [...] > > > > 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; > > Yes, that makes sense. With that > > Acked-by: Christian Borntraeger Looks sane, thanks Heiko, Christian. I'll cook another one. -- Peter Xu