Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp297090lqp; Thu, 4 Apr 2024 13:31:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWp8g60g0sWwcObmPmb+tnKXtJ4+Pr0mOw+vWbp69+dU9B8bqJ30ugI7iT7oFV4NYUJ7vuiyVRTyrDp8Cr7a81dq7oU4FUm21eoDfd2Tw== X-Google-Smtp-Source: AGHT+IHmpNUNKhz5cOcBHB6ohxJ0StgzkaQU/1ArYgQq0MWt86s5xkxc+2czkPrQLW6zzC/BGS8F X-Received: by 2002:a17:90b:3793:b0:2a2:9e5d:9bf9 with SMTP id mz19-20020a17090b379300b002a29e5d9bf9mr767867pjb.8.1712262705423; Thu, 04 Apr 2024 13:31:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712262705; cv=pass; d=google.com; s=arc-20160816; b=jZpXxSBfjSDJJacapZSsxHBAPC0fCbAcoOrmhwzZ4e/hsTLBuJTOFQDHvdJ/q6Cwa/ 7zdAW2/3+8aX2kwR3FPQk/vRZVs5ycfpgNnIp1Qu80+UGgDki/59NQ4/VMHh86eUpxuy EcCKVYQjXiIh/eW/Fhz5U3YsviIhChUkzJNBEPmlg5bfhm1NaM5gB0ZuQn+rlXoiEpcq iOIutguUKZtsXdg+05EN0PSo255YZxDY7k3Y1v+sPn8/tua9yI8EgZFmcb084dEUKu9t 4CrgNZYtUWcOpypDy6mc8bA50i4pMgz4o0Qe8ljgsAnvXRh3vc59wMU1UNR2GI5+bUIp KwXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=zABF3TbOB4McGYmG5hP/rJ3zhLq++phh1UlfJ5jgSGc=; fh=hluA1UTEmVGQBhuLHU3Q7ow2VwlLQQGvTBLauL8AEcY=; b=Hr3MuZ9KsiTjFM9iz9J40A21sBij2Tztxq4dA2ptuDlFfyuwNq5hhDoUHzp9MTa0UT XmNz0PWWhPEYrgYec38X1YWc2ppKBsTNe67FaIKSASHAxrvuQ58OUVtprTWmeB03GEiU IMt76W+psJuQLpfUge2E7mqqIEQqgsWz/Mj9CRigc98+rPtUWXcaIrTo9CE3wY9FBMKJ zvvc4BatDvR88DKPmomuKF1fWG/1UvppJIIw6jzIisq1xONjOPjSeDCra2YemCcntulZ dSHOMw4sMbCCzy31KKiljD3rdVFPX1uGD7IBfef5ZtugYUMOjMfgkn6+OrOtEB/YYoHJ eu3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=NTlQyc15; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-132099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132099-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p24-20020a17090ad31800b002a29b882714si2260855pju.187.2024.04.04.13.31.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 13:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=NTlQyc15; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-132099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132099-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 93F7E28CE5A for ; Thu, 4 Apr 2024 20:31:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A641130E4B; Thu, 4 Apr 2024 20:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="NTlQyc15" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 419681BF2B; Thu, 4 Apr 2024 20:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712262699; cv=none; b=s8nUYNUiwN2PIyrn+s2gkHtsE1kC9YygL/rCzigYMJFWoS6HgE3GcjesFl7shtyvr3FHawcHJuXulcnGHwpf6/m2VrlUmuP0VyGM8odXwaAUC8H5DlebS69rDFxcILjv14iR02dQmj/0PU8EUERslE+jUNIKuakKEM41b/6NGtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712262699; c=relaxed/simple; bh=Hew0RwkTVS+l0xV7qv/+83XciUA+bvPNzdeJES2OSX0=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=ZBbnguVXMOLbVs4BROYQAGehj0BlHgA7eUwxjjYL4GGr/19XOW8sWg9rQuFJpoPC0y14oZ9FLCFQBzTBRHfo0j0Ja5E27wFiS+tXvdMTUFUEaWtOvkVa8NJKJhfFr6D21TRQPpReCValfe1RAQDfnPS+acw2hr73CkEOkfuwuGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=NTlQyc15; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41B6DC433F1; Thu, 4 Apr 2024 20:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1712262698; bh=Hew0RwkTVS+l0xV7qv/+83XciUA+bvPNzdeJES2OSX0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NTlQyc15FdIpH8wOQyWjdMc8ZAOzRRTs+StY6AGUQ8aSgIpT7U6MEU0T/fmuyZviy K3fDvwFoqOb7TYdlZjCXLuzfOk9ivwYIWgn9HI2LADsG4HN4as9HbEaPxVkJuNrOZZ fVFPdzrzbWjMzZ01wXPrfGGLtOHoybr3B9Q1Vl68= Date: Thu, 4 Apr 2024 13:31:37 -0700 From: Andrew Morton To: Peter Xu Cc: Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huacai Chen , David Hildenbrand , Jason Gunthorpe , Nathan Chancellor , WANG Xuerui , Ryan Roberts , loongarch@lists.linux.dev Subject: Re: [PATCH 1/3] mm: Allow anon exclusive check over hugetlb tail pages Message-Id: <20240404133137.560d15c1a3bc7176424901fb@linux-foundation.org> In-Reply-To: References: <20240403013249.1418299-1-peterx@redhat.com> <20240403013249.1418299-2-peterx@redhat.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 4 Apr 2024 10:21:21 -0400 Peter Xu wrote: > Andrew, could you help update with Matthew's fixup? The comment is > definitely better than what I wrote in all cases. From: Andrew Morton Subject: mm-allow-anon-exclusive-check-over-hugetlb-tail-pages-fix Date: Thu Apr 4 01:27:47 PM PDT 2024 simplify PageAnonExclusive(), per Matthew Link: https://lkml.kernel.org/r/Zg3u5Sh9EbbYPhaI@casper.infradead.org Cc: David Hildenbrand Cc: Huacai Chen Cc: Jason Gunthorpe Cc: Matthew Wilcox (Oracle) Cc: Nathan Chancellor Cc: Peter Xu Cc: Ryan Roberts Cc: WANG Xuerui Signed-off-by: Andrew Morton --- include/linux/page-flags.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/include/linux/page-flags.h~mm-allow-anon-exclusive-check-over-hugetlb-tail-pages-fix +++ a/include/linux/page-flags.h @@ -1096,11 +1096,10 @@ static __always_inline int PageAnonExclu { VM_BUG_ON_PGFLAGS(!PageAnon(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. + * HugeTLB stores this information on the head page; THP keeps it per + * page */ - if (PageHuge(page) && !PageHead(page)) + if (PageHuge(page)) page = compound_head(page); return test_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags); } _