From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (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 B5E8E2264AA for ; Tue, 16 Dec 2025 20:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765917171; cv=none; b=gd6k0eIJ0/G7zGnLdWJWHgZ4+nimdqghWkWgZe99TQrjzhFQx6kx48iO6BE6RgCEssbF0hYBp+giFsEEx66Ds5LI1u3wIhxEHeerIoRkj1RVffuA7d7IQ7nJ9QpA3idYoZGMyrgMA8kXRuqO88te3YISrLMQAXQeEqkEgagijBE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765917171; c=relaxed/simple; bh=XDvzjkV4ALzbl1J2L3luuSUyy3UMflep+1sL37xWvY8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=awXFP8ya4gZYzIRIlDj3sCHfKeTBv9YVNWNayrB112X6clfFzQg058on1m0jQLZC1knrPMyWdEVbiyWS40bdnFgieXJv7aG5qYsEEJIef8qNnUXCOiv3ZI1Vd0OPCAtnm3ubVygVDllVb+bZfsLjh8qoMtOHNRHMaffjrwSXJqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=aLYXMqvS; arc=none smtp.client-ip=209.85.219.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="aLYXMqvS" Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-88a3bba9fd4so21483336d6.2 for ; Tue, 16 Dec 2025 12:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1765917167; x=1766521967; 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=7EEEAw7QGb6K7ygmrXSsnTABuvaPxMsNIWBZepu4CMA=; b=aLYXMqvSlp2kCFF8gnkvVIgr5iKOHVd7be303NfSLpI9YKKD74vpiTreog2Ec1iNAo odmnbA13x7XSseQYhQwiVTjbGwes0TwYDVnvPtkdH4CNCsFKQitSu8v2h7GkKhOynF41 SYBcivOUXCBGJE9yGv4LP5dbPZy+2R+iCYTB0oVrTZk+CgiGnpz+2uiRqSg5WmCBjpje IKzf8FT990L/1mIcTzGjbQfnOFw8UTuyTp8oV8qZOdQsSV7CwnvrzRTsDeEZb/GGSx5m LCIb2WEHZI3zoZ+qyRyCG6CjFhoJd+rm4cyl04cYZ5rWDkO7EYbf7UTLwXYC5R0GwTrT AqGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765917167; x=1766521967; 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=7EEEAw7QGb6K7ygmrXSsnTABuvaPxMsNIWBZepu4CMA=; b=n+IAoTIddn/FnxqLyOEXks0+oTI0OlrOHkFYws/r0TVpKmy1qqXmuIuTYkdq8W8jb0 Vs4LmcAzB2cvqdKRwA3vbs+AatA02bimssbJO3jEp1mccMqlI1jtAalvJ3INQi4Hyr20 r1EQmKflLfss1krV+cxgu0ZpAqW6+NxR7JZcr0CzrNMr4aSYU5d+u3AxKnD2PHBmqWbc AZnIc1a1Dfgq3OrCGJ2b/08FwaT+9O52hWGmDS2uv5CdDrakatyEwPatGyfvX3VmZGKt jcH0+sE+sbiaiQ9YAwBMsdgeL3hZu+TAenBOv3y885ikeeEPB1nRx/Ig5r8vioSId7W9 W9og== X-Forwarded-Encrypted: i=1; AJvYcCWm9skWZgEyMYt3AadJJlvJ1PyTugwbq0bWzJKceChij2DzoiTscukIgjhYOKpic40B8BnWu9DWGktivTQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyN3gQ6LA7c0HWaw4ltYwKCSjrbRll/CqCyZ7WRFh0gwJVPA95/ mBogkHlgy5nZF6rfQA+xpBZ8GfF7Y5pbyXmmSKwr4wJMMp96+CRrqw5lJHR/OP1xmOM= X-Gm-Gg: AY/fxX7M4gs8yOA08/id9g7ncXo0PlXxksykFPrXXKSDUUW4JshLAhp1pWqjdTu225w XuyvhU64YsVN6mCZWoZmvfg/2ZDesGk8UqfICArbHpEjAQ3/Te6PzHpRlhHmx29R/wXkIGSnK+Q zgAJaMAkdc4Lwq12eUjhXzn9eV1ryk3da4xKe7vH08fnD8K+9mMQlRWaRVm6NKap1izg7lZka29 e2NW92z4vDjMlB7ahGvvP1J0pZLKL94Ndz9T+XeLWrh871JObxX5QgfVY4X35GqTHn1HdvboGsb cXc/E2A6D3sawGqfC781IYY2Vvu2Cfnqc0hJqfWAB3cMxqJ8Ljs9Azt5JpHwfDz7z8rUVyeMIFW bQItJ9IwP5CdnBfDu8Xqi1ZS49NPX0ELysdCLk4unlRlFQOELrrHmSQPFzXE9C1US/8JEWTMYhm guM2/8gFvn7g== X-Google-Smtp-Source: AGHT+IFdGelOVz+UYJ+Zlbf6DDZRtAQBIiUfqvoKveiGqHlfzqDdluud9sUFL7EVOn1Fn1H1gZX9vQ== X-Received: by 2002:ad4:5b8a:0:b0:797:1a0d:cdd3 with SMTP id 6a1803df08f44-8887e01da69mr266937806d6.19.1765917167250; Tue, 16 Dec 2025 12:32:47 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:929a:4aff:fe16:c778]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-889a860a083sm78737596d6.52.2025.12.16.12.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 12:32:46 -0800 (PST) Date: Tue, 16 Dec 2025 15:32:43 -0500 From: Johannes Weiner To: Vlastimil Babka Cc: Andrew Morton , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Zi Yan , David Rientjes , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , Joshua Hahn , Pedro Falcato , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 2/2] mm, page_alloc: fail costly __GFP_NORETRY allocations faster Message-ID: <20251216203243.GJ905277@cmpxchg.org> References: <20251216-thp-thisnode-tweak-v1-0-0e499d13d2eb@suse.cz> <20251216-thp-thisnode-tweak-v1-2-0e499d13d2eb@suse.cz> 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: <20251216-thp-thisnode-tweak-v1-2-0e499d13d2eb@suse.cz> On Tue, Dec 16, 2025 at 04:54:22PM +0100, Vlastimil Babka wrote: > It might make therefore more sense to just fail unconditionally after > the initial compaction attempt, so do that instead. Costly allocations > that do want the reclaim/compaction to happen at least once can omit > __GFP_NORETRY, or even specify __GFP_RETRY_MAYFAIL for more than one > attempt. > > There is a slight potential unfairness in that costly __GFP_NORETRY > allocations that can't perform direct compaction (i.e. lack __GFP_IO) > will still be allowed to direct reclaim, while those that can direct > compact will now never attempt direct reclaim. However, in cases of > memory pressure causing compaction to be skipped due to insufficient > base pages, direct reclaim was already not done before, so there should > be no functional regressions from this change. Hm, kind of. There could be enough basepages for compaction_suitable() but compaction odds are still higher with more free pages. So there might be cases it regresses. __GFP_NORETRY semantics say it'll try reclaim at least once. We should be able to keep that and still simplify, no? > if (costly_order && (gfp_mask & __GFP_NORETRY)) { > - if (gfp_mask & __GFP_THISNODE) > - goto nopage; > + goto nopage; IOW, maybe directly select for the NUMA-THP special case here? /* Optimistic node-local huge page - only compact once */ if (costly_order && ((gfp_mask & (__GFP_NORETRY|__GFP_THISNODE)) == (__GFP_NORETRY|__GFP_THISNODE))) goto nopage; and then let other __GFP_NORETRY fall through.