From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796223978; b=Jf5jnOghZpWwlkyS7udSlNwTdIiLMInc+2rFFtQGiZ6tcVIRlUlYPIDqn8JXfseDZuEL obuSYLmde+OQ2qR/07vCER+tgsJCLQGtse3pfgpHtFexk6YHmutNT4UF6fpFYRQEmFV3v 04eVPnSHeeOPF3gfBt6MkcMGqJkLX71e287vtzH3RTsrcvVSYydtoAnjFFaT4fcC3a8J/ 2groopr4BQl5rLRIM8ULSr931FH0UQwysk2DJw4P7M9wqHqDe6PEpW53tG4p/ToSYOEmY ibwZAvheM0CzpRWoAtui4m4lM6/xldsVuy62p3ILA9417BRtWJsv903bG3U0Z/cfw5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796223978; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=KPKtJtzD+0q8055hHZ0fKraGgOWGYbI6BSpkFP0lm3g=; b=5SM68WM6jRPI9ZOR5rkZD5W2nCdX1Enxpz6AIs5DpLognVrJIounj+DeUNzbRGWsuL4G zI5h5YNHE3C3a2/m8KcvIZtiDi82FUD4c4xkTU6fBUbIZayX2/snmYe559pHndEYCcdd8 J9s02d5NgjTD0UpSYcJf6McivQ5XyZdQns4AXWkwO3RezqOteESTX7T5EhZ+I3zcscvBw FxM/Au4h/doMQiNq5lzzzpGtmkMJXW0WLAnhjbM1D6n060pQ1F6ePGAjy5Umx+LeTnoVE Ok+OShFGrHj3Q9L95gZbjDJJ8CM2TbvD0tE0YQSqhnsbAl8F62NHbkVNEOd4fgK8VEQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=m2l07Cjx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A24B606A31A; Wed, 2 Dec 2026 15:06:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=m2l07Cjx Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BD1E1F00897; Wed, 2 Dec 2026 15:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796223977; bh=KPKtJtzD+0q8055hHZ0fKraGgOWGYbI6BSpkFP0lm3g=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=m2l07CjxQsdx83nYMzEDZmWKMsUx+1vGOaimZlGAVOCQr/4/jvHfIg7n8F9XxDJXN d26HSM4+Pg2yDlOHi+sGb7obW7Vt4zWWvl+px7PFTU68i7+GwrW7foFE8/lR1mg+5N ZIBBqvUcEeUQh/2Cv2W1sGnxpi2UzNHRh958AqwoMixefPjmuf/tBPX8kN02aYICGU c4bcmSmyZGkRZmb2ooZSZisIM+QEatpoZDYUYxb90yQmCJYuTrdPl85xN7S0ZCuDLK KILS+5H5Nmn6uT/ko+CQMmx/xQemf3yRUM8+A4BR2BqxkVA4xOze1NVgLut10g5FVT XkTpq/t8qhU+A== Date: Wed, 2 Dec 2026 15:06:15 +0000 From: Harry Yoo To: "Vlastimil Babka (SUSE)" Cc: Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , "David Hildenbrand (Arm)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chris Mason , stable@vger.kernel.org Subject: Re: [PATCH v2 2/4] mm/slab: handle __GFP_NOFAIL better with prefilled sheaves Message-ID: References: <20261201-slab-ai-fixes-v2-0-7419dfbd3bac@kernel.org> <20261201-slab-ai-fixes-v2-2-7419dfbd3bac@kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201-slab-ai-fixes-v2-2-7419dfbd3bac@kernel.org> On Tue, Dec 01, 2026 at 07:16:03PM +0100, Vlastimil Babka (SUSE) wrote: > If a prefilled sheaf is requested with __GFP_NOFAIL in a > gfp_pfmemalloc_allowed() context, the following can happen in the > initial __GFP_NOMEMALOC attempt. > > refill_objects() __GFP_NOFAIL | __GFP_NOMEMALLOC > new_slab() > __alloc_pages_may_oom() > if (gfp_mask & __GFP_NOFAIL) > ALLOC_NO_WATERMARKS the slab is pfmemalloc > alloc_from_new_slab() its objects go into the sheaf > > So the sheaf should be marked pfmemalloc, but isn't. Fix this by > precisely determining in the refill path, whether a pfmemalloc slab was > used to refill the sheaf, whether it was on the partial list or newly > allocated. > > Additionally, remove the __GFP_NOFAIL from the initial nomemalloc > attempt so it really cannot end up with a pfmemalloc slab, as intended. > > For consistency, also adjust kmem_cache_return_sheaf() in case somebody > would hypothetically call it with __GFP_NOFAIL. Just drop it > unconditionally and also add __GFP_NORETRY there to make returns > cheaper - in a low memory situation, keeping the sheaf from being > flushed isn't a priority. > > Reported-by: Chris Mason > Fixes: 1ce20c28eafd ("slab: handle pfmemalloc slabs properly with sheaves") > Cc: s/orG/org/ I'll fix it when applying it :) > Signed-off-by: Vlastimil Babka (SUSE) > --- Looks good to me, Reviewed-by: Harry Yoo (Meta) -- Cheers, Harry / Hyeonggon