Received: by 10.223.176.5 with SMTP id f5csp2006431wra; Thu, 8 Feb 2018 07:02:53 -0800 (PST) X-Google-Smtp-Source: AH8x226jiJklOjFmscgzMdypNpwdK42asN0Au37N7SBKZX7yE3Sn1VfwCsbBhfv8wb1RPavHcfgc X-Received: by 2002:a17:902:20e8:: with SMTP id v37-v6mr923044plg.66.1518102173793; Thu, 08 Feb 2018 07:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518102173; cv=none; d=google.com; s=arc-20160816; b=omJj0AsF+hYHfEp3GIZGNJKUqWyd2IJ/57da/RT7Yv56qZGvGsEc3Pp02EjGHtiR6+ r3U4dGqeZwaZdPpECIzTM1LB2YcOWOSceHnYaFEfyr9oczXf4sdWX5UWJicveluZK09Y UEgWP3eWLQtiUPyrt3ibHBUWaUVZEkR45LRTS3A7MLJlWvyjZFOEXBTiQPRS7pKWZDFf 9n2l2Qi1Q8WHt4ehMt1++7u26rYgaLIaJb1UalSvco+0X/0h9yFFy9TONLSnikPRPG7Q WUPhaOGd1pOznb9+6AnmAIido9wWpg0XLoXuzHJG3iT8lCDKjO/kfo5B7ALHITI9+pNM 8Wpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=AsfoMJSEhsrDLMxmAkhVO8VwmBKV+3PmIE2TdwxcSZg=; b=qAq6Ae7B3axAeAli2Azo0RYqUry0PS+xvKRDa97KezsSkgzcgNXkECPpWJmo8kRZyZ lsdbBZ1hHNv86PoM93tjbQ+kLy4/2PLoR12gojxIzqKiqxFaf+Iwi4F8ar2JxPubO8n+ VnF3RQasN5O/wlu/lZOrvr1pbK0tLnwMzAoddQxfLgTLNt2W2CEhF3z4t558VHgr+EdV NCfinFUQxuUsPrxBedWjBoDj8/qbxpJZ9pHIIp2+Sxwvr1VAglJabv9t3pEITmy+Ut9h zJncIfdwHk4t3dAuCjZHDMPMY70Dn408hpJPz9446GFv77QvrhMop5XAbV51GqT1imaC wR/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=S5pmdAPB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67-v6si31443ple.609.2018.02.08.07.02.26; Thu, 08 Feb 2018 07:02:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=S5pmdAPB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751788AbeBHPBQ (ORCPT + 99 others); Thu, 8 Feb 2018 10:01:16 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:34025 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbeBHPBO (ORCPT ); Thu, 8 Feb 2018 10:01:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AsfoMJSEhsrDLMxmAkhVO8VwmBKV+3PmIE2TdwxcSZg=; b=S5pmdAPBUxWGQR9im79VstAGu MeLw1JWC5phEGADXdY/KJLr9zq0M7H3rw8q9gkqusgwW5O3TaIgiT37f/MLIY2csETw/A7yrvYpq0 Upn6eqAJKboiHVrEquHNqMVq2/iyX9KPvQIVUNzzbkTzmZpCxcOuan5IiDvCFrenKBK05ocEdlauP wEzVbUavcof18CGn5EvJwUXS5GlEpqVPAs/gWIMG1d/PKo/pmCzb8J20tfn8FmbsbC/K9mnCtjRFQ ACMV5RjxryBCUJGQ5BJynaHqlfi/UAcGwZFd/O+AlGkrzdaK2DH7DgYFwl12P0Q/O8XW3SdFOZ4dO XwyNH5nHw==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ejngX-0007UW-Ns; Thu, 08 Feb 2018 15:00:25 +0000 Date: Thu, 8 Feb 2018 07:00:25 -0800 From: Matthew Wilcox To: Laurent Dufour Cc: paulmck@linux.vnet.ibm.com, peterz@infradead.org, akpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, sergey.senozhatsky.work@gmail.com, Daniel Jordan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v7 04/24] mm: Dont assume page-table invariance during faults Message-ID: <20180208150025.GD15846@bombadil.infradead.org> References: <1517935810-31177-1-git-send-email-ldufour@linux.vnet.ibm.com> <1517935810-31177-5-git-send-email-ldufour@linux.vnet.ibm.com> <20180206202831.GB16511@bombadil.infradead.org> <484242d8-e632-9e39-5c99-2e1b4b3b69a5@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <484242d8-e632-9e39-5c99-2e1b4b3b69a5@linux.vnet.ibm.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 08, 2018 at 03:35:58PM +0100, Laurent Dufour wrote: > I reviewed that part of code, and I think I could now change the way > pte_unmap_safe() is checking for the pte's value. Since we now have all the > needed details in the vm_fault structure, I will pass it to > pte_unamp_same() and deal with the VMA checks when locking for the pte as > it is done in the other part of the page fault handler by calling > pte_spinlock(). This does indeed look much better! Thank you! > This means that this patch will be dropped, and pte_unmap_same() will become : > > static inline int pte_unmap_same(struct vm_fault *vmf, int *same) > { > int ret = 0; > > *same = 1; > #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) > if (sizeof(pte_t) > sizeof(unsigned long)) { > if (pte_spinlock(vmf)) { > *same = pte_same(*vmf->pte, vmf->orig_pte); > spin_unlock(vmf->ptl); > } > else > ret = VM_FAULT_RETRY; > } > #endif > pte_unmap(vmf->pte); > return ret; > } I'm not a huge fan of auxiliary return values. Perhaps we could do this instead: ret = pte_unmap_same(vmf); if (ret != VM_FAULT_NOTSAME) { if (page) put_page(page); goto out; } ret = 0; (we have a lot of unused bits in VM_FAULT_, so adding a new one shouldn't be a big deal)