Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1060823ybk; Wed, 20 May 2020 20:24:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTRFaRcgWzqTUroUrpJ/iMbaZpZuJYFCzU+PPKNFAhTDb4cK3gQPIdAWj/Qjimd5B5oELF X-Received: by 2002:a17:906:409:: with SMTP id d9mr1714218eja.445.1590031478283; Wed, 20 May 2020 20:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590031478; cv=none; d=google.com; s=arc-20160816; b=VW4ycKR8d0GZBCx7y5BQgw6cLnaOY+4CxKhDcsUxVDWWq20uSpmNWoyZKXW6LhiAfZ rdCf2si9WRQiLBLPTb9YyvcQiDncRQqYluhvG0MHWbzpXRSxkI4N0dJCy36tDLadWo80 0ty6dL5LhSUC13D3lq6pcJV0wSImilkdYKfq3bf0Sjloflg6Oby/MGAnoLCKMSONPVza xjse0y22PUMTDFg46nYVP5BuUF+dFe3gUspRNkThB6EmVFXXGXZPMtviaxPE634yEZfs LEMDZ7QpSGaIf40Dlna/pWuVDnp8UIbGxAq/NIz5s1lQuwgXMP74cfeEIXeWpjYVW+mx LbhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SBihGV6qIOA8mJL4acZ7In8CaSBeq5RRaSsrGHj8Xuk=; b=SPQMrqAnikZinMHE/Df0w9PQeOK2BNmCxCxa6qDsTer+BrcrW9C1WnaxhW4xIiH2gR FOR3GvYLdSSluY1n+cFmGUW763J4q3BJefqfuVkGGpwadKyNrKGZG8hcNCrgRBExZbZn jWNWfvSJzqrOfPV/QCzCkhlDVea8qMRW8nIhjX/sGBlGOi6yZHPB5Ulwd+ykxyDKSdod l8+sUHDqpLnhlgxKAaxj3PBshvxLGQFgEV2fwUlkttmoG3Yxii/Aj/ZIX45gMP9TjIo4 pK8ljV5BUufjEGPcWLECCpQYS9tre/wJm+/IlRzPPoMo/ThzaXk03YmKPyZaV6YYmEn9 accA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GmGcqKEX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si2647422eja.536.2020.05.20.20.24.14; Wed, 20 May 2020 20:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GmGcqKEX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728015AbgEUDWp (ORCPT + 99 others); Wed, 20 May 2020 23:22:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:60146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgEUDWo (ORCPT ); Wed, 20 May 2020 23:22:44 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 44F7020709; Thu, 21 May 2020 03:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590031363; bh=CZ1I0nklSnkaDJwauZgG+9Dbgoyu9fZHiW90vV3R5W0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GmGcqKEXOlWyyxcYWYYL1pBDOUeUPB2f8ABMVVPGP6m2d0fV+ZAcsnUyRPCJvuE5X m0moyJC1vKRetNb30ghtKWYkeLZIZdv5+emYSimOqBAEBcNvn08mDS/Pci13cMkRCD bW2glvtmkRitz82QDNcRFeW/M3vRBUFs6cMUH93k= Date: Wed, 20 May 2020 20:22:42 -0700 From: Andrew Morton To: Michel Lespinasse Cc: linux-mm , LKML , Peter Zijlstra , Laurent Dufour , Vlastimil Babka , Matthew Wilcox , Liam Howlett , Jerome Glisse , Davidlohr Bueso , David Rientjes , Hugh Dickins , Ying Han , Jason Gunthorpe , Daniel Jordan , John Hubbard Subject: Re: [PATCH v6 12/12] mmap locking API: convert mmap_sem comments Message-Id: <20200520202242.dec6b520f0bab4a66a510d73@linux-foundation.org> In-Reply-To: <20200520052908.204642-13-walken@google.com> References: <20200520052908.204642-1-walken@google.com> <20200520052908.204642-13-walken@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 May 2020 22:29:08 -0700 Michel Lespinasse wrote: > Convert comments that reference mmap_sem to reference mmap_lock instead. This may not be complete.. From: Andrew Morton Subject: mmap-locking-api-convert-mmap_sem-comments-fix fix up linux-next leftovers Cc: Daniel Jordan Cc: Davidlohr Bueso Cc: David Rientjes Cc: Hugh Dickins Cc: Jason Gunthorpe Cc: Jerome Glisse Cc: John Hubbard Cc: Laurent Dufour Cc: Liam Howlett Cc: Matthew Wilcox Cc: Michel Lespinasse Cc: Peter Zijlstra Cc: Vlastimil Babka Cc: Ying Han Signed-off-by: Andrew Morton --- arch/powerpc/mm/fault.c | 2 +- include/linux/pgtable.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/arch/powerpc/mm/fault.c~mmap-locking-api-convert-mmap_sem-comments-fix +++ a/arch/powerpc/mm/fault.c @@ -138,7 +138,7 @@ static noinline int bad_access_pkey(stru * 2. T1 : set AMR to deny access to pkey=4, touches, page * 3. T1 : faults... * 4. T2: mprotect_key(foo, PAGE_SIZE, pkey=5); - * 5. T1 : enters fault handler, takes mmap_sem, etc... + * 5. T1 : enters fault handler, takes mmap_lock, etc... * 6. T1 : reaches here, sees vma_pkey(vma)=5, when we really * faulted on a pte with its pkey=4. */ --- a/include/linux/pgtable.h~mmap-locking-api-convert-mmap_sem-comments-fix +++ a/include/linux/pgtable.h @@ -1101,11 +1101,11 @@ static inline pmd_t pmd_read_atomic(pmd_ #endif /* * This function is meant to be used by sites walking pagetables with - * the mmap_sem hold in read mode to protect against MADV_DONTNEED and + * the mmap_lock held in read mode to protect against MADV_DONTNEED and * transhuge page faults. MADV_DONTNEED can convert a transhuge pmd * into a null pmd and the transhuge page fault can convert a null pmd * into an hugepmd or into a regular pmd (if the hugepage allocation - * fails). While holding the mmap_sem in read mode the pmd becomes + * fails). While holding the mmap_lock in read mode the pmd becomes * stable and stops changing under us only if it's not null and not a * transhuge pmd. When those races occurs and this function makes a * difference vs the standard pmd_none_or_clear_bad, the result is @@ -1115,7 +1115,7 @@ static inline pmd_t pmd_read_atomic(pmd_ * * For 32bit kernels with a 64bit large pmd_t this automatically takes * care of reading the pmd atomically to avoid SMP race conditions - * against pmd_populate() when the mmap_sem is hold for reading by the + * against pmd_populate() when the mmap_lock is hold for reading by the * caller (a special atomic read not done by "gcc" as in the generic * version above, is also needed when THP is disabled because the page * fault can populate the pmd from under us). _