From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (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 2EE4336C9D5 for ; Wed, 22 Jul 2026 15:00:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784732415; cv=none; b=Bq29mUjtdYtvPnbZpi4meL8Pia2c8F/avHZvhQccVYHS9q5yidUPEKR1vZfVDJdnnIQXSt4zolMrvh8laNFj6PD/JEhDcEKxxBfOf6RX9Nzw2fvDYNvhXXg9X1rbgGcs69mHht80iU6LhYDfqmuJRycep6LWPihCuuueiHtZz4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784732415; c=relaxed/simple; bh=zNzwag3O1nD2Ccn8j2yLu19xg+ladAjuddEjOfAXs/M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g1gsxtbxKLKzOeZiP0DnfUxdbK7cTkF8Dq2HnXIW0LRbnnbb4GBr2or5e+X/6Qi7Vny6XBR9oECIyARH9QjdbBWhq7CPQkYec1AUR3MMlUB5FpQKWix1/qfHrZ3uHjZt+r2wJ9IjBYYX5dyUzCja2brSDCRgFzJWsAgPijUgkic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=O1SXY38z; arc=none smtp.client-ip=209.85.219.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="O1SXY38z" Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-8efb708b1a0so124732286d6.3 for ; Wed, 22 Jul 2026 08:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1784732411; x=1785337211; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=DqWQT0tndGmEGj0PwtBrPN312sJuLlEj79gAZ9AupX8=; b=O1SXY38zE4LwB1eQv4+HoW+/UTRGYIVyQMDICSv1xlwDC6EhT3gEMJ1P0mWYN5lTOF zPzeeKN74LG4FGgm6vaeeMA04WZvHK5HwghMQBJAjOPJSPDn7e1SoHPb8XSvAMbC4Jdm 3rbL9zCH0ssLdV5vrXXFsc8Cz2XEOCdmr/47RDExrosCAGPJTvWerzU/iMMepGvF22Zf 1h8VAvTIIU755Z9G8RQJC8Lz5Ghs/eRQ2/5+lvZD9kfHm34cf+aDPUE/r56KV22B0mZ/ UazVFcRkcITk9tERCZEc4IP+zk7DbxskCKiQFK6F7HwfIups8Zyhfx2wVuGOHioSvDfM I9OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784732411; x=1785337211; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DqWQT0tndGmEGj0PwtBrPN312sJuLlEj79gAZ9AupX8=; b=MCSHSsXbi+4904N0SWCk1r0i8OJoPMWeoMhR/v1eTXJ9gb16wyAB/P/hrCPu4gOMsB dtJrZkx5sFkCGd8U7dH0BZ/ArINpI+5On8EzjwA8A5Bk8DN2DhJOlZFquod3doj4pjAu o2HmtjtYZ5kWcg2m4CbOla/UEavPNfoTCI3ZHBfC/4HYokQlC2Wa0sdQz0obLDY86Bfp cD9plkZBjLSSSwQD27F90gXIdcfvLivsXyvFku0mlsOUybqWUQuXdhHGCkP1SqfMKuAT H1PVZBSRLXdAe910+C3LFK2EyvdSRmcveNIjdOFUt6yVB4nuNSTE3xUbnDzPkaDIPC3t QgpA== X-Forwarded-Encrypted: i=1; AHgh+RoruixLvQxxvbwipGemdj2KlpuC2po1Ep4Ej3bhQrWWcc7z10bhLKfgRKyMulgUrD4t8X7UdaVOfdBDqFA=@vger.kernel.org X-Gm-Message-State: AOJu0YwRXlxZu7Fdtp99OuUO0V1eMCMKsgVY16OZPUyBc6gEzbeboXBX 4INOQ1rgP2qlLsK1o3SOiwT9Jo5hDHIwZgIXYb3u1Wf6xMWNV9vobEEt6FglFZ0w/jI= X-Gm-Gg: AR+sD10nNZH/z3+N5V6fYyBwD4cdeVqfAlaPD84YYHsdbX5fPSBvhcu6RwDB+oQxHZU FA6QPJlax5MkitzyKBQO4xIRJ4lGxpXqQZlcKoQwZMv0/Jgno2RWU9OGlLLXQAJeeBR6OpjTQcr ybxBTwjUOT3t9FHdDmXlZoyhAojx9B+f0+CMjtXhic1UDlyvvbqiBkRwyCH6+6XNTjK+pGeDTip D2svsmTW7kwXFo7yv4s+JUwKef06gUDFXhO6kvje3zCEgGhOq6Cwwy+tpcZSv0drXqpZLRpk7T1 XJXOVaoroWM3o0HYKiqwMU7eUP+LoK1Ib/CaNA8kyZTvTaIbK2v6aed+8KpNBBCl0lu5joReap9 jNizoIA79BpEyvoO4Kv/UUfF3FhpFh+4J63SKnjyInUgD9H+xlaj8ehwj7qT7I2QFmsZmVj4s1I Oz X-Received: by 2002:a05:6214:248b:b0:8dc:ad48:70a7 with SMTP id 6a1803df08f44-9077835c6damr256478456d6.26.1784732410422; Wed, 22 Jul 2026 08:00:10 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-907baa0f4dasm22586176d6.41.2026.07.22.08.00.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 08:00:09 -0700 (PDT) From: Johannes Weiner To: Andrew Morton , Vlastimil Babka Cc: Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Zi Yan , David Hildenbrand , Lorenzo Stoakes , "Liam R . Howlett" , Mike Rapoport , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/4] mm: fix reclaim storms in defrag_mode Date: Wed, 22 Jul 2026 10:56:43 -0400 Message-ID: <20260722150006.3848560-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As we deployed vm.defrag_mode=1 in Meta production, some workloads regressed with recurring pressure spikes and swap storms (which in turn triggered userspace OOM rules on pressure and swap utilization levels). Tracing pinned this to non-movable requests spinning and reclaiming unproductively when kswapd/kcompactd are overwhelmed. Direct reclaim predominantly frees up pages in movable blocks, but those requests cannot use that space under defrag_mode rules; and it is unlikely to free up whole blocks incidentally for __rmqueue_claim() to work. This series fixes it by making non-movable requests participate in pageblock production in the allocator slowpath - meaning, they will invoke direct reclaim and direct compaction with pageblock_order. That requires some small-ish adjustments up front in the allocator and the compaction code: three prep patches and the fix last. The series has been in production against one of the affected workloads for several weeks and restores the OOM kill rate to !defrag_mode baseline. v1: https://lore.kernel.org/20260626182215.1107966-1-hannes@cmpxchg.org/ Changes in v2: - Patch 3 is now Vlastimil's version of the capture_control move: the allocator owns and arms the capture control entirely, and compaction just aims it at the zone being compacted. - Comments on the migration source scan restrictions in patch 2, and spelled out "small" as