Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940084AbdD3ErP (ORCPT ); Sun, 30 Apr 2017 00:47:15 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:35655 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940062AbdD3ErF (ORCPT ); Sun, 30 Apr 2017 00:47:05 -0400 Date: Sat, 29 Apr 2017 21:47:00 -0700 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, 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 Subject: Re: [RFC v3 03/17] mm: Introduce pte_spinlock Message-ID: <20170430044700.GF27790@bombadil.infradead.org> References: <1493308376-23851-1-git-send-email-ldufour@linux.vnet.ibm.com> <1493308376-23851-4-git-send-email-ldufour@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1493308376-23851-4-git-send-email-ldufour@linux.vnet.ibm.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 629 Lines: 18 On Thu, Apr 27, 2017 at 05:52:42PM +0200, Laurent Dufour wrote: > +++ b/mm/memory.c > @@ -2100,6 +2100,13 @@ static inline void wp_page_reuse(struct vm_fault *vmf) > pte_unmap_unlock(vmf->pte, vmf->ptl); > } > > +static bool pte_spinlock(struct vm_fault *vmf) > +{ > + vmf->ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd); > + spin_lock(vmf->ptl); > + return true; > +} To me 'pte_spinlock' is a noun, but this is really pte_spin_lock() (a verb). Actually, it's really vmf_lock_pte(). We're locking the pte referred to by this vmf. And so we should probably have a matching vmf_unlock_pte(vmf) to preserve the abstraction.