From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F03CC433F5 for ; Mon, 30 May 2022 16:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240860AbiE3QCn (ORCPT ); Mon, 30 May 2022 12:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242369AbiE3QCO (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.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 122BDE7 for ; Mon, 30 May 2022 09:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653926461; 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=WXE45WPLzSSxLaa7yksLlZHkyoUet9yV7w9rh7dR/4dvnhu7bS1iSFwdKmCzqv08o+EFcz eJW7RgftsNpGHbpS9wRvyEQTk8lf/MJOQTfeXH1WX6qbafzpDpEjxROqIKVnaOZzv1ViZ4 Ezz6lMeoqSbzmS5x3BRK8mIYa5uHf54= 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-43-qEpTz80DMZypnCPkQ-_gQw-1; Mon, 30 May 2022 12:01:00 -0400 X-MC-Unique: qEpTz80DMZypnCPkQ-_gQw-1 Received: by mail-io1-f72.google.com with SMTP id k184-20020a6bbac1000000b0065aeedd4ba8so5642201iof.20 for ; Mon, 30 May 2022 09:01:00 -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=xtzKdAbPhmy6rStt0h4M/1dlNxntAr0fRoSYYBXEfzg7f1L2SHmSEtJ3gICjlVP0T7 GMPpoqBa/anxB0K9ZlHaM+P2FUBvDrrx71i4m8ikLMmLirsaKzY7Sm1dH3B6KW+J+ZB6 JqHChnRQi2wouSS8Ux/xTYtEIVvqbtTqQAgIPD3zDIqhqdbQDE6M1hebAr2vMNMBpQ+P 6kSIzPLiMtZ2Opt9DYdGw0TVRNEJ8leK5Afmzu/3b/tYI4D+UUEvVHCt5K0xDcFy5I5w hiKlfZsfuCWwRB+3ihy8qa7+D//hamjqjGLeIBGqkcPYNjehPbOK1bWe+VlslmKmjqSn lSMA== X-Gm-Message-State: AOAM531klX752g6Mxf/UvUFLP0Xu4cYA5AMs8cqhFeF/qc1WYgmh4D1r Ht6DO67GH3In2RRpIsvqOzYq4D2R95sOq4PVbx9twMXAspBHRqIIWGDlkHy01ecgPks8nUppTIA y/MKdMLuRg/Xux90mOtiUEg== X-Received: by 2002:a05:6e02:1648:b0:2cd:fe43:39db with SMTP id v8-20020a056e02164800b002cdfe4339dbmr30191770ilu.172.1653926458646; Mon, 30 May 2022 09:00:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0UxFyFLwjW1ZOMQsp2rrmtoQtqcFmY+n0cdYYM503zYLjoFDoHLhs+0Zam5Eh/FIDylo0ew== 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: Precedence: bulk List-ID: X-Mailing-List: linux-mips@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