Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4467929ioo; Tue, 31 May 2022 05:16:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxri4eYZ2mQrr+LYbO9gVAuiCsYD3P/kaW5myJAQAS8lBZHyscUJCCMB1U0+WNPvBiAm6MD X-Received: by 2002:a17:902:ab8b:b0:163:caf2:2ef2 with SMTP id f11-20020a170902ab8b00b00163caf22ef2mr12201828plr.3.1653999372856; Tue, 31 May 2022 05:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653999372; cv=none; d=google.com; s=arc-20160816; b=kqwrAklFLzrUdnrGXQT3mc1IZfDem3fpbJleaUWJMhtyCF1xBFsTsUUqgtcsWysjv2 nWN4FJ12KC2sA93IGTzxmO6FcK2d52jxLPkp2NujAfGYZN5n6EgUuvKHphG+517vhMnJ wouO1/v2bGKr+ipgZyzrUaIxSX3mvGqGjKq2kJAkiMbRsOiGfRGUDi9S4XderGxJglDF TeSQbpJUbM9bAUi419N8w3VYWXh9UST6ER50wSB0uimluxSTWNKyZz788njjEyhKeeGE Upi3MbGSU+PS11CceSVV+pn3pm4SoAyRGHvKo698+hUYC0ZbiVNHnC/WFIiiYwCN7QBQ g9JQ== 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=+ALrzFnb0YEuDamJlOSrZjOy/DY+2J0hn9MNRn5A9C4=; b=ZMrJlT08sC2uFtU6uJNOCoEucQYxHmr52bHlQiBvfHiQ2xqI+rs5OUZRqW5bLAk6fu SkirzAz4SBHDDny6Zn+81y67BIeQlVsFGGHu7HnpqryZigo3b5h7bae1B0/3B2vppxKu diEkp12cME+DNoxumRFi2Lx2IUPNUedpajfmwYxbD0pPCx3jattVYRTmHtw0jeAelEqt O0Vp3ftCIuSUG16fERH5sEofme+e7Ig6AVv9Qi5+HSODTvit4/dnWIRb2t9veTMowwUn GxRmlpOj8fCXabgUrsqejN3hcRtddfsQBo30UTRo9zXaGexIPgVPxSZgNIzgE24k/ut6 CG8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NDaxXrXx; 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 n1-20020a170902d2c100b0015874dc3247si22374310plc.170.2022.05.31.05.16.00; Tue, 31 May 2022 05:16:12 -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=NDaxXrXx; 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 S241928AbiE3S3r (ORCPT + 99 others); Mon, 30 May 2022 14:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242760AbiE3S3m (ORCPT ); Mon, 30 May 2022 14:29:42 -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 2B92A62A05 for ; Mon, 30 May 2022 11:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653935380; 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=+ALrzFnb0YEuDamJlOSrZjOy/DY+2J0hn9MNRn5A9C4=; b=NDaxXrXxwYOKO0vShj6qmUwCsK/7orKdIE91AUGSS+YGGZKvNr24TpfDws1pY4QC2FDBRi OPz7vct0u5N7KtTHt9wbW4mhLnglqmnj8j6YhmaSebrNuG4hV5B5a7OqQkiVxnAjjCAEpC 66tbQ1/29LYSgIGjctk6Plhmj8GA9BU= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-365-piy_VhB-NEe-CFRmYgpw1A-1; Mon, 30 May 2022 14:29:39 -0400 X-MC-Unique: piy_VhB-NEe-CFRmYgpw1A-1 Received: by mail-il1-f198.google.com with SMTP id g8-20020a92cda8000000b002d15f63967eso8750272ild.21 for ; Mon, 30 May 2022 11:29:38 -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=+ALrzFnb0YEuDamJlOSrZjOy/DY+2J0hn9MNRn5A9C4=; b=K4r7O+WuMpVt4ULYXbFizhFDVuKN3q6eAITmUvOBHm4HX1scWkZJkBB1tO42MFFRrH DiF5KO3JRRkmhwwRukiuNtdotfiLYynKW27mPeVzB+kQlXP6Bm1UVnyKZClXREgiAUD2 d/esc6LNCkCOaxc+keGLq1CjnvMSnr19RTB2tisPJq02jpD8Pv3nMJABZe+wqQveMlAi 25ZkymkVvFktvKi4clNhaB7RH4iBd5g1JP+BUkfF1HzNph9WxlFQp0VqPzB/thfO0Git DTfa0aAUxFt894h+Cmhb/V7HKVqbApIXlPo6QHQpoTJJEAXvWRvMc7DwrUHrzJQiV/At PAtw== X-Gm-Message-State: AOAM532lgl91PiZq+RvdamhwPdMyZ5a4Egug//ZoNB4vkHR2/wwh07Sw llZuJl9xNNCWZeJpvRzn4aeAd6oFMlvo82/QHGVP7X/BXGONy8AP5FAiEfqedqwzZDq7GE8+0ha OiB48vWZshJkMSUCx/YFEj718 X-Received: by 2002:a92:d785:0:b0:2d1:7ce6:b834 with SMTP id d5-20020a92d785000000b002d17ce6b834mr25171905iln.207.1653935377088; Mon, 30 May 2022 11:29:37 -0700 (PDT) X-Received: by 2002:a92:d785:0:b0:2d1:7ce6:b834 with SMTP id d5-20020a92d785000000b002d17ce6b834mr25171841iln.207.1653935376794; Mon, 30 May 2022 11:29:36 -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 cn9-20020a0566383a0900b003313b7a5731sm183095jab.178.2022.05.30.11.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 11:29:36 -0700 (PDT) Date: Mon, 30 May 2022 14:29:31 -0400 From: Peter Xu To: Heiko Carstens Cc: Christian Borntraeger , 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: 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 07:03:31PM +0200, Heiko Carstens wrote: > On Mon, May 30, 2022 at 12:00:52PM -0400, Peter Xu wrote: > > On Mon, May 30, 2022 at 11:52:54AM -0400, Peter Xu wrote: > > > On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: > > > > > 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; > > > > > + } > fault = 0; <---- > > > > > + goto out; > > > > Hmm, right after I replied I found "goto out" could be problematic, since > > all s390 callers of do_exception() will assume it an error condition (side > > note: "goto out_gmap" contains one step to clear "fault" to 0). I'll > > replace this with "return 0" instead if it looks good to both of you. > > > > I'll wait for a confirmation before reposting. Thanks, > > Right, that was stupid. Thanks for double checking! > > However could you please add "fault = 0" just in front of the goto out > like above? I'd like to avoid having returns and gotos mixed. Sure thing. -- Peter Xu