From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (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 99EA03B6C09 for ; Fri, 10 Jul 2026 21:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783718654; cv=none; b=sRN/A905XFuvyNybv9lMO1jW7tm8xGduB/x/015uOraFIjlbh82e7bRdjdPmZ/3kuPZn6HkJxFueXxkn9MwJQ06/vc8/jrd4NIPNzNJf5xl60hEyskLAtYKrCP+yqXOG33fGlUjY2RvSWgxIPeJHRnFdDUybRGsI7P5teRoIKjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783718654; c=relaxed/simple; bh=Yv3pRZ4OX8PGYFLQCiz3pIFR252YmyQ+OnNGPLtq1u0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Hy8Mfqk1JKRyqImDm69EwwTOoBsGEmO/KFyjtzYBJJCw3ucMqpRJAvMNSYIcf3c2EZ70HW2jukCddaGi/uFiUmyOpAOlIGuRz70XlddOI/OCwYo7Dw3PskKN9AuilEcA5BlX4cfpLeYV3EZcnTPPSXP4Za01wyyf8dhAU5qN9xs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=FL0K6NB3; arc=none smtp.client-ip=209.85.219.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="FL0K6NB3" Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-8efef6533aaso9180546d6.0 for ; Fri, 10 Jul 2026 14:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1783718651; x=1784323451; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hyoj4hjMSeCH2l8wiR4N5JqU7D2zu2bS+BNg0w05A5I=; b=FL0K6NB3hTo1xsdzE4NyALnsu64Ws+e+cSv71NFPTjSIJJhJ1lUMN+qQTXWyuIJWGm /m8gjRDZ8G9j7ziZ4jGbj32iS95QtRTsFqbZaJGDm6HyW9ScRB3knNPq6mVxEfTNXuGA lv2X/ccQX63tMmcZtGil1iChHRYYZuUY8SBq3xJprEVTwhW4fBN3mG2/WbEj1e/k/S75 QCHF+djSBHVVuXnTdMXSV029iIL1Cezyv3VJT5Q5oi+D4MPA4bMUdpqFo9tJPO/CTgTA 9yBqcMofZpygCKqEZ+FKogDFNfv421Lg6VfGw9fE+So36GtIL2zEzgJY+X1FeL2KjS7M EGoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783718651; x=1784323451; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hyoj4hjMSeCH2l8wiR4N5JqU7D2zu2bS+BNg0w05A5I=; b=N1Mam9s+cBxRIyYHplfdaVZ3d9FgvPxfQ56SGGYw3HSyrqC/qznevS7fpFaebFlkcM ITTCCT8k/62/7x1dC/ttlzkbiIWPqPaUuf3vDw7eCgSdd9sAAerrVR4U2GhV04mEK8rw DMSRX0CI1leRRe3SYx7a0qnL/JV1BzwCS6F6zeHCHaueNZS93KFVIq6X+YE6hIxPlw03 AfvGdHzzIqMhIUcoJk4EK/XuHte1MHLBvA579tDtWhNtCdLUN1NrgLZ1JKO98wiPiLUx uf3bquvkmmKVVuzVoHRxVRLlve42K0T2eEFZXDOV+A+aJzFadRgHmS4/qVjbtoWTH6hd 5x/w== X-Forwarded-Encrypted: i=1; AHgh+Rq9KaekehHuJQ1dxtBwFtYlynPRMcaXbSIl37TqOZPIl/qfi++eoof/rPVIfXwiToUs+Zyx3swX8tHfDNuqyB4p9mk=@vger.kernel.org X-Gm-Message-State: AOJu0YzVbA5UfM61Y/ULVAj46TCX5gJo8wW3G54QvxTkKDaIUXNK4blp Edfr3ZRjHFPBI/etcGL3NlZI3nWbuCvrvSMuOpKsjfZgyVEjtPkBo3F06B4dZjmXcaA= X-Gm-Gg: AfdE7clq8wE0+cPlCBEKFpxNT8iz4W7vICvWg3CBiNXyHuA6qEiTAs3VwAlj8fl0YwI I/4z9h9Hk+rOTz1j/Zl+rpRD8aQX74Wdx6GIrPNMJ7rwOvrx+aLm7pb7rA+84bJOoh8zcjRgm3W tyjrNRYZz0Zdh63d5IHQ6WcXKFsn1rLqfmDNVMET+5w0rC90JIoz/JgypL7YRmkXdbg4dzwEYoy 8pU2JpfLHhupH0Qx4so8vtfnqkfa1zO0tzLnAsQfEAeV/K4AzHtADOEpQXP0rzM6wkMWW7juilc GiJa3A4qAhw6Gp50SowmG0dQj3EKPHZ4LbGxBJCwU25W2MkvrH8TlmhcEZS+Phc61kns57v2oem 5H2JYuuavX4jcRteV8+Qual/FJhDDW+kwF0UhOAcGJXCf52aVtCQ0YXa8SROxLMVfEEJsmiVtnG vwc9Sg2nyh2X/f5wELAO2z89i3eHlhLpo59cEFWGRMce9UGaISj2L+P5dFxlEhpI0U5sBp X-Received: by 2002:a05:6214:5b10:b0:901:730f:5eab with SMTP id 6a1803df08f44-9040038208amr9843886d6.27.1783718650605; Fri, 10 Jul 2026 14:24:10 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd82e9d5csm50431486d6.41.2026.07.10.14.24.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 14:24:09 -0700 (PDT) Date: Fri, 10 Jul 2026 17:24:03 -0400 From: Gregory Price To: Lorenzo Stoakes Cc: Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Rik van Riel , Harry Yoo , Jann Horn , Lance Yang , Pedro Falcato , Russell King , Dinh Nguyen , Simon Schuster , "James E.J. Bottomley" , Helge Deller , Alexander Viro , Christian Brauner , Jan Kara , Dan Williams , Matthew Wilcox , Muchun Song , Oscar Salvador , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Miaohe Lin , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Ian Abbott , H Hartley Sweeten , Lucas Stach , Christian Gmeiner , David Airlie , Simona Vetter , Patrik Jakobsson , Jason Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Ankit Agrawal , Alex Williamson , Paolo Bonzini , Shakeel Butt , Usama Arif , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, damon@lists.linux.dev, iommu@lists.linux.dev, kasan-dev@googlegroups.com, linux-sgx@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, kvm@vger.kernel.org, Russell King Subject: Re: [PATCH v2 22/33] mm/vma: introduce vma_assert_can_modify() Message-ID: References: <20260710-b4-pre-scalable-cow-v2-0-2a5aa403d977@kernel.org> <20260710-b4-pre-scalable-cow-v2-22-2a5aa403d977@kernel.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260710-b4-pre-scalable-cow-v2-22-2a5aa403d977@kernel.org> On Fri, Jul 10, 2026 at 09:17:03PM +0100, Lorenzo Stoakes wrote: > vma_assert_write_locked() and vma_assert_attached() are useful for their > own purposes, however VMA code absolutely does allow the modification of > non-write locked VMAs if they are at that point detached (i.e. unreachable > from anywhere). > > It's therefore useful to be able to assert that a VMA is either > detached (modification doesn't matter) or write locked (you're explicitly > locked for modification). > > Therefore introduce vma_assert_can_modify() for this purpose. > > While we're here, make vma_is_attached() available generally - if > !CONFIG_PER_VMA_LOCK, then there's no sense in which a VMA is > detached (vma_mark_detached() is a noop), so have this default to true in > this case. > > Also update VMA userland tests to reflect this change, correcting the > previously open-coded vma_assert_[attached,detached]() there. > > Signed-off-by: Lorenzo Stoakes Reviewed-by: Gregory Price