Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5656709ioo; Wed, 1 Jun 2022 09:46:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0FBEnpYOZh3MbJaprNyEhIOGtnYtzROzFlb+6iiD+DP6bpEcbWS/0tIm/x33BE1bcEFDa X-Received: by 2002:a17:906:9749:b0:6f5:38d:d4d8 with SMTP id o9-20020a170906974900b006f5038dd4d8mr354472ejy.405.1654101967428; Wed, 01 Jun 2022 09:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654101967; cv=none; d=google.com; s=arc-20160816; b=Eaan136CaEBbqd61Y+V1hwEDy029ARmEqyitMQjdEEPMqX0IfUhgxpA7r5tL3AYm7g sie6i4fKP2h+qQ5MOaxkHlajPtZ9JnNQbTo+8I7y6fX2y6wrOY6qrzw010Ut4OimFsg9 mwgUAYAg9q10c5zZv1C8Axc2zdDFdKor6IzPXr77t7Br70l+Pb9IBewphZgGhXn1g/xq I95oVwlXosyTiLjY5Cu5pfy4ifirOPPXoRkGhJ8Enx0VPzEUifOG2NvfD8p8UNiUfOeC NGrncYGG8ZeT+ayTfb2cxHpDlQYGztLVAv+A5OJ3yFY12iG+PWHoZ7RDGQ2vi7Ajw630 DtbQ== 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=9ZWphZRcK3afyDhn+H8+iYAM34Y/wtF11YrAt0KXpqo=; b=Kisf5YLpWkDngskna9Xvob/x24+ChW2HLvFPg2xIPOPsbfCZ6l7zaaujR5HIsTIaha 6mNC3BrtDYK3oL8HnhkYnW9vZ2vOn/8lS2lMEDVjB73/+82C+NV5OHXPLoAEqncikCCS uWbGNtkVe1TcdLJqIBNk7iJYArqiogKpo0efUZmcQrC3Sguoa9WJcfkoxWxBBvdVSOot MnB3lwPttpPbsAX5ASHo916o5ajBNiyc6rUsG5AeVfx3LhSqychEn14Dxkr/GtsIKfC7 PGQ1Wnac7CXB73HvPWDWYhOQgnNDho6i+wkHuTBQo/zaKcTp++202HlLeDLkljR+v0T+ Cb7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OAlzTeE5; 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 r1-20020a056402034100b0042b014da181si1980279edw.54.2022.06.01.09.45.40; Wed, 01 Jun 2022 09:46:07 -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=OAlzTeE5; 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 S242133AbiE3QCb (ORCPT + 99 others); Mon, 30 May 2022 12:02:31 -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 S242157AbiE3QCO (ORCPT ); Mon, 30 May 2022 12:02:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6EA8E274 for ; Mon, 30 May 2022 09:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653926460; 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=9ZWphZRcK3afyDhn+H8+iYAM34Y/wtF11YrAt0KXpqo=; b=OAlzTeE5V8IDemnaydPys11/ZrVI/qBW1DOX6CPplb5qXISrVW1Skgh7NUzAUpdX2Yqw/p pHKMJG+8Mdx/ufIWFXE5y5I8riDML3OEKL/xpQCxyErsRfUKjW22PRJZPOar4KJ4zfDQ61 nAJEfPCcXlXGS1LH0+N1yZAXk2j7fts= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-52--07bG7Z6MASdmn0wFTWqCw-1; Mon, 30 May 2022 12:00:59 -0400 X-MC-Unique: -07bG7Z6MASdmn0wFTWqCw-1 Received: by mail-io1-f70.google.com with SMTP id u7-20020a05660229a700b006657df613cbso5658362ios.14 for ; Mon, 30 May 2022 09:00:59 -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=9ZWphZRcK3afyDhn+H8+iYAM34Y/wtF11YrAt0KXpqo=; b=xG/1cZoMsR3popMDp1CX7ZMpMprmX/XdN5SRrRAGPDMWxyogKYVcTEyou1Q4em9JIF 961axk74mM7gqCR67WD+1dMU2x4hTpnpQnZGolJMUy4urn6MpD1Mz8IC3II72hafYdpW uj/HK/A/IaoEsfOvKkbrABTtvfud6NofJxe+RTFfN4l/ZH5a9KjYPdKheoHojzNkZvwS tTpHVLzkIrJ8O/v3q5973preimbrgOf6Gp6Qp9V8blrcyBixtcRFTMbOfsJYms+Ps1/b RU+A8qmHxOcFA9p7jCYIDDa8tDn0H4ZMx/dSHO6BG3Gy3sImsb71rLCxGw5S+OKaFOwY BHuA== X-Gm-Message-State: AOAM5328lQVn95dW8kPzcZyfvABdYRizfCAQ3mM1hTr+qekvp3LXdKjt CddiruLBHssCfKFLzX1kPljh9fhzCt/ZXo95uvtUpRKfmibuVgCOG9TX4v3K4h/HRAdbGvOf0/V qn6AGZx20ekBvTT9el09sH1yy X-Received: by 2002:a05:6e02:1648:b0:2cd:fe43:39db with SMTP id v8-20020a056e02164800b002cdfe4339dbmr30191763ilu.172.1653926458633; Mon, 30 May 2022 09:00:58 -0700 (PDT) X-Received: by 2002:a05:6e02:1648:b0:2cd:fe43:39db with SMTP id v8-20020a056e02164800b002cdfe4339dbmr30191721ilu.172.1653926458383; Mon, 30 May 2022 09:00:58 -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 b16-20020a926710000000b002cde6e352e5sm3863762ilc.47.2022.05.30.09.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 09:00:57 -0700 (PDT) Date: Mon, 30 May 2022 12:00:52 -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: 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:52:54AM -0400, Peter Xu wrote: > 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; 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, -- Peter Xu