From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADF292D3EC1 for ; Sun, 21 Dec 2025 11:33:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766316812; cv=none; b=AqoAyKAa0AEHz7gU+EBrO3908AYrkFuLIP6f19tEAiaCDcx4hDARVW5Q9sImAKd9B3kNx5m1wzi6wmOcrpqkC/q7xyT8epnL4bCPqwhClx4cHvj8E6qsUxJwG2wEI3HzWAQ8BdPWD34CpihAfykyfScJCUVqJWNH0YnxE+jxKDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766316812; c=relaxed/simple; bh=5/2KdZgGrJgj6UYFVgcseBT9Ni6g9gjj0BwwaG2t9fg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BGbNdqDWvDLlq7p1U3Tr3kH2sRVN4oLYtQy5hdYdcQxNleJBghJoEiJSFkEZX6H3TBbMBxfWpopqc9qY69tzjNO9hAiHKhDjoLRD4KW5rHCwvjx1iAFadFeKbbDOGHgLrJhPucHBZJUp2WWNAA60l8yMKToXkx3b7Xcn4JnKKMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=JVRzMDKN; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="JVRzMDKN" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8b602811a01so360912985a.2 for ; Sun, 21 Dec 2025 03:33:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1766316809; x=1766921609; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XyEXnFxRw/dZFmCj4O9vgIzqRZfYupF5soIXzghWWeI=; b=JVRzMDKNBpxfRXB6ppvhOUzJQzJTXRJfVIICF4bM4CI9BwKmOVNqUmIicM8VtA2J/d w20ck2cJkWs9RMYwRXT/ty9dKEUgfcPxqmkDdCW9rpGi+ITHco3I8bF6f6vM07AUVgB5 ZRV2IfJDMOalNPb/jtqwCHfDyVXcul8yJOLHRB0Gwwx4RYltxK3Ie1R4dmpPeOMi9Umn /hGHqMECs4fRof3w0t1pMkNm9QUPvirO7hr/sGKbDGax1OsCBIgdPLlLNQ2ivmR3ZC/w pgqUsgMQqmBIwZOO/jDl8wcenmI+UyhD1qRh44uAtr+92yS4BeY1FUlObnjvMoroS5Sq eZZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766316809; x=1766921609; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XyEXnFxRw/dZFmCj4O9vgIzqRZfYupF5soIXzghWWeI=; b=jAbmThAaxK3W6EzySd6TQfFKXRtHKvPUvOvE/RisvrOY1z4fXAkH9Tt9CJUSFP1xQU PF0r+rr9AzKVrCzQ7KbPW84gVtQAk9zVkNWgpFc9bAVSY5o7YePNPedQuj4XljZg2pAo XJ52JsLc/NRARJGWFpmydgkH9zAwyGBvuz015L7MIbpOBVN+RoL192gFw0S3zXOf6kNN N3IaG6GO7Af7Qd5Gj30jRPUF+dTAHGAbfHanFjNelHNXoXwf/A2lfeybkILH/FVifuYL DPmq9PUqI3dqPeupi/zuAz5brkXet69Gc3GPkiKexDMv3pJxO1f8uxsak8YlkEztQwZ4 9yAg== X-Forwarded-Encrypted: i=1; AJvYcCVDF/a/SO7ap3ET1CGXlgR++DlMzIpkh2ewBsn10UYL3DSHJQa4IKSmDkdYWzmAekI/j0mObeL4gPAnoAg=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3fx6dGGzQdXuiWAKsyoakBlGDy7qBb+loOUHqTWWFputS8/+U TW/vOdjXwxxheU73ASZWDSd2M8JdA4zBkptlwG5hvaUe3eB/4Swd93WMH6pj1h7Moys= X-Gm-Gg: AY/fxX4gjTpw3vknVihJi7QueOpJlI4Gn4M2osEpkNN+Jb0mIjELwzyVeIqda0Fkcaa GPWOZHNZhy9t6kf3vWR5JtKxDnWCRn86nio9TIXi0RNtf6lNDRfx/Cp4N/0hFLjyJVleSfe0vVQ v1iW7ZS+mM8Mu1NMgFieP8fiFI1zJ8ylpdZdwHiL4cn4+XGGBYw5E2F5mN272Sayjd+574nDH21 A1A3c4jiMluBOAY/r6eAaxuDXIcjZ3LcsFU5UegJjkqj6DQvQUh952OCstMLRTBaFsw3EaQO2jG 6qscv0qg/Q7i+Pf0jzHgXYImiSqI152mclMWJWbpo0B/o300lKRW7LUDTxOxKn9UvDNKW/prql2 7j2e9EAuPLPGCE0sNQty8cZH+jtCAEswC6/LiOfCebILIh2BHAjeHpoar+Nrh/1kdTCgEpdqkmU iR7jiTWipfWZb3J7q4gjIFSWkeUBRQYbMVXAO4meaG5mbvuaMt+dbImvR+jf+GRjZqtRzfC6a4h g1URq2d X-Google-Smtp-Source: AGHT+IHT7Xo7GrC0Uq2wqzAnpXZFuCOsTHfYSBi2I8ALDpJvOe9OgaMpw+NRwqAObVPAQlJ6Ynm9Pg== X-Received: by 2002:a05:620a:4620:b0:82c:556:eaee with SMTP id af79cd13be357-8c08fab3ff6mr1314482185a.66.1766316809535; Sun, 21 Dec 2025 03:33:29 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c0973ef6bbsm607633385a.43.2025.12.21.03.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Dec 2025 03:33:29 -0800 (PST) Date: Sun, 21 Dec 2025 06:32:52 -0500 From: Gregory Price To: Wei Yang Cc: Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, akpm@linux-foundation.org, vbabka@suse.cz, surenb@google.com, mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org, osalvador@suse.de, rientjes@google.com, david@redhat.com, joshua.hahnjy@gmail.com, fvdl@google.com Subject: Re: [PATCH v6] page_alloc: allow migration of smaller hugepages during contig_alloc Message-ID: References: <20251218233804.1395835-1-gourry@gourry.net> <20251219000800.tnpqzvcdyeqcwryt@master> <7EED2D83-AE17-49CB-BDB6-954793EAFDBF@nvidia.com> <20251220063738.hbypivj3d34c7ffs@master> 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: <20251220063738.hbypivj3d34c7ffs@master> On Sat, Dec 20, 2025 at 06:37:38AM +0000, Wei Yang wrote: > On Fri, Dec 19, 2025 at 03:46:25PM -0500, Zi Yan wrote: > > > >The sole caller of pfn_range_valid_contig(), alloc_contig_pages_noprof(), > >scans from the beginning of a zone to the end. pfn_range_valid_contig() > >should see head pages all the time, except it scans in the middle of > >a 1GB hugetlb when alloc_contig_pages_noprof() is asking for a smaller > >nr_pages, like 2MB. But in that case, the if above i += (1 << order) - 1 > >would return false without reaching it. Basically, to get to > >i += ..., pfn_range_valid_contig() needs to search for nr_pages larger > >than PageHuge(page) and nr_pages is always power of two based on > >alloc_contig_pages_noprof() requirement, but that means > >pfn_range_valid_contig() always sees such PageHuge pages as a whole > >within nr_pages range, thus cannot see a tail PageHuge page at the > >point of i += .... > > > > Thanks, I think you are right. For current use case, it is safe. > > But I am not sure others could get it on first sight. For example, me :-) > Do you think it would be helpful to add some comment here? > Can't hurt, i'll give this a v7 and collect the tags, thanks! > Generally LGTM. > > Reviewed-by: Wei Yang > > >Best Regards, > >Yan, Zi > > -- > Wei Yang > Help you, Help me