Message ID | 20240215182756.3448972-4-lokeshgidra@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-67513-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp41637dyb; Thu, 15 Feb 2024 10:34:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW9Itnfxb41hb4xtLsGhqmrURPx0lo3IJrAtOZmE8YoS2AByEgeuuyfnX66/HseKAfRGVVGwKmJlpVmXfvDb/7sQL6HcQ== X-Google-Smtp-Source: AGHT+IF+QfdE2MWUBgfSz61Ii0400yiTsVinmrJS7g9fEoTP9Frs/XBZxajsWv9nD28YZ9SbM/Sq X-Received: by 2002:a92:c263:0:b0:363:a992:2ec9 with SMTP id h3-20020a92c263000000b00363a9922ec9mr3438605ild.21.1708022057249; Thu, 15 Feb 2024 10:34:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708022057; cv=pass; d=google.com; s=arc-20160816; b=hWv4Rbtp67Cb4CRORqi+rRAWxbo/mwRxJh88VUS9bWt6LElk3l+YQLFqFjV/upGXZU OcsIz/1m44OZhELsRCW8KlUiA0TKrvRt6XcsegYwfhEmqgREMXzYMjGECEcKVolNYZhV wEyYJfalJw9BYyT8nyQq3ycGmvk2OZm/U7bzRQMiY++UAy/ufsOkM69bCwjYwCNZxqft OX+O83tLuZyB3QHwZ+gA4ZTv4OcnNYZKnnBskF2H5hyI+haRnF+bfAUmcfZAueyMZZQf PrnbgWDxjRxhyqUKs5J/mEoOEiManvE+UNw8DK/Q6eLbBuG+cp+586P1YfQUj+P1850S TZgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=2HDhVk/yBydR+FOGweImS2i3jLRp26hrWRjwdpWJGjA=; fh=jLe3Yagh4JblYVw5v1Jgez9szeyOGGU/s2jlQIaPvdY=; b=KFhT5oE9NrFoIRgLZrh6WovIQKe849X0MmDXGJhMLZMPH5JS9IBo7HvckhtEWJZjzO saow5/mAh3hB8kuS1CGKkgckutUQrnB6LgFoORloT3AZYM5QAZuN9PPhvyv97MuZnPyQ gLYxa1rheuhBMnkc5RnXVYr4Tckr0cClB3e799icAhJP42c2HeSzs/1DuiqvUivawUg2 9+PQyrTjlRUtULjRNYu5+CJc53J+mXxJ1ayVSKVVu9Lb15h964LpaVvaGRq4vOSvOMlw MAEZATnUwsg3PWYtdBYuaGrIWsx0TjAZ9uqR3TSJI3CWchH+AeT4zHfn1ewhgLeXrtsM xV4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0rTxfC+e; arc=pass (i=1 spf=pass spfdomain=flex--lokeshgidra.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-67513-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67513-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s63-20020a635e42000000b005dc50696f28si1464355pgb.725.2024.02.15.10.34.17 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 10:34:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67513-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0rTxfC+e; arc=pass (i=1 spf=pass spfdomain=flex--lokeshgidra.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-67513-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67513-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 12DC328FB04 for <ouuuleilei@gmail.com>; Thu, 15 Feb 2024 18:34:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B802A1487D7; Thu, 15 Feb 2024 18:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0rTxfC+e" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 579E11482EA for <linux-kernel@vger.kernel.org>; Thu, 15 Feb 2024 18:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708021696; cv=none; b=jx1JV/KkfYVvOOdGA2qOkH+xeWTU+9TjddT5IWBeo6ZKc0lSs/nITcLPzCtFPndOEGLGs4zTeN787icsnRPQ8TbOig9HGglsAUcMuV7DRZRRoqGSyGHxyCj//eUtvCONDqAjO7qRQI2yRonNi0gEO0UwbgCSIHgiQW2vj/ck+cU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708021696; c=relaxed/simple; bh=LpW+SzLj8BfVDIjFaKNHL0Ok3LPjc7UMqw1W2Wqi+nY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=K6H2n+QrJmcMjrlAe7YwOKNOeiyEbD+z++nfeY99JpSQjmbyh3LEqOULugB/Jwy2QiM2OTxJmjZxdLVU/8n0vrKQQpmoQBlqIYNpvnylihYcL/HK8rkOLaRoU9wHJ3W+AYt6mkFeht+fN1QbBMP7psw9RfKqKdsN4ZPwdNHoowY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--lokeshgidra.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=0rTxfC+e; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--lokeshgidra.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b267bf11so1474663276.2 for <linux-kernel@vger.kernel.org>; Thu, 15 Feb 2024 10:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708021694; x=1708626494; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2HDhVk/yBydR+FOGweImS2i3jLRp26hrWRjwdpWJGjA=; b=0rTxfC+eTBDYH3Z1M1HqIJWn7Goozw3FI73wRLEb0mMZCv227NJ6Ri02Y0Z3mA3/vY a/Q1gOxnf+xbG1REHzcTfer0LijnkT71tgOZVGfWDSGWqisQaHgJHjtgV/a0kRpLVrKI EumlOVtRD+jLj1IfQLimb/xRrYEWgEcctfFTFAb+8YyTmkdX4rlMENhpUb5xp35kvplu bnJcC1mYIyj48eUGY327JRxynEVLyeGjggw2YkMN1prqxqmkp5QBoS1rUtZC8axeVfR7 dZlVHtHctDe3+lOBqhnAffys4JnLG/4t2r4fC5bNDCYGlp8T3z8hawDo0J6XUyTzbl6h D2iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708021694; x=1708626494; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2HDhVk/yBydR+FOGweImS2i3jLRp26hrWRjwdpWJGjA=; b=r4ySstuf65LmRRxf4jEAqYOrq4U/gU+Mp/oVgJtDBgafNL5WqLyPioByQGj2ZVF5nj jy7EEwAhNIX9oSriKCn2bPtR6IOfU9eAikaTk2kxJRYh5V9qY/QfZIO8kiSkne7PrIXc fywX6Z/ASCui7GZie8HLnMBAElrvveYHGgVJftrWnCPrRc+bTnX/trYsicudFA2cGt6h yLBhjPPQSdJm18NJA8SYQTy/mcbSI6PweFxjvNTmA9+hLyzAe+5hnIzFhnVTFB2AQj8l htNn5F16NhjBJeZnIrN0gkBwm17IlcNrd+2U5Hp2feB/wI7L2Le7yrbbLOONzEq02qI+ qbTQ== X-Forwarded-Encrypted: i=1; AJvYcCWcQSXWofuXYX7TncJ6o5CkhdWc83svdgjFUunAc19qErQ+gAMFoB3oaS11VCfnui1kq64diMb8AlcCPF/tXeKSlIKHjKnYisEmTm86 X-Gm-Message-State: AOJu0Yxp8WN0ZGocthjm/+zgUNouTb4kOaPcnOmu0dPermOAQut/NreJ A3VnQCUfDzrOYnmnVhaZ8ZuwBDHjvlvnWEoZX+ZcwYcPDt2s5SKItlbQI2+t8BIouz4CHieO5WG 2XM6sGpyyPIvFkHtgZQkCIg== X-Received: from lg.mtv.corp.google.com ([2620:15c:211:202:6186:87a3:6b94:9b81]) (user=lokeshgidra job=sendgmr) by 2002:a05:6902:100a:b0:dc6:c94e:fb85 with SMTP id w10-20020a056902100a00b00dc6c94efb85mr101286ybt.2.1708021694438; Thu, 15 Feb 2024 10:28:14 -0800 (PST) Date: Thu, 15 Feb 2024 10:27:55 -0800 In-Reply-To: <20240215182756.3448972-1-lokeshgidra@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240215182756.3448972-1-lokeshgidra@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240215182756.3448972-4-lokeshgidra@google.com> Subject: [PATCH v7 3/4] mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK From: Lokesh Gidra <lokeshgidra@google.com> To: akpm@linux-foundation.org Cc: lokeshgidra@google.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, surenb@google.com, kernel-team@android.com, aarcange@redhat.com, peterx@redhat.com, david@redhat.com, axelrasmussen@google.com, bgeffon@google.com, willy@infradead.org, jannh@google.com, kaleshsingh@google.com, ngeoffray@google.com, timmurray@google.com, rppt@kernel.org, Liam.Howlett@oracle.com, ryan.roberts@arm.com Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790990936585840521 X-GMAIL-MSGID: 1790990936585840521 |
Series |
per-vma locks in userfaultfd
|
|
Commit Message
Lokesh Gidra
Feb. 15, 2024, 6:27 p.m. UTC
vma_assert_locked() is needed to replace mmap_assert_locked() once we
start using per-vma locks in userfaultfd operations.
In !CONFIG_PER_VMA_LOCK case when mm is locked, it implies that the
given VMA is locked.
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
---
include/linux/mm.h | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Thu, Feb 15, 2024 at 10:28 AM Lokesh Gidra <lokeshgidra@google.com> wrote: > > vma_assert_locked() is needed to replace mmap_assert_locked() once we > start using per-vma locks in userfaultfd operations. > > In !CONFIG_PER_VMA_LOCK case when mm is locked, it implies that the > given VMA is locked. Yes, makes sense. With per-vma locks used in more places, this makes replacing mmap_assert_locked() with vma_assert_locked() very straight-forward. > > Signed-off-by: Lokesh Gidra <lokeshgidra@google.com> Reviewed-by: Suren Baghdasaryan <surenb@google.com> > --- > include/linux/mm.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 3c85634b186c..5ece3ad34ef8 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -781,6 +781,11 @@ static inline struct vm_area_struct *lock_vma_under_rcu(struct mm_struct *mm, > return NULL; > } > > +static inline void vma_assert_locked(struct vm_area_struct *vma) > +{ > + mmap_assert_locked(vma->vm_mm); > +} > + > static inline void release_fault_lock(struct vm_fault *vmf) > { > mmap_read_unlock(vmf->vma->vm_mm); > -- > 2.43.0.687.g38aa6559b0-goog >
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3c85634b186c..5ece3ad34ef8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -781,6 +781,11 @@ static inline struct vm_area_struct *lock_vma_under_rcu(struct mm_struct *mm, return NULL; } +static inline void vma_assert_locked(struct vm_area_struct *vma) +{ + mmap_assert_locked(vma->vm_mm); +} + static inline void release_fault_lock(struct vm_fault *vmf) { mmap_read_unlock(vmf->vma->vm_mm);