Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp110886lqp; Thu, 4 Apr 2024 08:17:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVcSrIfrjIhKT4QQ1pljabm2J17mVCDgsZ9TGo+RwQjBq6mJ5NBBrKVDEnjAMq6Z/tWMSFZvIwHa9OIo9occwGzW0dbpe317UNhWiOENw== X-Google-Smtp-Source: AGHT+IGQeFsLLxSS+JWHD6fg4jD+6NCD55iV1tsykGzdV8sBnrercdYu6PHVcIl5m1og6Ui39uXI X-Received: by 2002:a05:620a:28c2:b0:78a:1fa4:6e42 with SMTP id l2-20020a05620a28c200b0078a1fa46e42mr3238914qkp.57.1712243878439; Thu, 04 Apr 2024 08:17:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712243878; cv=pass; d=google.com; s=arc-20160816; b=pKhKPx4rS7HcKCXTN0ZrD2ZTK6jqLC/BfOMk5c63yT/4Y3CR3VNdtI1h2ZcGOgNaI7 ZRtr71Lt8pQcFWtG5qSMK27cBT7rwj8OEh/ADoydSpKNIssaNfJXgKhomU1Oha2bPXFe o9Gy06y7FblcWyeasnIqjomrnidOU6pA/7itVCKIXV4VfXPSrZuHp59py55vqrdnLA1M 7HAdFS2Fj8pgwvW1oLGXFiuo5kbiH40cL5XgeJdH0GDL8disWJDIdvbSuXxeWsEBmZAY unvnOrsH08fQALKlNjSdg0ejM69eizgx471C3sf1Dl6Amc5tuBR2M6PKFuMMOJ+W4Tmx PnqA== 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=sVJ002JHdkLNVhuos8JSEWKr9RAprOh6aTEVsWZAYDA=; fh=qSsN55soQtUTTxS89nQBoPvdzkU3dZl1frEGb151BvE=; b=GzKEATw7hd1QFcvPzdBRWykLTXXbnN+ofrpGZMxgM0j6rm3r/buSjI8MYnmoBN8Mbv RO1+1an8JdCCSGhNGV5o4vW2X5Ofo/x+6nWf+tZg/QFPO0+3P9JxkZBxNlWMTU3w8G5Q zHTFacPT9RJX2bp9l9DCuNl7LS0nkGkBQTi+POB9jG2Q5DO/EBK7eof+McAAWKUK7rPa RjLtE2n4tBWCeOmJtgLqc1dS3dmQLmFvSrj8yAsnpi8bdg6EuCXxh5PLSxztLBwYYPgY CgRSgFQC+mQLARM1w5O5rz0NvhW0K/rsrhCmWHL9fYsZMiLuKjADlDl9eGaAiMy8FVnE tzlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iDEQ9byq; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-131553-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131553-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id vr6-20020a05620a55a600b0078a663d6c5bsi16566122qkn.655.2024.04.04.08.17.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 08:17:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131553-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=@infradead.org header.s=casper.20170209 header.b=iDEQ9byq; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-131553-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131553-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0CE7F1C25621 for ; Thu, 4 Apr 2024 14:06:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B95D129E8A; Thu, 4 Apr 2024 14:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iDEQ9byq" 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 359921292D7; Thu, 4 Apr 2024 14:06:29 +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=1712239590; cv=none; b=ekexysTKENfRhJbDXX5C52h12iJcPJPvQV7vD2YVUjP8RbWi7eKSRtM+jJS6ZlvDZoC9cf0Uy3mu1Hu8JOmMGwipgu8palt9uxxrEXdKjsg3+qFDAJ0QhgJ92lv9NzL9iqwUO69vaDkBmOUixBVBbJ5rNMU6soLORVXyjglY3mU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712239590; c=relaxed/simple; bh=MbY25kFZkVxbZu7ufPpiDQkctinsqlipZvgNEaQGk/w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DSgrpTzLkuRE55e+c5gcirXLnklPi5clRLDQmYodIgN8YVoKmAYSN9VbPNA2vntx0a775yKPGM0JKI0snadkp6/Ezd5x/0vMVmRg+bOfhNYy/GGiPSxQYwo/MJH+ycNEqJ2/jC5LdWumESJxre6Gcu4HaeTbaAuliE0Gci86U1E= 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=iDEQ9byq; 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=sVJ002JHdkLNVhuos8JSEWKr9RAprOh6aTEVsWZAYDA=; b=iDEQ9byqBGmCHW//1SL2Od/+ch 6mxZ1jsEjhNVNL75sNOFwsASFH5YqKtz411s4ZeBeMyINg0MeJoO4IgCx22+IHMYedIitICT+aGpy seGTx0eTzb+dR5FWcCMyawwoRVpkXHEH1B3A4uWv5MdObQGhFMUb7XcMOsCO2BJT/2sVtQNGuEgCb MYF8Zs7+irbsazzHnXGQ8L0LgImDGgwTT1AF82aATaW6Vdh9bVNZOfROFIsqnV458DeF5ogs07DgE z2Lfw7pwwftG3FPk/jft60jNuc68yO5T5UchmMDis6DVMrl1wi4mR5J1mxg8o0bcaDOVUYh79+MpT I0VtV83Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsNjV-00000008BlB-1hxh; Thu, 04 Apr 2024 14:06:25 +0000 Date: Thu, 4 Apr 2024 15:06:25 +0100 From: Matthew Wilcox To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huacai Chen , David Hildenbrand , Jason Gunthorpe , Nathan Chancellor , Andrew Morton , WANG Xuerui , Ryan Roberts , loongarch@lists.linux.dev Subject: Re: [PATCH 1/3] mm: Allow anon exclusive check over hugetlb tail pages Message-ID: References: <20240403013249.1418299-1-peterx@redhat.com> <20240403013249.1418299-2-peterx@redhat.com> 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 04, 2024 at 09:45:58AM -0400, Peter Xu wrote: > On Thu, Apr 04, 2024 at 01:05:57AM +0100, Matthew Wilcox wrote: > > if (PageHuge(page)) > > page = compound_head(page); > > I would think PageHead() check would help us to avoid compound_head() on > heads, which should still be the majority cases iiuc (assuming page->flags > is already around in the cache anyway). I've no strong opinion though, as > I can hardly tell a difference in reality. compound_head() includes a check for PageHead(). Adding the check just makes things slower.