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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2840C433FE for ; Mon, 30 May 2022 15:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FLSRw1Jy++u138uHmR+3/vsNjIJLD69ZFMJsI3B6u+8=; b=YblrE10HFRvBhU 8TZaFFOq3SGIioV0VAIzeuVV1E40a1IDloa+T5lT+HZw1wrV3rViN9OHgooRhLMeJqgRejoRWPhgU GutQAurfpSXmNhD6ynMJ/dU/pDIhrgQINScS0A2DZslsX0shEt2ZZnzN+UnUzZSkLCGkej1M1IXqV RQ8zjMDdmCYkmilMSfv0miLfhXeQrDCLldVQgYLLl9S00d/muWkj9QKxg9DRXeKtT6kHAeQvdxy7P oTswHaDQDHKDgmoBNA2z3Kb7KIZBav0Sm8a1pSxSWFzPatstfM+/WQxPDRhy2jJ30/d9dUIVqneTE Cfedp/kt79o0GF4MPdKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvhhe-007Z7m-5V; Mon, 30 May 2022 15:53:10 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvhhZ-007Z2r-BO for linux-riscv@lists.infradead.org; Mon, 30 May 2022 15:53:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653925984; 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=YgN3kgKJ0UzknAvHl1zBxccmG3i56sV4QgvUX4eJf0Ld94UI/B3rzQ+H9H9r71ucRytUDE 7td1PYJ+GkbJCAOJz8RObrIYqARuP487sIlHwkitK2SZiJRk2NlllsX+0KBKmdVkbl9XRx SSAPhGUN1SgEKW0W6OTaMjFD1JgioAg= Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-ySAo21r4NCO45E4MPq8UVA-1; Mon, 30 May 2022 11:53:01 -0400 X-MC-Unique: ySAo21r4NCO45E4MPq8UVA-1 Received: by mail-io1-f69.google.com with SMTP id l67-20020a6b3e46000000b00660b8c61a31so5682839ioa.0 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=UCnq0Uc51eCYOPoIW1QhnsaR/eGRhxU/dWiO4aM4NExT60bhFmgmx3B999FMt9aMJN uYXmb04uD2GVLUpTaviUX4VWD2gHU8ddxlC7KwBb1uhn3EqYheUXnBU7Hm5ZQp/Afmnf EJ3MfKOzKgn9QaKyiY0tNPfpj8Cs3Mr4aYGmvAZZP8o5UowOG6eNOs/JtPbhywA7wYE+ upWKbwH0ffwkRCoQxi+u3pJVbgSoQgbnFqFx101dwMs4kYor6iAnpxzVCiRLHG8GtYyC HLfwRU7GJN7aKRXbwEm+KM5PZ+86cswl2VMBDJoJepiTkjk4rDRZzRlSyEXCwrn6HB8t fzMg== X-Gm-Message-State: AOAM531dmLk0acV1h5k304vniEgX7l1MEkXz4WKgfQTIDR3IGnRrQ2s0 W5hBRTDVdpebmYUWRH1G1N4UEMAzSFb8OekW+4zBvt6cO/qJFyyxhWJLt2JtdAFSjDYqT1UJf19 EWAQzp0pVPepdLeWJiC7yv/rk7ait X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857397iow.192.1653925980597; Mon, 30 May 2022 08:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKQIoyyqGc41UCjMUnObS0GZ5Lh8IPSVLY8KDGIOa5YRMfMwdzANPXLWIG/1E7oUnwvcvO1w== 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 In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220530_085305_812881_F9BE956B X-CRM114-Status: GOOD ( 20.65 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 A3CCBC433EF for ; Mon, 30 May 2022 15:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242500AbiE3P7o (ORCPT ); Mon, 30 May 2022 11:59:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240081AbiE3P7g (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 2B51DE034 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-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-MZG1D_PUO5yZMe72ts0O-w-1; Mon, 30 May 2022 11:53:01 -0400 X-MC-Unique: MZG1D_PUO5yZMe72ts0O-w-1 Received: by mail-il1-f197.google.com with SMTP id r9-20020a92cd89000000b002d16798b3cfso8564293ilb.22 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=tGQwYdGIp0rKK7VCoKpvIzBeR9Yxkpzjh5hCAz81iLU6N0YS1Eq6PUPnJ1irDLJG/f PQh41InnvuhGab01pmemzYH6HwkcI0hz7pLspIxURYtkAlcf8kTusZj1LQitB0RTtD+Z +rfHV3NrkbowYRWY4Y2LviW7Scdw3ol8rr76tWg1AKqHgWN+cSziaP/Y2B8C0lif6ktD PD1KP+eZrv0sAZ6FB6EhiY69TQlbZXqoCIkyukCW7dHsiuo5seHdCPJhjK1A3Te3I0BC kAbV3VznTARX0Df1PM9vg4GisIilgm9Fb8Us2LOb+i3VIrbxxvVwDtb58M8+GTJ6yLyw X4Tg== X-Gm-Message-State: AOAM5307qbu0K7DBq+82wsigBZ5t/bG+s20FZDdGqA5GUiNOBXawuOOf 9qJFcw/nHhp5UEwbyzUUSqZOavgFUff7DQC6D5YIz+PRLezhFM0/iOFeOmv9LVnoftjUZyYCBSu hlqk3JK6B+R7DNSJUpJ8= X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857369iow.192.1653925980593; Mon, 30 May 2022 08:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKQIoyyqGc41UCjMUnObS0GZ5Lh8IPSVLY8KDGIOa5YRMfMwdzANPXLWIG/1E7oUnwvcvO1w== 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 In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-sh@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 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 068E2C433EF for ; Mon, 30 May 2022 15:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l2nPO/hSmWAAngnWLQMI0rbm1+Z+lGbwXltmFRBWwIM=; b=URqL8VFPgIexG7 9hVllpdcgH/5/QaIlcxZwq3O51I2VtOyPlyQL6iB6t20z302fw44qqRblx6NqPHLm1MwwtbNQrw9k oyjBXudOA1npB5sYRAxSvrOUT5nGzR+Ierj36yCXY0VmwzdzmnNiXwS1h+vJR8TUQNYKd41XCU0Tk v0zGihUl64DQTZ8w7aUgUOgy7cPT+NvX7atIYYEnTjqlIqlAqJHnlUY0bqVr7eWuhtC7yG+hvyxYE aVrZRvab74AOt1JHvDQjBqOPrZzsg0yhTgdGSKEpaJuBJtqpEqq8rZaK9OWCMrsomXM4A7R4MzeZp c4sglk2v2qLxbxfaqAww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvhhd-007Z7N-Kr; Mon, 30 May 2022 15:53:09 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvhhZ-007Z2U-BP for linux-snps-arc@lists.infradead.org; Mon, 30 May 2022 15:53:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653925983; 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=TpFAE+FS1J0MN2RDjXKr2PtcGFi43Y0xzw2eamXgc8G8lnWUkIJCvXY7PerVuw57vIF6Sb /RxD4xLI+8s/LL4q7B+aCW2K9S4zeXWraTG/8vZF0PZ2AM3oSeiEsoE6J5meZJtmN4jKLB MJOeoYH4+SEGmrAPhr1bb0LSNUsLr7g= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-4ToZhhyoM3SR5b-VbZYkyA-1; Mon, 30 May 2022 11:53:02 -0400 X-MC-Unique: 4ToZhhyoM3SR5b-VbZYkyA-1 Received: by mail-il1-f199.google.com with SMTP id j5-20020a922005000000b002d1c2659644so8585654ile.8 for ; Mon, 30 May 2022 08:53:02 -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=3wyjf3GEJzpmgDzAHxxw48sAtrjTK40SujwaWd8Y9wDd+AXcl2hrWW37/c756A0iGc yxmEK3f1gEqaIfZxBCgj/pQXim7E64dq/qtk2w/5d7xF+r8/KMUWRRxpp7m7OpY3tJis RB/00xyt4iPd+TXtd+yRJZVHfOgrSNozVyxTa4M6I4fBoh+PrVhGjtZPv9Ul1+PbSFNP qchlMDqnnOXW7tD/RZPMxxJvcBTwK76tohyfERRyTAxdBeQdQYXVxGnLkcbuYNYSKZ7o 0fFNWoxTcUqMl1sFGAG0ShURSMyIvpeXOkz8O+i0cuhmqcxYTIgB/JTbM8RsAmPraGNM vDCA== X-Gm-Message-State: AOAM532iu/WfP9xjNlkOq6E0MWBxdS1IR638uYIgV5BhVxDvTp4+uuNv Bsy/6OduPdwdIzsR0P9gh1wyWSl+N+qYgLNuN2ESQ8A0UhMEUz7x11JzfoHnV10EBHsoKQpTZ/2 iJPgijaz+hvEohU0gtlFIMUGffJHly1np X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857390iow.192.1653925980595; Mon, 30 May 2022 08:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKQIoyyqGc41UCjMUnObS0GZ5Lh8IPSVLY8KDGIOa5YRMfMwdzANPXLWIG/1E7oUnwvcvO1w== 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 In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220530_085305_543378_2588C883 X-CRM114-Status: GOOD ( 20.65 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc 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 mail.librecores.org (lists.librecores.org [88.198.125.70]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D51BC433EF for ; Mon, 30 May 2022 15:53:25 +0000 (UTC) Received: from [172.31.1.100] (localhost.localdomain [127.0.0.1]) by mail.librecores.org (Postfix) with ESMTP id 591122412D; Mon, 30 May 2022 17:53:24 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mail.librecores.org (Postfix) with ESMTP id B515523E0C for ; Mon, 30 May 2022 17:53:03 +0200 (CEST) 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-OSyAMyJtPYWTE99-BY83-Q-1; Mon, 30 May 2022 11:53:01 -0400 X-MC-Unique: OSyAMyJtPYWTE99-BY83-Q-1 Received: by mail-io1-f72.google.com with SMTP id u7-20020a05660229a700b006657df613cbso5650620ios.14 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=8Fmz63Wmazw58sQet20KzazyBd4sRMU1xb9eerpixkP8fFNblNeZZN0/0+SuMCGF22 e7+nQ1cwINklbzTrp6Ia0VNFWmwW8i1WsPsCMLYNA0qGAzkcAyn3e4ez/MYwxF89QBal ZkbPZEn9zAf+hSyiCzM3uDPyN2hjc7CV+FpYe9Yt7FpeRHmCc2A+ybm8zayi9YZ8zr/1 9M5R2SDRWSBnljAXZWO+JNwEmnfAxg95a7/Lk7lsoGhwbh6MaWGSuTsEpTm9dQyHTx3+ vFFyU0RSVgCF27gwd/gME+782Jzn36EK2LfSQ4RWUa238YitpBf0LH+p/E/R9DSmXfEX lkSw== X-Gm-Message-State: AOAM531KpdwvCER9DsO4tnkkeJdGuDnmeGjSdPkD7M+n4W7q55BelIuX gkiGUhEcn/ajAEsdJDXXLpY2JWNjqpAeMe20ome1GI4honhBAYqGbUtaccQJwHXJTYOQvaLSC8t mvpkFK3kX7eWa4KeZLyajPRbgaA== X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857403iow.192.1653925980597; Mon, 30 May 2022 08:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKQIoyyqGc41UCjMUnObS0GZ5Lh8IPSVLY8KDGIOa5YRMfMwdzANPXLWIG/1E7oUnwvcvO1w== 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 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 In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-BeenThere: openrisc@lists.librecores.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussion around the OpenRISC processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , linux-ia64@vger.kernel.org, David Hildenbrand , Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , x86@kernel.org, linux-mips@vger.kernel.org, "James E . J . Bottomley" , linux-mm@kvack.org, Guo Ren , "H . Peter Anvin" , sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, Alexander Gordeev , Will Deacon , Thomas Gleixner , Paul Mackerras , Anton Ivanov , Jonas Bonn , linux-s390@vger.kernel.org, Janosch Frank , Yoshinori Sato , linux-sh@vger.kernel.org, Michael Ellerman , Helge Deller , Alistair Popple , Hugh Dickins , Russell King , linux-csky@vger.kernel.org, Ingo Molnar , Andrea Arcangeli , linux-arm-kernel@lists.infradead.org, Vineet Gupta , Matt Turner , linux-snps-arc@lists.infradead.org, Catalin Marinas , linux-xtensa@linux-xtensa.org, Albert Ou , Vasily Gorbik , Chris Zankel , Heiko Carstens , Johannes Weiner , linux-um@lists.infradead.org, Nicholas Piggin , Richard Weinberger , linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Borislav Petkov , Al Viro , Andy Lutomirski , Paul Walmsley , Ingo Molnar , Vlastimil Babka , Richard Henderson , Brian Cain , Michal Simek , Thomas Bogendoerfer , linux-parisc@vger.kernel.org, Max Filippov , linux-kernel@vger.kernel.org, Johannes Berg , Dinh Nguyen , linux-riscv@lists.infradead.org, Palmer Dabbelt , Sven Schnelle , linux-alpha@vger.kernel.org, Ivan Kokshaysky , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S . Miller" Errors-To: openrisc-bounces@lists.librecores.org Sender: "OpenRISC" 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 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30EB6C433EF for ; Mon, 30 May 2022 22:28:39 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LBqnK3xs1z3dw5 for ; Tue, 31 May 2022 08:28:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AkXHNJKv; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TpFAE+FS; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=peterx@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AkXHNJKv; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TpFAE+FS; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LBg123Vl7z3073 for ; Tue, 31 May 2022 01:53:07 +1000 (AEST) 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= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653925983; 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=TpFAE+FS1J0MN2RDjXKr2PtcGFi43Y0xzw2eamXgc8G8lnWUkIJCvXY7PerVuw57vIF6Sb /RxD4xLI+8s/LL4q7B+aCW2K9S4zeXWraTG/8vZF0PZ2AM3oSeiEsoE6J5meZJtmN4jKLB MJOeoYH4+SEGmrAPhr1bb0LSNUsLr7g= 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-658-A2rGeRx2PDKSF6Ook-KbjQ-1; Mon, 30 May 2022 11:53:01 -0400 X-MC-Unique: A2rGeRx2PDKSF6Ook-KbjQ-1 Received: by mail-il1-f198.google.com with SMTP id m9-20020a927109000000b002d1af1ed294so8582106ilc.5 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=gRdLcGk1FtMMD1zhO2s10vdJ97orcBah9Y9QYjwXbi9btBq+lTkYWYAqCwdxV49D16 1rIkISCgRtOsIRUZt9pKB7D1fUalnqmVCzA1+NaHV0hKUhx7psldOXctxeNLPA94keOZ 93+kaaR1zoigl+/6kf6wlXpWYXKEz2Wt7gMGfgxyGop4I5csd52RCz8ah076EEhwOUYe uu3rpZ0DkUXrf0xtb5ik92FKOyoLyeLB/xI7wnk4PWueRwRq/Fnn/rUevfVybgiRnsnE 3tzxPx/7pD3nDc0CWfnF8Pb6V6x/WNwzw4xalAomoR2KiK+TaNW+WoMA+gS/WghF31CG ccfg== X-Gm-Message-State: AOAM532FWFEKpu9HTdCsd4S8e0zPD4z7L/4vf/tWPVuyIdXm5AVN4lgL WuFkMZc5WnnCHbXYgyU43Kx67i3A74Eva8z/gtIxK6lrsrcP11itAKl5LJMV4QGY1p3I1QD2MfL 7PG2jeV3aq8kbscL68xyUnZcOLA== X-Received: by 2002:a5d:9cc8:0:b0:663:2899:4b8 with SMTP id w8-20020a5d9cc8000000b00663289904b8mr16857412iow.192.1653925980616; Mon, 30 May 2022 08:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKQIoyyqGc41UCjMUnObS0GZ5Lh8IPSVLY8KDGIOa5YRMfMwdzANPXLWIG/1E7oUnwvcvO1w== 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 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 In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Mailman-Approved-At: Tue, 31 May 2022 08:25:41 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , linux-ia64@vger.kernel.org, David Hildenbrand , Peter Zijlstra , Dave Hansen , x86@kernel.org, linux-mips@vger.kernel.org, "James E . J . Bottomley" , linux-mm@kvack.org, Guo Ren , "H . Peter Anvin" , sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, Alexander Gordeev , Will Deacon , Thomas Gleixner , Paul Mackerras , Anton Ivanov , Jonas Bonn , linux-s390@vger.kernel.org, Janosch Frank , Yoshinori Sato , linux-sh@vger.kernel.org, Helge Deller , Alistair Popple , Hugh Dickins , Russell King , linux-csky@vger.kernel.org, Ingo Molnar , Andrea Arcangeli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, Vineet Gupta , Matt Turner , linux-snps-arc@lists.infradead.org, Catalin Marinas , linux-xtensa@linux-xtensa.org, Albert Ou , Vasily Gorbik , Chris Zankel , Heiko Carstens , Johannes Weiner , linux-um@lists.infradead.org, Nicholas Piggin , Stefan Kristiansson , Richard Weinberger , linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Borislav Petkov , Al Viro , Andy Lutomirski , Paul Walmsley , Stafford Horne , Ingo Molnar , Vlastimil Babka , Richard Henderson , Brian Cai n , Michal Simek , Thomas Bogendoerfer , linux-parisc@vger.kernel.org, Max Filippov , linux-kernel@vger.kernel.org, Johannes Berg , Dinh Nguyen , linux-riscv@lists.infradead.org, Palmer Dabbelt , Sven Schnelle , linux-alpha@vger.kernel.org, Ivan Kokshaysky , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S . Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Xu Date: Mon, 30 May 2022 15:52:54 +0000 Subject: Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types Message-Id: List-Id: References: <20220527193936.30678-1-peterx@redhat.com> <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Xu Subject: Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types Date: Mon, 30 May 2022 11:52:54 -0400 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="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FLSRw1Jy++u138uHmR+3/vsNjIJLD69ZFMJsI3B6u+8=; b=YblrE10HFRvBhU 8TZaFFOq3SGIioV0VAIzeuVV1E40a1IDloa+T5lT+HZw1wrV3rViN9OHgooRhLMeJqgRejoRWPhgU GutQAurfpSXmNhD6ynMJ/dU/pDIhrgQINScS0A2DZslsX0shEt2ZZnzN+UnUzZSkLCGkej1M1IXqV RQ8zjMDdmCYkmilMSfv0miLfhXeQrDCLldVQgYLLl9S00d/muWkj9QKxg9DRXeKtT6kHAeQvdxy7P oTswHaDQDHKDgmoBNA2z3Kb7KIZBav0Sm8a1pSxSWFzPatstfM+/WQxPDRhy2jJ30/d9dUIVqneTE Cfedp/kt79o0GF4MPdKw==; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653925984; 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=YgN3kgKJ0UzknAvHl1zBxccmG3i56sV4QgvUX4eJf0Ld94UI/B3rzQ+H9H9r71ucRytUDE 7td1PYJ+GkbJCAOJz8RObrIYqARuP487sIlHwkitK2SZiJRk2NlllsX+0KBKmdVkbl9XRx SSAPhGUN1SgEKW0W6OTaMjFD1JgioAg= In-Reply-To: <33fd4731-9765-d78b-bdc3-f8243c98e81f@linux.ibm.com> Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+glpr-linux-riscv=m.gmane-mx.org@lists.infradead.org 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 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