From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ilvokhin.com (mail.ilvokhin.com [178.62.254.231]) (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 BCF2D397AEF for ; Fri, 22 May 2026 13:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.254.231 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779455146; cv=none; b=Mu9UdgW+RiQvNbVdKvCGRWWcSusOPe9Vh2eB/VcGuUFMxfIM01DFSkXXCo8BgzR+YgTmmRMLipvgWfjkZFIQnw3zodsnvt4aqqRiONaktw08Xgaw9JB4aVDY5LJeKDirp0xhC6lUAEXNW81klIplUlGfx8xoo5aSxselv9VcW1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779455146; c=relaxed/simple; bh=B5ScyaOl4YzpdlBWB0y8bK9XlNKM06Ol48qQ9G0ddsQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SqrB6ZTt/irDS7t0nNFKbPcD69d4bqGC/aFV+HmBIdlK7ZTufUKswywILljDPAVDkuM2g/TAlhalw2voAb/x2H+yuZh4iiMxOCQwLbvSJgDAvTc7cNlos9zHV0Y+Rsoxwgu0bUis+0ynqst+/vhj9NplNeu4qQF8sLb3fDvU6sw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com; spf=pass smtp.mailfrom=ilvokhin.com; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b=sKHXenDQ; arc=none smtp.client-ip=178.62.254.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b="sKHXenDQ" Received: from shell.ilvokhin.com (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 31E60D0A1A; Fri, 22 May 2026 13:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1779455137; bh=B0AoB6rD6l2HyYJa0SvFBEFRIJ8h5+fvRSDiihzR1Fk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=sKHXenDQWr15XRUPNQRrB4ihRSeB6uZTbwIWwfN7vy8LbCu2k1a6jRboQFL2ujjMi n3fQFioeEypYhS5BxkfjLTXQHVyZSRsJwfhVV1p63dgkpvTE/eJrcvMr3gkNc6HsdA RYUiZQbnLfGxZqPbs+scBFptKX9pX6kvhxhXz7xc= Date: Fri, 22 May 2026 13:05:36 +0000 From: Dmitry Ilvokhin To: Andrew Morton Cc: Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v2] mm/page_alloc: fix defrag_mode for non-reclaimable allocations Message-ID: References: <20260520122228.201550-1-d@ilvokhin.com> <20260521165910.e7dea6a4e591d66293d2bd47@linux-foundation.org> 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: <20260521165910.e7dea6a4e591d66293d2bd47@linux-foundation.org> On Thu, May 21, 2026 at 04:59:10PM -0700, Andrew Morton wrote: > On Wed, 20 May 2026 12:22:28 +0000 Dmitry Ilvokhin wrote: > > > When defrag_mode is enabled, ALLOC_NOFRAGMENT is enforced to prevent > > migratetype fallbacks and keep pageblocks clean. The allocator relies on > > reclaim and compaction to free pages of the correct type before allowing > > fallback as a last resort. > > > > However, non-reclaimable allocations such as GFP_ATOMIC cannot invoke > > direct reclaim or compaction. With defrag_mode=1, these allocations hit > > the !can_direct_reclaim bailout in __alloc_pages_slowpath() with > > ALLOC_NOFRAGMENT still set, and fail without ever attempting a fallback. > > > > This causes a large number of SLUB allocation failures for > > skbuff_head_cache under network-heavy workloads, despite free memory > > being available in other migratetype freelists. > > That sounds painful. > > > Clear ALLOC_NOFRAGMENT and retry for allocations that request kswapd > > reclaim but cannot do direct reclaim themselves (GFP_ATOMIC). Purely > > speculative allocations like GFP_TRANSHUGE_LIGHT that don't set > > __GFP_KSWAPD_RECLAIM are left to fail, since they have reasonable > > fallbacks and should not cause fragmentation. > > How serious is this to our users when running real-world workloads? We observed it on a few of the Meta workloads that adopted defrag_mode=1. For the service under load there were 85509 SLUB allocation failures messages in dmesg within 2 hours. All of them are GFP_ATOMIC allocations for skbuff_head_cache, despite free pages being available in other migratetype freelists (~13 GB free). Since it is networking path from the practical point of view, this means dropped packets, failed RPC requests, tail latency spikes and overall service degradation. > > > Fixes: e3aa7df331bc ("mm: page_alloc: defrag_mode") > > > > Signed-off-by: Dmitry Ilvokhin > > Acked-by: Johannes Weiner >