From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 07A6A3803DC for ; Tue, 4 Aug 2026 21:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785880254; cv=none; b=PinagEsylztATqdTQ0Wpvij4Vih9JDRuyJJIhg+cnvc8EXQoMyCPvu+F3UkB3BkPHRaHqLQY5hqNwSOz65qOcPC0W4rn6lZsp9Kfr71iA+/7qS9/UWkaq0BSobe62D8w+AWpRvASfJ0jomi3MuSp+vESfx4DpDUy/iT35zUFdvc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785880254; c=relaxed/simple; bh=2e8VzP88NM1RD1lDSgxZmQ+hQgDaWwxalmVQOdHqUgQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=E6L3RVz7oFwf5iRPFfCHYAKq7UmQlJZLJZNnMCRdeFFkxO+MJP9W2xv5l6Rgs7ZYpfUY4VVO/dknYwb5a65FhNDX159HO2fkx+BCA489XpGUFG4qF5EwF65za9n2DdFOyArzcN2bl+OU7PPgro0ayjSbDdxWSdnK2nBBxOpYMOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V5dCshPa; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V5dCshPa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85D791F000E9; Tue, 4 Aug 2026 21:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785880252; bh=wNab1TMTXj2tF2QYo5aLHrQ52ijXroClG44vJawLUIA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=V5dCshPaL54uf39QVRVNzhtRdjaL3A5+N0uTPkmYLKvUY7qjSBfOWdQCCOlsY1rCr 7bbJME5plInKvwecbvPBYNAUkMlxC374eKYuWbOIP+PTlS2JcNh0su3uUY1KsBAKzH zj8GY3MUqT2Wc8mimnl+E8J1hEfnqrTUCeyxA1Jlnr6xQTA0MLwKnnO5BKagPO+dTp v/+zldvzIj8sXoT4EMZDcD03UeU+WJ2Xu6TRk9lI/csvdmnFCF1ICOwMYm+x0RUgxQ 7+YVq2PehLL91mwMhipLifw0TTlZvnS+nDFOFlkrmwC2GtJsskaWcxkN5bFAtuZJph vsjH+6F6NaDyA== Date: Tue, 4 Aug 2026 21:50:50 +0000 From: Yosry Ahmed To: "Vlastimil Babka (SUSE)" Cc: Brendan Jackman , Borislav Petkov , Dave Hansen , Peter Zijlstra , Andrew Morton , David Hildenbrand , Mike Rapoport , Wei Xu , Johannes Weiner , Zi Yan , Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, Sumit Garg , Will Deacon , rientjes@google.com, "Kalyazin, Nikita" , patrick.roy@linux.dev, "Itazuri, Takahiro" , Andy Lutomirski , David Kaplan , Thomas Gleixner , Patrick Bellasi , Reiji Watanabe , Sean Christopherson Subject: Re: [PATCH v3 19/26] mm/page_alloc: rename ALLOC_NON_BLOCK back to _HARDER Message-ID: References: <20260726-page_alloc-unmapped-v3-0-6f5729aa9832@google.com> <20260726-page_alloc-unmapped-v3-19-6f5729aa9832@google.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: On Fri, Jul 31, 2026 at 04:52:59PM +0200, Vlastimil Babka (SUSE) wrote: > On 7/27/26 00:22, Brendan Jackman wrote: > > Commit 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH > > non-blocking allocations accesses reserves") renamed ALLOC_HARDER to > > ALLOC_NON_BLOCK because the former is "a vague description". > > > > However, vagueness is accurate here, this is a vague flag. It is not set > > for __GFP_NOMEMALLOC. It doesn't really mean "allocate without blocking" > > but rather "allow dipping into atomic reserves, _because_ of the need > > not to block". > > > > A later commit will need an alloc flag that really means "don't block > > here", so go back to the flag's old name and update the commentary > > to try and give it a slightly clearer meaning. > > > > Signed-off-by: Brendan Jackman > > I wonder if we need to do this, and instead we could repurpose > ALLOC_NON_BLOCK directly. AFAIU it's about removing the side-effect of > gfp_allowed_mask in the next patch. But what would happen if we did that > using the existing ALLOC_NON_BLOCK (or maybe just renamed to ALLOC_NOBLOCK?). > > - in __zone_watermark_ok(), ALLOC_NON_BLOCK could now be *not* set in > situations where previously it was set due to gfp_allowed_mask masking out > __GFP_DIRECT_RECLAIM. But it only has an effect on top of __GFP_HIGH (thus > ALLOC_MIN_RESERVE... which seems contradicting the ALLOC_NON_BLOCK > description comment btw). Also __GFP_DIRECT_RECLAIM is only masked out by > GFP_BOOT_MASK when all memory is free, so it's kinda moot? > > - in rmqueue_buddy() we allow access to highatomic reserves since > 281dd25c1a018. That commit describes GFP_ATOMIC so we could have been > checking ALLOC_MIN_RESERVE. But we can also leave this alone because it > doesn't actually matter when GFP_BOOT_MASK is set, as above. IIUC we are trying to find out if the callers either has interrupts disabled or is holding a lock, and using __GFP_DIRECT_RECLAIM as an indicator. As you mention, it seems like __GFP_DIRECT_RECLAIM is only masked during boot, presumably before we can allocate any unmapped memory (should always be user memory?). So maybe we should just use gfpflags_allow_blocking()? I also wonder if restricing to callers __GFP_DIRECT_RECLAIM is too restrictive, we can probably key off __GFP_ATOMIC as I assume any callers with IRQs disabled or wiht a lock have to set it. Maybe we can also use preemptible(), but that creates a dependency on CONFIG_PREEMPT_COUNT as far as I can tell.