Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp71716lqp; Thu, 4 Apr 2024 07:24:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpkSe+kdusgJTI7glFCBHtPyl5ahfxdNP4A1Mqtq8oZhbrIrNbh26dUlobj/zr92ntuCWqhpueP5wOax6kQ2hXuyP9EJ+xfTBOA4YiHw== X-Google-Smtp-Source: AGHT+IGTRs0PIINZXMh9ZMvvH7676DvoKXKnklTnTUuNe9BoY/rryyRmDpK9XCpaOqt4X3quRc2E X-Received: by 2002:a17:906:1699:b0:a46:8e02:19c4 with SMTP id s25-20020a170906169900b00a468e0219c4mr1584892ejd.77.1712240640931; Thu, 04 Apr 2024 07:24:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712240640; cv=pass; d=google.com; s=arc-20160816; b=G4yrmAbeqShDGj4uXlEehPpt9MYiOOSYcLWFUjgO+fzOjBr4FswIuwCAYCpV5XtJ6G 5JGAjcn0e7K8ONBCXUIjIBQbvTMc55rgbLoRw9+dynM0sn9cpYfqRSIcBQ2EDeVxOGHk 29zpt9XiSWHTlddmAVgnQIVL1ym3nexDmccYgMgxgT9On1kFTRqrL3lyMRH0xZe2AAI8 YTF5sn+Elhr+mjZBmHfvdHHHkkrg8XemrIPKBha4Qi61yzJzi+UbjMHLa/7QOu1peIAb EYsRvmZW7w76RPQa4xsjLjy/YaOwjgOHpFYAKMIDp3JxeQGYUkk78tvjo2aI0o0rZPHv sFhQ== 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=GtUY7Ryd2UNJdbdMjsCmGsf3yGM88gtp0MfZqJx3q0c=; fh=oyCHSE9D+5FmQRH+T/OS8T6ZxXX/2IzsJxHVIxZ4YkA=; b=Y6gW6hXjcIO9O7LX3JB8BqdcjgZXDtgcyaMfvrcnbqu2IjifLmBjl2bpEHd1RdASi1 g1hoRSUdCTDL6vlE2nB1rDxuKw0UKkbpdhfbT3WmFHcYciURN99wjShk2PZLS9BoKjwr 95a6nlrRlOSRAyncjun12q8nib3jQ7yhBS15dYBJHWiAzpc7wBGOE9Uq5uGOtwEYFqLX 6t6FEy033XoR6vwCAZNqW7Lvv6clRhG2mn+IR8gyuvzsdr3VWuv9MEaes+1SGUNPBNnt A3yk8TXDMMyav54xtcym3RYLCwrhAeTOrTSvkzG9aUpiKFzqyi874iR9IduoBt7HTUGP dwyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FVZM3zLk; 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-131606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id go17-20020a1709070d9100b00a518cafaf13si531820ejc.407.2024.04.04.07.24.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 07:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FVZM3zLk; 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-131606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131606-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8914D1F3109A for ; Thu, 4 Apr 2024 14:24:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A640012AAE0; Thu, 4 Apr 2024 14:21:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FVZM3zLk" 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 25DC3129A74 for ; Thu, 4 Apr 2024 14:21:28 +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=1712240490; cv=none; b=KOsvXMKT1JT26rs/hBWg6srnh1+Zn/ex0tHzkMxeeqe13N68ufSCRikxBxVuKbNg47IiWFcm/mZEy0OgMVt3j5aDIwFLtPO2zhot/BP/a+ZGrjT/+0LGqFwOwtIZPotBjhGXvVRfttFz3o7o1oIuUIBi7lh/NTOHB15MZ8fogp4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712240490; c=relaxed/simple; bh=uZs9vFWiBVwL0RNEsVNDtCzUyXIvEgWlKme4WB6s9cs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pNmTAlGuY4P+auUE6Sg3hoo5NXtgmchuIK/xzO3dKX+7cp1WD7uo51qaRf/7/3br1KyN0GhTigEmonDqkTvW6GWIC12UyU8dHCI8JYKmQxLKk6TdoUeZIcnrTCOaFySlNS1q2tuihI/4C/rNHSH8sdG1me4ueVZab0fyx0PKg2U= 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=FVZM3zLk; 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=1712240488; 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=GtUY7Ryd2UNJdbdMjsCmGsf3yGM88gtp0MfZqJx3q0c=; b=FVZM3zLkuzHDbixk0sVRmAQJqZ8yqn1Y8yXsSVrvkdGTaGCiMTO9B+XUVqq6969+fnyBaE 0NT6peKSxPQInoOpTxkE6Y94OkIYdp9O6ZG75EHWguMsIb0Bb+NFpUT/fqZul5wHhsSYpb eNzxzQVNmvWbbMO2zHewDkGSLrg4suk= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-RKRQPkDYPIGX6daImIW-Xg-1; Thu, 04 Apr 2024 10:21:26 -0400 X-MC-Unique: RKRQPkDYPIGX6daImIW-Xg-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-430c9bbe925so1636151cf.0 for ; Thu, 04 Apr 2024 07:21:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712240486; x=1712845286; 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=GtUY7Ryd2UNJdbdMjsCmGsf3yGM88gtp0MfZqJx3q0c=; b=TK4G0fhyzV+gGGjU5JqgGk6tcoh2fNWf0432YnIX81zw8BH1Sz41ttc4QaZWihmcLn g44crqH/dDpJ2jCNMHfGnI+lvcJjwd3yHhoEVdC/H+rDBOUOLR8C4ocxo26gsB/IqG8Y TOszmrzQAjvobb9/q+LGru+G8uRZeV1puQV9eKgXCb5gjT7vHRtd4dhVhsegQCkDOVAM OD6h2AAfRk7yKsrIUl0U/isArw/ja/hRaXcucu/PXjYSbvC1cABRCDMRA+AolROW/WjV CDwsmAAkTXShTFbkgZOzHieuybqgJBFjc91UHc9G9LyFu2+G3j/QoXuQHZQBlEPeimRo Wzxw== X-Forwarded-Encrypted: i=1; AJvYcCWrK2HWLKY3/HPvtHXE8qpQY+793BnrY0GGOXU92UQNLO3GYGwuKZb42+Qdw1wM5pOQiIoofZGsRNH464UK1KsCMDNMCohiBu5/HBIC X-Gm-Message-State: AOJu0YzbghBkh9n3Ke/eSQY2Oj7ZZDekrLAf6mRCUuo2m26qXyg1/k7u D33PoDFw0W0mWZgWQALrWvbPsjp3aWtrR0s9nLEg2W8q+6+Mue7GvJ6O0BmWE0UvEh4sfQ5E3ly V+/1+NzXSdMLM0SMTIvMNT0JeAOj3+ig47uCOR9Jvg+uUWPr3iBnfBE+P6vge6Q== X-Received: by 2002:ac8:5c8a:0:b0:431:810c:a96e with SMTP id r10-20020ac85c8a000000b00431810ca96emr2500149qta.1.1712240485559; Thu, 04 Apr 2024 07:21:25 -0700 (PDT) X-Received: by 2002:ac8:5c8a:0:b0:431:810c:a96e with SMTP id r10-20020ac85c8a000000b00431810ca96emr2500097qta.1.1712240484909; Thu, 04 Apr 2024 07:21:24 -0700 (PDT) Received: from x1n ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id fk15-20020a05622a558f00b0043439982526sm2514858qtb.22.2024.04.04.07.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 07:21:24 -0700 (PDT) Date: Thu, 4 Apr 2024 10:21:21 -0400 From: Peter Xu To: Matthew Wilcox , Andrew Morton 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=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Apr 04, 2024 at 03:06:25PM +0100, Matthew Wilcox wrote: > 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. They check different fields (compound_head, offset 0x8 for the former). Again I'm ok with either way to go and I don't expect measurable difference.. so if you prefer this I'm happy with it too. Andrew, could you help update with Matthew's fixup? The comment is definitely better than what I wrote in all cases. Thanks, -- Peter Xu