Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1631854lqp; Mon, 15 Apr 2024 12:02:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUceOSOvaJZe7C43UQ2M0e+YAqZAmeh24+RGWvOigZaR7y7tYzWykMSGDRsgfzWfj1/eTbF/enVRyzRlx2SEEN/odOUKnjU9Auafg25jQ== X-Google-Smtp-Source: AGHT+IE0iaJN6SNyWqSQCVoY2SEcKxm6OOQw7Hnvm2Nd2SMa5cOm7LJ0gNWJSx//RjZKal9/X7mp X-Received: by 2002:a5e:8d0f:0:b0:7d9:63c3:78c1 with SMTP id m15-20020a5e8d0f000000b007d963c378c1mr5320749ioj.12.1713207738180; Mon, 15 Apr 2024 12:02:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713207738; cv=pass; d=google.com; s=arc-20160816; b=E9yMO166EpaA6NRsfymuHSUmqrrBw0I82DGpBDD1aD8oUyjU6hux/7TGejxzLMS19L 1DTmVeYqTwOCxxSwH6RDz4VBBF1f3BuzrtoEjAnQ29qBoZxPbhRcVMrzD61+AVao0QYD Inoi9cPVtxN9PagUinihHS620PGqhp9Vg4xkFxkly1Ul5L/r64wV6/r/si3HluUN5w/V 1pjmCfnKbtb2SytO4qGxvEIaP8WRFh19aS2xC+xbJmj5A8kI5Qf4fkpsp52U7vsckZd8 pP6K0nPkR+Y0FoJMoynt29JGaJ4IFh2utZUYnPQVW4c0J9NTQAlU1pIvCxlKZZxqwxo2 mmQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ToKN62Q4GRJ7E8YeKAya0yUnhTdusOG3jL+WvWPRhf0=; fh=OdivOln3zsQk9cCmPQAJMtxdd84Bh350PO6wfvxPmrI=; b=sxKoQWnEaQZ0oiGJ+w+8DFwGV9e1Ez3HbhexBODAzEhamexcfL9ZFvLErgwryzEpDe H4LR7/WEev1XpJ/57tjvMlf7fJ6+rfBaIfn8HWAcLRXe97uaatyALJ18IZVEAX2HLewM dBFo2qBwAunTXmegUO4r9vImpZmKmVCZPfjQtjvs/Fms60ZnUYpp50NwehxCxjuauLyU UF2eZ+rCj0fkubypu8lG9wG45xn+ZuqygdWxeCc0KGqKtKjFlVY2gWUeNdTrpqLhPbEh Y1DFpJUVDQ8esLOc7q37SRxenXVmCZodj+RAux6uAnh3tWzxLNNX6BdoAX3zOqDx6/64 4v8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QvzD4Ed8; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-145527-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145527-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id v24-20020a631518000000b005dc81a6b2absi8307154pgl.792.2024.04.15.12.02.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145527-linux.lists.archive=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=@infradead.org header.s=casper.20170209 header.b=QvzD4Ed8; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-145527-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145527-linux.lists.archive=gmail.com@vger.kernel.org" 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 6C26D2874A2 for ; Mon, 15 Apr 2024 16:15:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31D2283CB9; Mon, 15 Apr 2024 16:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QvzD4Ed8" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 789A983CA3 for ; Mon, 15 Apr 2024 16:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713197622; cv=none; b=BtDL8M6ejAHxvonxvx0Id000fEcfocoUOACUCpBJQkJ0EZaFRVS7Omlo8AjMkvoUfd+FFau20O9xL5LYqOvoGogvcNwet1ZPlugFZ7Pycc8+Y7SJxz8T3nxno+nwc9xOl/pIhE+tdrlrbWtiCbk6VUFB4CPzkSUKxjpmNRHKres= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713197622; c=relaxed/simple; bh=mCtIHA1LTE9G3LpB5/RUpWQ2ODFbnnTQSX6/5fhGGKs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cdCRY3QoO6o22YntRtUIeW5n4EDK7i2mPd7oHxM+baPSUREF6e8QqL6h+KdCqhcGl6ij07i7eeBQjqprvmumQ9GPwqtZZm1sUqNSPW49aOgqkR0+ePh402+kUTp7PMcZXPdw0Qa9Bi2wjRRQdjYu1Z3PQozJiALc7YtHQtR3JMY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=QvzD4Ed8; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=ToKN62Q4GRJ7E8YeKAya0yUnhTdusOG3jL+WvWPRhf0=; b=QvzD4Ed83WoTy91rCtph5mP5cd PnmU/2eX9kih8oIA/e9N3SEwKXVFZUV7j2gg4xBemcc5NFhmPkK4P+LczOHZeWgx7azYWsdsIyOtr CXwxOawZhCOvSP3pO8gc0nHijUCNdUcezi0MUtrwAJuKVAqQwWu4KC1PoVyICvaC9HgXi00/NBYfa YWZ6VHRRO/vsehnGmGSNfTOESwgatnNt5FQbm6h1LY6OI/KjYWaPzL5I5ng0QsWcTQaHWR6Vp3DRW ReEgxuPxIwbF8N0BfUmCDlw1zXTDgU6a/EpKXieX8MyWMmcoGY89Oh38GKHBHnMO+keqjJGMIJPU2 vZfz98DQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwOxc-0000000G2ku-37Np; Mon, 15 Apr 2024 16:13:36 +0000 Date: Mon, 15 Apr 2024 17:13:36 +0100 From: Matthew Wilcox To: Suren Baghdasaryan Cc: Peter Xu , "Liam R. Howlett" , LKML , linux-mm@kvack.org, Andrew Morton , Lokesh Gidra , Alistair Popple Subject: Re: [PATCH] mm: Always sanity check anon_vma first for per-vma locks Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Apr 15, 2024 at 08:58:28AM -0700, Suren Baghdasaryan wrote: > On Fri, Apr 12, 2024 at 8:19 AM Matthew Wilcox wrote: > > > > On Fri, Apr 12, 2024 at 09:53:29AM -0500, Suren Baghdasaryan wrote: > > > Unless vmf_anon_prepare() already explains why vma->anon_vma poses a > > > problem for per-vma locks, we should have an explanation there. This > > > comment would serve that purpose IMO. > > > > I'll do you one better; here's some nice kernel-doc for > > vmd_anon_prepare(): > > I was looking at the find_tcp_vma(), which seems to be the only other > place where lock_vma_under_rcu() is currently used. I think it's used > there only for file-backed pages, so I don't think your change affects > that usecase but this makes me think that we should have some kind of > a warning for lock_vma_under_rcu() future users... Maybe your addition > of mmap_assert_locked() inside __anon_vma_prepare() is enough. Please > don't forget to include that assertion into your final patch. That's patch 1/3 on the git branch I pointed you to. The tcp vma is not file backed, but I'm pretty sure that COW is not something they want, so there's never an anon_vma. It's for pages that contain received TCP packets; ie it's mmaped TCP.