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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 779EBC433F5 for ; Mon, 30 May 2022 16:01:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFBBA6B0071; Mon, 30 May 2022 12:01:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA94E6B0072; Mon, 30 May 2022 12:01:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D48E96B0073; Mon, 30 May 2022 12:01:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C50246B0071 for ; Mon, 30 May 2022 12:01:01 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8AEAEC56 for ; Mon, 30 May 2022 16:01:01 +0000 (UTC) X-FDA: 79522873122.24.9D87965 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 099C040046 for ; Mon, 30 May 2022 16:00:48 +0000 (UTC) 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-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-120-rrxYfLmcPTqdBfbmrSGBLg-1; Mon, 30 May 2022 12:00:59 -0400 X-MC-Unique: rrxYfLmcPTqdBfbmrSGBLg-1 Received: by mail-io1-f71.google.com with SMTP id y12-20020a5e920c000000b006657a63c653so5664448iop.11 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=xJpse6RigJG+Zbu8Fvnd6Nv060lpkaV4RfHQO7iAKPFNWNcR66dxUKwPaDWjTQc4+w unk3Az170iZ5g8+wQgJeLxi0rPexFUONCjmkstkcyoLae6yRU3MhgvnLX+kVFSPtiGex oHLMLe2TkSPLf4hpS7lpXnfjjSpdHYL19Q/L7taS1PLropMnvCklNd4J+gM61JO7Lwv3 suQqgU/XTKSsqc/X6kBtxr8DCo0b58PpwzGoYxL93NEiwvqFd8AGRRpUKJDQeZzwF1Ym JkjYP+7m7FBaDcSGfW4W1JvL66lTjTUQvLHDQNYqYImzXc5tgP+OUlFiSMxchRuxt0Lm 7MKw== X-Gm-Message-State: AOAM530Or9rWw2WmE+Z2NBbsJ00Z+qg1L/HdhH7HRIwhRqCAAdU2qFki IGglGRl85fLTFuU+sfEkRczCn9WzWS/RYDljDgsD59aKcsocTg1dDBbX1pZR8qmdoPzQ0OrFh7F U9YOXnvRnmeU= X-Received: by 2002:a05:6e02:1648:b0:2cd:fe43:39db with SMTP id v8-20020a056e02164800b002cdfe4339dbmr30191749ilu.172.1653926458629; 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 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OAlzTeE5; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf07.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 099C040046 X-Stat-Signature: yseynd873sszqtqagexzwf6gsf3oeg1e X-Rspam-User: X-HE-Tag: 1653926448-518424 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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