Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp3067380lqz; Wed, 3 Apr 2024 18:13:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzxzDDNotX3/ZoGol05elif/TG7+SkCwKdGQFZgJqZpYM+stMocTAFAaO3nbn6BptGUBKPwYetPuylH8fgoh6TBsLck4UMiyhA9RhhOg== X-Google-Smtp-Source: AGHT+IEDEJFqpiD4tYPJG0V6upQgrg5Mo3WA3p+8pkH2vIHh4Y45+Iykzkhi9mU98nzvI4GnsSBj X-Received: by 2002:a17:902:e492:b0:1e2:62c9:7480 with SMTP id i18-20020a170902e49200b001e262c97480mr800942ple.54.1712193182927; Wed, 03 Apr 2024 18:13:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712193182; cv=pass; d=google.com; s=arc-20160816; b=urNokGUWXSLTFvmTzJT3yXPCOS+LZX8Q60wQnyuu2c93mmf+73/+KSiPD7mXgnE8yr UAavM1NunVqodRv1ghLAs8n9wEvpHS2eCwjKbA4p5KQKC0SqKpAkwCYz13xmRa4ivTQZ 9N3rIFY9K50obWIazklyIdOQYMNaQs+uLfe+qixPPp5C4TzA31XJ1fEo8W0MAifDLRal mvT25yLtCP/wcLhy5LoEE89nPqp6kdyv/o8kBWKWEUfRt1xHtr4PW369opAfDCRIQ58s jXWRm8ZRV2Q9MamEqAqzptK8jCqDZyLqDv1sq2WYx+hWDEUExbKeApT3YXvu+mG7vfRr uRsQ== 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=MhHyco6xzCUVvkgLlQHxaZjjr+F8wY1VDbF9HT0EPEk=; fh=uXhpLhp4LWqJBm9z0oXzJmcT2ErL3AhkqTJ6bCWBdnU=; b=UawkV6X3zb2ufOS9J5tsmtj5S+0lwBlicAazsOjIWznr6oDeTuoXLhWd0xSpWBtXfd S7QJG078bgBNk+1HANVMrvooiYKgdKUfvTcdUXFZ1/OuFyvktOvHkyCsAFuegrt1//yc OX97o3vIlCH/Xm6GWToUaMTxFC7kPwCoFUiPOifCFVqRngPzJEDKekajFStAaZx1sL4Y UJ/ydakz4wWI0ZDM01nVH7XOSInsOBnBfkHbo1ee/KZZHDBF8OfUT/diLb2/Iou25M0j U3kHZ98g23HGRa6TJ1GupVMR8kN1iDZTACZXnGxshvsyV3GEhorLuF/QIHlZL1Eg28Zy WFyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PVDumhZv; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-130762-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130762-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u17-20020a170902e81100b001e096ce909esi14944169plg.252.2024.04.03.18.13.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 18:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130762-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PVDumhZv; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-130762-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130762-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 A3A9FB217B6 for ; Thu, 4 Apr 2024 00:06:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2894802; Thu, 4 Apr 2024 00:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PVDumhZv" 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 1CEF64689; Thu, 4 Apr 2024 00:06:01 +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=1712189168; cv=none; b=BuRjEJq6iQndF8x/0p+T2aIYVXUD00+bU+zn1rgr0Wm2O6zlDHJope6UqNwfZ7UWz7Gq+rkMrXG57i5cgcnBfvRM/HUPUJ2MQCdejhfsi4c5kOamx/K4OCa//zbANLLmveiOOKvfDJnWEDTZIxpnMSHDVdAuuIjB55f4sMGevZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712189168; c=relaxed/simple; bh=86HGuT92NJSuhazygmUlHsFjgMiiNB/mak1t22rWe5k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eOw8ceAZ8v9Fort0/c5PSmQI+GePlgprNfiW0XimhNrpq0PInNm8T8W8jSuEvJ22NSp2p8Tter9vENdbzD7anObGYAu3A+HHZ3w7dq0fbL3SbJfXgiVGwbVHCBvJJs5yD2jdXuEmdulEZdI0ZJQx/a0sf/hyqlZ3knduR9jWSMY= 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=PVDumhZv; 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=MhHyco6xzCUVvkgLlQHxaZjjr+F8wY1VDbF9HT0EPEk=; b=PVDumhZvavwMCqaVxRJqsbjYqp KJmz0/Tx3eUNvoC933V7Vr1eQHBJYCBsGuXvIr8UfZ8LMacSqG/9jfCUm/urGf5/j/KJc6DKjdgmK sg22bYodFxLdcSqqweqoWC4nMNdd0ldiCw2k8ShOTyf9WhgcpLQF5UwJJr/N8b6YKlWhkCnttXhJ2 pqd4rnB6YlJTep2QWdde+vJgpJX41E8cPAKm2QbcQX7lKCZltPb79z4QGRPI53yNG9+kXWMS98LzY 9KdU2CyVAeCJo6E/m0e/573R/XtEchj+gtz+SRXjH8NzfvMP6QK0/OQEHlGtJXFkXbEylzdHvjWcz jn5/ChDA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsAc9-00000006m5v-26wq; Thu, 04 Apr 2024 00:05:57 +0000 Date: Thu, 4 Apr 2024 01:05:57 +0100 From: Matthew Wilcox To: peterx@redhat.com 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: <20240403013249.1418299-2-peterx@redhat.com> On Tue, Apr 02, 2024 at 09:32:47PM -0400, peterx@redhat.com wrote: > +++ b/include/linux/page-flags.h > @@ -1095,7 +1095,13 @@ PAGEFLAG(Isolated, isolated, PF_ANY); > static __always_inline int PageAnonExclusive(const struct page *page) > { > VM_BUG_ON_PGFLAGS(!PageAnon(page), page); > - VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page); > + /* > + * Allow the anon-exclusive check to work on hugetlb tail pages. > + * Here hugetlb pages will always guarantee the anon-exclusiveness > + * of the head page represents the tail pages. > + */ > + if (PageHuge(page) && !PageHead(page)) > + page = compound_head(page); I think this should be written as: /* * HugeTLB stores this information on the head page; THP keeps * it per page */ if (PageHuge(page)) page = compound_head(page); > return test_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags); > }