Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp176743lqn; Thu, 11 Apr 2024 19:08:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDXPfhVBI6ssTkLtv/38lgTjEPVhciqQtmaO9XDYonKHAx2mlRrZPm8HwYskA7b+RmN/ZmS9a+ke6xiQ1wowg8YYCLAxyFr5I1C5wayQ== X-Google-Smtp-Source: AGHT+IHUTc8IplmjiG7pD+27JfGoV1U3wBMCi/JnsSqNPa1DHo5jl0gAh2wiHJMwpeII7EnN//wg X-Received: by 2002:a17:90b:4a8e:b0:2a5:b71c:8017 with SMTP id lp14-20020a17090b4a8e00b002a5b71c8017mr1244444pjb.42.1712887715934; Thu, 11 Apr 2024 19:08:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712887715; cv=pass; d=google.com; s=arc-20160816; b=g7fJiaB97dGzhxILUo/0fvYwSOc4XKlrIkb8v1OxCGhx7TjeObfx+J+hOW80vWt5C5 RTgylif6pzgfqxFd3TTnKf4gNKH2m6wB68zExr931FneNU1kDOz97XK/vIGLqfzsf4q1 KvBrwGXbbaFUFpOkXBzzBvjooYz1NgtSE98MEUr3Zy+UDFLqM3OhDVdAC2B7x3OKkrdQ HwXHMWtlnQVobZJSHTQFVBNYmNGvJb+0JiCXCaQtpkErzEP627O383oTnP2HzabKBfhs 7sYKZ0IOO3YxCN1MwdRnDlssyc7qXFS1uRmqDBwityvG9uaAeN+1IZ4cM7HZ0Pz/rt3Y WW6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qyhuPp9+PLD3/FaKDQyfJcp3bUMLi0OXXMTjXjpObkI=; fh=8Qvc20vK4OOvnsQL2+jKNc3cv4woB11QyyRijNFjVdM=; b=FjS0YfOZFUc/K0vtnL4PModLLZCurivvowlm/p+MUvSL2LjTQMc5eCtGHPJNF31mpF T1aQmMxbvM707TP41BmK5BQi6Ni4BCgLlXERCCsdYOoNQvITvS82obJHrnlOnZUxuXSG yt5yy83QbHJpsUfDiKyGCh0ERLrzn8H0ECERfCwk9yz/xYjKW76BqlKKdBcr9tu8qlGk GuQi+KhSyO2aY2vVb4lTqX3Li8zheTaUVf/OCh+9dnbU1y93Pw8fYiQghf4ulm0d0EAn DfzuEGkQwFWG3TjfmmuVLyn3PTf6f1AVgX1CAlK1JdSWtGj/rkRhA2xuAJdxWBBJ2ssI 5vTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=X+pN7o0A; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-141658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141658-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x8-20020a17090a8a8800b0029fff93fd91si4369019pjn.12.2024.04.11.19.08.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 19:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=X+pN7o0A; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-141658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141658-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A00FEB22869 for ; Thu, 11 Apr 2024 22:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B9F53D552; Thu, 11 Apr 2024 22:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="X+pN7o0A" 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 EF2743D3A5 for ; Thu, 11 Apr 2024 22:02:36 +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=1712872958; cv=none; b=Oo8k+O4XIJ57jtsL/ROspnr6G2/3mPmP2SQKJAmZDSBF+R0b2l74dX2x/7G7eLhQoxdxpYnxQUywQTw2f1K1if/+3naxrtiQ1uxCtX/8xia25Vb8kl/uh8z+DoF/acblug1ujxKq8e2w/LwXMENjQUEzBdPWJS0V6iJfm5wuqio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712872958; c=relaxed/simple; bh=o5FDv92MiSVG1UPFwO1anEEKKTbsvVw0Myr38bi2xUo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XzLrsTRHiKqfAZGHgutkZP227Be0t+EO0A1rFlLnSzGUW2BGEHH3bBXjme+Bw/vyd29De54UKzxzoqNx4WRDpEUA3lqAx3q2FfSuTzNkZyZE0Dr/T0AUqfTbdUm/+CVfqoslOWZH4/VimZDgQf6d+pzWuVhihxWDvh401EExfqg= 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=X+pN7o0A; 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-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qyhuPp9+PLD3/FaKDQyfJcp3bUMLi0OXXMTjXjpObkI=; b=X+pN7o0ASwJvbb8sZjisqvHc9U S1oDtJiTROq5HjdUKHRfkWVJ1cmt3HZZvlrEQ8elY3jXUbfRBWMDPY0XU63wlxzK0Go37Ph0Dvum2 MLmMIDHcvXg9td6JZodWRiXKQstQgypz+aa340w0Hcrj0QxN2N07TuZ92855ZggESqb3+d135qLQJ lUQR/ODGdTgnKb4/CW1XW5QeTpH5gX+Cp0peOKqSlpmZRjPF5j10vwWhFVCQnuuv4N4lwzvLZg0gD 1I1FDim+JToPqknbIKzovH712PVd2xoVkWuhsR8lK4aqIIgMK7JaZ73ES8CzZsckSgNDK6nZ3okNI plNROAVA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv2V6-00000007ozr-3wjA; Thu, 11 Apr 2024 22:02:33 +0000 Date: Thu, 11 Apr 2024 23:02:32 +0100 From: Matthew Wilcox To: Peter Xu Cc: "Liam R. Howlett" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Suren Baghdasaryan , Lokesh Gidra , Alistair Popple Subject: Re: [PATCH] mm: Always sanity check anon_vma first for per-vma locks Message-ID: References: <20240410170621.2011171-1-peterx@redhat.com> <20240411171319.almhz23xulg4f7op@revolver> 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=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 11, 2024 at 05:46:45PM -0400, Peter Xu wrote: > On Thu, Apr 11, 2024 at 10:27:56PM +0100, Matthew Wilcox wrote: > > On Thu, Apr 11, 2024 at 05:12:02PM -0400, Peter Xu wrote: > > > The question is whether that's intended to make it as complicated. For > > > example, why don't we check anon_vma for anonymous too later when prepare > > > anon_vma, however we do it late for file memory. AFAICT there's nothing > > > special with file memory in this case. > > > > Yes, it's absolutely intended. If anything, anon memory is the special > > case that checks up-front. > > > > Congratulations on adding additional instructions to the common case. > > I don't understand why you persist with your nonsense. Please stop. > > How many instructions it takes for a late RETRY for WRITEs to private file > mappings, fallback to mmap_sem? Doesn't matter. That happens _once_ per VMA, and it's dwarfed by the cost of allocating and initialising the COWed page. You're adding instructions to every single page fault. I'm not happy that we had to add extra instructions to the fault path for single-threaded programs, but we at least had the justification that we were improving scalability on large systems. Your excuse is "it makes the code cleaner". And honestly, I don't think it even does that. > Did you even finish reading the patch at all? Yes, I read the whole thing. It's garbage.