Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp746132rdb; Thu, 15 Feb 2024 14:20:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhAfb7egSKIw3QLXbpYBMV68MokM+3GcF6Gx3cYYV/22/pckylFqbJ073gnQvuTflPLcFgD4oDIMbHBcgmgb/c2B89D2ivPW9NFvH/wQ== X-Google-Smtp-Source: AGHT+IGfrdbcoRI5GrKo6m3RZIRhRx/8wvV5/5ggtCJQ5D0Jdp+VVMfj9Xh5qNFLV+7E3tcWmYd1 X-Received: by 2002:a0c:cc0d:0:b0:68f:d8a:ce7b with SMTP id r13-20020a0ccc0d000000b0068f0d8ace7bmr3045476qvk.39.1708035620384; Thu, 15 Feb 2024 14:20:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035620; cv=pass; d=google.com; s=arc-20160816; b=thn9UWs4nll5s0Iua18nz4HoO4TFL3I2qTC2NeqgKehCN9USNOlRKEGgDT/wfuM3SO s1ToFTUn3YVjLzc15Nf+1HkW2lf7X+6skrQJ5cwSKcXqjT4hr10xUZ492aXf77BT8/Oq YnjbYrUFj+d7nXVD24x731wjqN20PTMGoxnZBxtjD6rhwnmsl28XhTN05pv39r7tgirZ vmFNMUHodX90iTd11TrdPqzE+kB5recqpZCuqISSb6qSiAFIAuCTjRRxX1fwZjlnlLy7 FUa91XwlemYTiUYDnZNiZcEhdCAgLmTGZG/wnp+S+2nUDnC+HPQdf5N6DvvLgkILc4BU KxYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=EIA+RVykCQtMd4uKP0jMkGSiYfomHvLOKfcmRsJzzt8=; fh=ycb1KCCSFdZ28Cjcoqx7TLgdlDJP7V08sgWZyCvr+xw=; b=B7KPPxM6HmrhEbOl+EWHgUGQCGy4ca+IUQlXbYVotUTsoBTZ3LcPjeN30i4MLn9ZG2 9k0DyFLXnU5Km151cO7CwPxDRCyW/9kTWAKK62F0SnKhiH9W4MxiHhb7bH9jIz+jjkNV qSQJ4UgH2IK34u8hc1+722TvEFqdosyL3AK6w33JwBmWoR3xxzJVu3M8mF+DrC7VHpNX w9+wwBNj2icwD0ohid5ZBOAstklZiOBuXYCz000UYT6/Ipmuo3Zst/jGFxUmp8L1o4Tj 3jLZ9k9v4woYnEht3BEr5QU8+10jLikkQ9nAuQ7gi0jvi0bsteoagZDMaPINsf6gPC0k I9bw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rLeRCuRX; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-67773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67773-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m5-20020a0562141bc500b006894f48199asi2685128qvc.359.2024.02.15.14.20.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:20:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rLeRCuRX; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-67773-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67773-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AE16D1C21461 for ; Thu, 15 Feb 2024 22:20:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18558145342; Thu, 15 Feb 2024 22:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rLeRCuRX" Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (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 BE8281419A2 for ; Thu, 15 Feb 2024 22:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708035595; cv=none; b=riVYcFkOx8YoM8Hbo5xXMvHnh0QMs1Z0B/+FmPT0glD8sJeVLnqkw9pmB/yEtnmTb3GgVh3xt7UuoqoSS8cuaTmPuppXBEhCtj0vEvh7H7q6pfQJa5u768TOKs6RIvoJRgtw8EBfZsbSDA/xjSWft3P1rwnxLWlSx5PemuB3/BA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708035595; c=relaxed/simple; bh=aF59DJKg+GxnyqLQw5fUxg2rlzvMMS+kzrvQ8I5o6Ws=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ZnQ0+bE/9Un5QGNv2U6JkgBWZtF1lQ32FqUMLrSK6S290v08VqSATMcwQ6iKAnm6slhrN5T0TpEeJQdviqXG76eN+hJyqRxQ3WCs5epaXKp0HM0FL0XdHsOaJ4Usddom7U7uBl/NAb2zWOoDaACdqU0cwgQkKbLNpeIV6XphVW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rLeRCuRX; arc=none smtp.client-ip=209.85.128.182 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=google.com Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-60495209415so14635537b3.3 for ; Thu, 15 Feb 2024 14:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708035593; x=1708640393; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EIA+RVykCQtMd4uKP0jMkGSiYfomHvLOKfcmRsJzzt8=; b=rLeRCuRXKcK1Rj3wRjnFm7dlMhDJOfW4VOdLOttjB9eTtl9P4zZFgDbbDYRjNCMpOQ 2sAvga2xfZEakbYsnnd7bjfe9Bu9Z4/Enjznm/2ivr4Asehln6I+DGgoq3R+ALnTMnez xI4kazCh33YX+RP0EJcOqDrckkL7AMdhOA0HWNS1Z8UsHHrHsTX8kJLoy7MgJG685wnc YZ56JWLJXtrdTR8Z5QKFbvi/DXOArSV3axdAOeyF5PZkdrwhG/jFeimrKsuKkBeJ2FSc 8r48k9iRVzJQ6kn9Nmer+ObPtgTMJ0U1ixcTrY9q23ZdYrPZ8MU8pmEpEqdoHlyx+zmG 7G6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708035593; x=1708640393; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EIA+RVykCQtMd4uKP0jMkGSiYfomHvLOKfcmRsJzzt8=; b=kX8em7Wq9Dbo8D2QM/1/7S1lnU7AaZGsQ8L51mwvq1KxlrzEj6lH+gTYcYk6YHm8nD doYMuCFzpHGqnQia7mR3mReJXatphzqqFxma/r+NDAIiPrHFWPxEVYo5IKy0fF4675mT nqwv2jSH94ZDfrEnHRvwG1oo065WeN9OtauOWOIh1keLAo+3rE43uMArFby9AQMd5358 jkeAVqnX7Sp62la5/9e4IP8vg374TLPTAOe7AnMpUxNGuYH3aD88uAL5jchwlkPcHpZL eAnwh2z+rkrviiHsmHW5BwcoBky4SljzqS4FcNT3uLt/t67MhRNiVmW1IL9AIZ+nJF2S dX0g== X-Forwarded-Encrypted: i=1; AJvYcCUHSi4Eq1xSBVKoCJnmQC5g5ZJ3Sy35/phw7OOl8EHnh84pF3R7i5uu0Zdpv0jYoGqpZOzcJy1MCFuS5tx9xhd8CCfwl1c+LBzqGT3B X-Gm-Message-State: AOJu0YzqrvMUn/24G7JME9ODWhPt6bn+iFp13576qiKvVYcB0NPg5HpI rhTGCS869oWbl7f3Vr7QfqGIPE5fVnY7lv01NUJoNF9DAhiQSicEAUmOfNEQxRfKo2StYD1oQjV halrw/5iDEQGjWgHqkxAbY4ZuZdboLj5i6gD+ X-Received: by 2002:a81:a103:0:b0:607:c8fe:c4c3 with SMTP id y3-20020a81a103000000b00607c8fec4c3mr3441262ywg.30.1708035592344; Thu, 15 Feb 2024 14:19:52 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240215182756.3448972-1-lokeshgidra@google.com> <20240215182756.3448972-4-lokeshgidra@google.com> In-Reply-To: <20240215182756.3448972-4-lokeshgidra@google.com> From: Suren Baghdasaryan Date: Thu, 15 Feb 2024 14:19:41 -0800 Message-ID: Subject: Re: [PATCH v7 3/4] mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK To: Lokesh Gidra Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, 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" Content-Transfer-Encoding: quoted-printable On Thu, Feb 15, 2024 at 10:28=E2=80=AFAM Lokesh Gidra 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 Reviewed-by: Suren Baghdasaryan > --- > 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 >