From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 8B6573A6F17 for ; Thu, 30 Apr 2026 20:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777580581; cv=none; b=c/o950o1H5LBKyPq/Rg+QcVk1srtrdpV0Gds7qB3Bn+X6ucuUYdEkLAQ50OGnwc5DD4voNiwLHwuMy3iMg67zLm7q6rtipKaFLzs289eTsWUKK7GrNmkE6gOXOBaod/ToX/GJ0NancIHkSylnbfcn9KV6tW3HHXA/hWwuJYztOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777580581; c=relaxed/simple; bh=whC9KeSFBkDXTIOgo9+K/eSzlDMevoAtRv7qFOaL3B0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m46v5FPiZvP2C2HfbgQnLv5sdaajgsRdvXJgVQd9OpOEp8/XXsAvqXKctMFPqWa2XKFtYQ9d1ouRJwEP0TfCD4z1SHPsDyZa+JgmgBIDd2wy+SULs87JR8wbe+lsw1fVTwEgl/rHJXY+BeHe/pLfTyE6oBcf/6OvjXOZZ+RxQV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=surriel.com; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b=LR1ytMFQ; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=surriel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b="LR1ytMFQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=surriel.com ; s=mail; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NuFX7HMe61DX0R5+yhLwHu0GA171H/phSLKgu4HycPA=; b=LR1ytMFQ/Tn3hp1V+kyzCC8Dpw nYcVzEGfF+4dRAnSI42hjsEx0li4luxUgFBpeJ+F+yGCZdjrCE77CFMPJzS0b4zlk/JSuwZveO9e1 brKZlcjL36JzPCBeEEPV9rta/nNwOX8M/jKs1jrJypCRxkb+TeJCmuoX4LUoEes+85VOby9tKOMRb z8LYHpRRDE8lE4aox+zC2OlmQlNkNn2aFuK62HnrKuwMRADh5FtbAu/Q/wE3sPXgR1/mZa2E/LORX nH7khGFjpx/o+em6bIVcv3euJupr7N5LEChQZJHrBSriJjyX/gW1zcMNxXIrmA+L2LoHXrqz3/+Y0 WO51Bfsg==; Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1wIXuD-000000001R0-1Wa5; Thu, 30 Apr 2026 16:22:41 -0400 From: Rik van Riel To: linux-kernel@vger.kernel.org Cc: kernel-team@meta.com, linux-mm@kvack.org, david@kernel.org, willy@infradead.org, surenb@google.com, hannes@cmpxchg.org, ljs@kernel.org, ziy@nvidia.com, usama.arif@linux.dev, Rik van Riel , Rik van Riel Subject: [RFC PATCH 36/45] mm: page_alloc: add alloc_flags parameter to __rmqueue_smallest Date: Thu, 30 Apr 2026 16:21:05 -0400 Message-ID: <20260430202233.111010-37-riel@surriel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260430202233.111010-1-riel@surriel.com> References: <20260430202233.111010-1-riel@surriel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Rik van Riel Plumb alloc_flags through __rmqueue_smallest so that subsequent diagnostic tracepoints (and any future logic that needs to react to allocation flags) can observe and use it. No behavioural change: the parameter is added to the signature and threaded through every caller, but nothing inside __rmqueue_smallest acts on it yet. Callers passing 0 for alloc_flags are paths that synthesise an allocation outside of the normal alloc_flags-tracking flow (__rmqueue_cma_fallback, the fallback in try_to_claim_block). Signed-off-by: Rik van Riel Assisted-by: Claude:claude-opus-4.7 syzkaller --- mm/page_alloc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e8d6d5b47f63..d621e84bf664 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2816,7 +2816,8 @@ struct spb_tainted_walk { static __always_inline struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, - int migratetype, struct spb_tainted_walk *walk) + int migratetype, unsigned int alloc_flags, + struct spb_tainted_walk *walk) { unsigned int current_order; struct free_area *area; @@ -3240,7 +3241,7 @@ static inline bool noncompatible_cross_type(int start_type, int fallback_type) static __always_inline struct page *__rmqueue_cma_fallback(struct zone *zone, unsigned int order) { - return __rmqueue_smallest(zone, order, MIGRATE_CMA, NULL); + return __rmqueue_smallest(zone, order, MIGRATE_CMA, 0, NULL); } #else static inline struct page *__rmqueue_cma_fallback(struct zone *zone, @@ -3715,7 +3716,7 @@ try_to_claim_block(struct zone *zone, struct page *page, if (sb) spb_update_list(sb); #endif - return __rmqueue_smallest(zone, order, start_type, NULL); + return __rmqueue_smallest(zone, order, start_type, 0, NULL); } /* @@ -4116,7 +4117,8 @@ __rmqueue(struct zone *zone, unsigned int order, int migratetype, */ switch (*mode) { case RMQUEUE_NORMAL: - page = __rmqueue_smallest(zone, order, migratetype, walkp); + page = __rmqueue_smallest(zone, order, migratetype, + alloc_flags, walkp); if (page) return page; /* @@ -5171,7 +5173,8 @@ struct page *rmqueue_buddy(struct zone *preferred_zone, struct zone *zone, } if (alloc_flags & ALLOC_HIGHATOMIC) page = __rmqueue_smallest(zone, order, - MIGRATE_HIGHATOMIC, NULL); + MIGRATE_HIGHATOMIC, + alloc_flags, NULL); if (!page) { enum rmqueue_mode rmqm = RMQUEUE_NORMAL; @@ -5186,7 +5189,7 @@ struct page *rmqueue_buddy(struct zone *preferred_zone, struct zone *zone, if (!page && (alloc_flags & (ALLOC_OOM|ALLOC_NON_BLOCK))) page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC, - NULL); + alloc_flags, NULL); if (!page) { spin_unlock_irqrestore(&zone->lock, flags); -- 2.52.0