From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 EED6236B07B for ; Mon, 22 Jun 2026 10:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782122511; cv=none; b=BO8MPmQZNsCbIbGNXa2xmEsU8si0ofsJGGnYuCqxKjosjfVFHrxoJOj0EbfbWSV0pke/yXP+tNzF+37hsFg0BprSUDIeHoR5Sgcux14wykWME24n8Xcti+gtEHCmVTX5gVSSblA5lgyiOVzHY/TSRBONWWStaVhfF8meq+aCmI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782122511; c=relaxed/simple; bh=D2zL/isK1DwcYPyXmvwNRFN+cwKhi4zjlvZRjHvouQE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OUZo6yVP5dVO8b8DGKMJBnZkUele8q4U0zOo3CD4u8wEWRZEjyHGreX/OKM/JhnX+d1KuXF3TSpq7ZH9vQo60wOAldpY8nqtl2KtVgP0bhYsRbaLCBgjk8WiYia8tvFTVm+e2fXqyvGBIOF6HUaqJ0V0YDGXD8Uqjuh7Wqtmj1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HptkmANO; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HptkmANO" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-490b61243easo57556215e9.2 for ; Mon, 22 Jun 2026 03:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782122506; x=1782727306; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KmHe0ClpKecy9d0Nv0FMY1kBXtGrgiG+qiOUOhwXnXI=; b=HptkmANOFwhGn22UhyK1TB04lfNmqjoal/Sz40hdzfEpePcV8r3D/+UwFHlG18puyR aJr1bQeZAZW+wfnrxCvq1chZ15C0o9BK/iYBTDHa2XKtFdz9EAFzHBYi3svIRmNbMZut 5mIP7VjjFigvlZs+YWOdDxfo1hxeHA7cxLWR5oj2tC5BfS8ObOJfgtoFVmCSAF/MbqKh /sip68nMqTMK/GWla3vfR5A3il46dl8ILtvoqZcDSuEEkhMB1nM6bpOD6lLV1xIXY+7q n4mHk80Qgx40nUK1FrHuNBuuIK2XBjc0J6q1STuwU0m37kz64kAincBGXW/byE1zI/Mp DlnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782122506; x=1782727306; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KmHe0ClpKecy9d0Nv0FMY1kBXtGrgiG+qiOUOhwXnXI=; b=rkPqzPp86B2+YTv+jUkApwNWrA3O7s/2ljd1qWdKgpSzld6EFdki4Y+hPJ9jvhePsk N4wZ+uOiBugeTWDRXMe9h5G8xpZwgdQsJ4QMEKom2hclTjpxy/BoRyxSBgXwmTjA4+kP Kb9YPuTPRO8xCxMwdbeI9Yv31n4u1n+ta9LAhJuLevjmVjCDqidvjgYoxx+cRw0D28qr qcfIjwREJ1wKurry60PFmZbsJYEodTZC/vOCEY62UdmhcpMLE2YB0IQLPrYIhgXPWCbE qDXC5eWTnSyGRDJaJxgdNRJi+FMKKWs0rplo9qYV1jdIUY3okkqoKBeNLYDCiQrj5OZ8 R5WA== X-Forwarded-Encrypted: i=1; AFNElJ+qkol5r4WiEQJnC51V7LMtdaTkmvKMYa/mf+SVSBMeGXeYt1i9GzA7QHbXqTgEoyF6aOjczNlBEdjreTY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz14L3BtjJtQ50jvRc3crLOHA5mdkpmNYFqD7esw5b6FSv9ZDS0 FX/sYAcNsLADBA6E7RnNrr0UdvJOBVZXD5po7EU8Qpf2Ulnm1bOtqA3jPu3VoKLv3p9zXA1My+S QyAhQAWfSr/zDiw== X-Received: from wmsk10.prod.google.com ([2002:a05:600d:848a:b0:488:a71c:cf48]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600d:101:b0:492:4050:d495 with SMTP id 5b1f17b1804b1-49240ea31famr152824405e9.30.1782122506179; Mon, 22 Jun 2026 03:01:46 -0700 (PDT) Date: Mon, 22 Jun 2026 10:01:31 +0000 In-Reply-To: <20260622-alloc-trylock-v2-0-31f31367d420@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260622-alloc-trylock-v2-0-31f31367d420@google.com> X-Mailer: b4 0.15.2 Message-ID: <20260622-alloc-trylock-v2-4-31f31367d420@google.com> Subject: [PATCH v2 04/13] mm/page_alloc: relax GFP WARN in nolock allocs From: Brendan Jackman To: Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Johannes Weiner , Zi Yan , Muchun Song , Oscar Salvador , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: "Harry Yoo (Oracle)" , Gregory Price , Johannes Weiner , Alexei Starovoitov , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Brendan Jackman Content-Type: text/plain; charset="utf-8" This WARN forbids setting other flags than __GFP_ACCOUNT but we unconditionally set the ones in gfp_nolock so they are certainly fine for the caller to set. There are other GFP flags that are almost certainly fine to set here; Willy noted GFP_HIGHMEM, GFP_DMA, GFP_MOVABLE and GFP_HARDWALL. But, nolock allocation is rather special, so be conservative to try and ensure we have a chance to think carefully before nontrivial new usecases arise. Suggested-by: Matthew Wilcox Link: https://lore.kernel.org/linux-mm/ajS96fWbG4dzP3u3@casper.infradead.org/ Signed-off-by: Brendan Jackman --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e31babe2181a1..074e007bf1bc3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5337,7 +5337,8 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order, return NULL; if (alloc_flags & ALLOC_NOLOCK) { - VM_WARN_ON_ONCE(gfp & ~__GFP_ACCOUNT); + /* Certain other flags could be supported later if needed. */ + VM_WARN_ON_ONCE(gfp & ~(__GFP_ACCOUNT | gfp_nolock)); if (!alloc_trylock_allowed()) return NULL; gfp |= gfp_nolock; -- 2.54.0