Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp82958lqn; Thu, 11 Apr 2024 14:48:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWkJ2TW2YOxxKDzJVG2fKE3v9P5lDZ3XpMFb9G9RfPOM6j7h1k1mBOmpK5sx8eq0O92eM++RLdaY5d8W2xK5z2l10B7relkyFhAleyOQ== X-Google-Smtp-Source: AGHT+IG39lpApzrN47rthqa2kNPCmaNs3DPAY0GgH6JoQywXkauLBK2/MCTzxCQC0+ibQisvy5t6 X-Received: by 2002:a17:90a:d408:b0:2a5:ffb1:debd with SMTP id r8-20020a17090ad40800b002a5ffb1debdmr765357pju.33.1712872130894; Thu, 11 Apr 2024 14:48:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712872130; cv=pass; d=google.com; s=arc-20160816; b=WlXqP0wysewNgko41x0m10gI0hXTsJzRPvZgGAh9TImCBRS9wL61sRCFCLDi/bhuxl pcsLr2aDlx+cl8VSl/kFFnoUoSET9c8yB3pGPbT8TqUSXLiAkrGK4vhPWu/AIlhxZ0yK 2J7ApT1gwOdFKhe6dBEaWTNW/nA5rsC/fba/3OzK6jOzNL04NgC0ds8LbnLYD9H9c/Mc 5xsuFtFa/KRxumHKWOhIYxrK740Xid9t5AHdZRn2YW44v/QukYR8b5hA5V8YrgASfm5f kWCNV+gCug/WP0DTCwnHk97eAsvET92bYoELPtZX4CfeBIe0PYyVbgCHe45JF/iJKsaR oePw== 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=AeVZHyp5zTZkCWGV00qc/cGGvaWCHb1eULABPjhz724=; fh=cZbsGRk1LgrqRi9xTmAjq9f2ZCspOU+kqU4QaIbTmpw=; b=VLJ8isp5McyZ0uyDIcTkB9wij4WLriBoG6uApgr5zMwF+4d2fs11l8ueTkwnYXGxlY BlA/aKMfRnngGAwQEDTDD0v3aFIVczhdLayXIEfc6gwROywGP6lgLrnXO1NrIcuePFIE dCFpOOstiILMTbd6b/c6HOZdXWc/w6V4QV7zw0N6RLEnr979+iSjPvvB082hdZa/knuM qZKcKbvaUk2lvnm2EnDaPepKbMXf6UIcYaORHmk2Q73mhSpQUyNEjLqdyZZ0A0MERkWe VDGQf0rc7fkyhfBq8n8CX5/k/ghYq6E6FmHd4WVxWSGO4lOq8WPtsUXWuE9vtgAuQPAC V8sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XNCQghwd; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-141639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141639-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o15-20020a17090a678f00b002a21bdb6034si4011658pjj.72.2024.04.11.14.48.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141639-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=@redhat.com header.s=mimecast20190719 header.b=XNCQghwd; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-141639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141639-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A32E8B22BD2 for ; Thu, 11 Apr 2024 21:47:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BF7E3D3A4; Thu, 11 Apr 2024 21:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XNCQghwd" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 9B9263D0BE for ; Thu, 11 Apr 2024 21:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712872013; cv=none; b=an9pPIFltuB71jQWHS0WD69pwPXq7rJEpEyuRViadFBhc0ew3TfItvl/zeA2yxRuwyttWbAQUzgEjNbKpf5VRZNo9z3040HfrOecjDmmaYyQ9VT88dvWBPtVE7QoHJiWT+hAWfM4SwyRbCfQzw6dHXrhPLbYyuztU5/VI0V6DB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712872013; c=relaxed/simple; bh=3qpcb4sx+uvqkoXVaq9GbAkMpl1h3tXu6keJYB+Vw8Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mD6p2XupcetpBU2ckCdi56UcQQR8lMynuDLDYyfEe3AHRsS4rfGbru9Rfkh0/ED0sMzRsgCSjxOXGFLFQzPbRARBSoxjYAPCiK7YmEXhnRg0M3AWJQrfLdOeSwcUmxMeeMEZxuaB+lBYhSW/5NlWXHIvikV6MuHiIjuBPKqFQ+I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XNCQghwd; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712872010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AeVZHyp5zTZkCWGV00qc/cGGvaWCHb1eULABPjhz724=; b=XNCQghwd1yUjKBAE/05nuWtl9ji3o9CJwufBhDYxPxUrj4mfdWPyLM9HTpbYd8UZ84oL8W j4L/RvEMOquFQnm8UiphxLQ7ZnKqSm6X9shF27HdliiGnH3cPBkTPVz6sjarJL2q/eoo5Q uo+9lYDhyhcrXHMNlbJC0CZiRV+pEXE= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-672-3lQz3klsOw2Do_2q9pvEIg-1; Thu, 11 Apr 2024 17:46:49 -0400 X-MC-Unique: 3lQz3klsOw2Do_2q9pvEIg-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-69b3101297cso1032846d6.1 for ; Thu, 11 Apr 2024 14:46:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712872008; x=1713476808; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AeVZHyp5zTZkCWGV00qc/cGGvaWCHb1eULABPjhz724=; b=jGlaZnr1FdLwrg2cZ3P8TWwfjw6Zv8cr8Mgs2Js+toDH2uo6LXCfB1iSZJEm9THXTG D0dm8c9J3iFES1n24tgNBrByJyjrQ0MvdnR7PxHAI5PNalXU5HMuA7AcHpIvudJwC+m6 pNs/xfK0ySyNSGpHDNYCiN5NrjoR41zlZdDTwU0FqDL3RqxX50ZwV/o2KGsJd5MvMota qqNJaK04rXJIZ9Xo4GktlTppFJ4SBE3cKF1HYQtmD+PHYkxSJwanOKXGBpVqDcJlf8hn 30Ynwxw6eHWlXr6z+naOb4xApIvd5MT0Q5V2g1P6lUvY6dOnEZKSpkOR7HRsE3O07tjw 3IpA== X-Forwarded-Encrypted: i=1; AJvYcCXRexNHoLMj3iKG5HHvXXYkb04bufuieWvM1NS0PSjDVn/kBfqn0QHt6SNYP/3eWE8zblIQrDh/5HCoYtR13j8+rEq33GYG0SG9wSVX X-Gm-Message-State: AOJu0YweYB0eRCmVPivNpaSAs3tT/z2kRd+83+o0yoDpuCiyOisy8ebV gqr58C0ZM2jcA+/NZReGzj4IASHzkbmwQ2hzedHl62iuzcw2jqw/hfehSXkbDqDf4EDCMLl0gxl 3tKT7meYn6B9WudMk3HVn/MJDgXovHd0nwBmGpx/2tZCShjgcNpZ0RNJEEv2vHA== X-Received: by 2002:ad4:5f48:0:b0:699:dfe:6015 with SMTP id p8-20020ad45f48000000b006990dfe6015mr881589qvg.5.1712872008348; Thu, 11 Apr 2024 14:46:48 -0700 (PDT) X-Received: by 2002:ad4:5f48:0:b0:699:dfe:6015 with SMTP id p8-20020ad45f48000000b006990dfe6015mr881570qvg.5.1712872007735; Thu, 11 Apr 2024 14:46:47 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id dm8-20020ad44e28000000b0069b4964460esm1392353qvb.82.2024.04.11.14.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:46:47 -0700 (PDT) Date: Thu, 11 Apr 2024 17:46:45 -0400 From: Peter Xu To: Matthew Wilcox 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=utf-8 Content-Disposition: inline In-Reply-To: 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? Did you even finish reading the patch at all? -- Peter Xu