From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (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 9D7023A3834 for ; Fri, 26 Jun 2026 18:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782498155; cv=none; b=UfafG0GfDwbQzgSkHIPFz/WZD78q4L25KbD2HRdRu5uVJIvxOvDOdnrMCCD9UMaGaZOapAN6+BjrJDsCSR6OESG2gC+IK9c+cZs24BJ0LsO3mf3jfn+cVZot2xnocGvo0Z47Rx/c0j9+cWucUUzFpnoF3UXnoRUbPmRIVu1CsRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782498155; c=relaxed/simple; bh=wlVNO6AS7ge87LT3JYLldyQQ3G0+QceWH2reVpaYeX0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h4wcD5vnjQrGGZI4nE/u56Ea7l7GILUqc3d5v8WpF/VBi65aS2Gs0CBu0dCL67qyj66RInqYAhYM57NN6/v1GqVaiaUv6KJgn8ZgAb5m087aohxkmXpu6MBDIvAkSp9bvUis3/oUx+2qwKCD66h8qQRjyNlj/Bu75Tph3aF+Pvc= 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=EeirX61p; arc=none smtp.client-ip=209.85.222.172 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="EeirX61p" Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-9157f7c1c0eso156344885a.1 for ; Fri, 26 Jun 2026 11:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1782498151; x=1783102951; 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; bh=PHIivcOAmzPrQ+dHMiG0qPloG+hsppnhGlUdnRB5nw4=; b=EeirX61pmjN3rUFcBY+1o5t0SXEwl9MA4WWqLCfCf1PRFGRhcVVE8iGu7F9HBJAifk E5vd08Xp3rlQLzehpNrTQV4Y60fpzvtcwAuLTbnGwkegrtXu4zIiyrLWcHibwtR4Vap9 7h6tHSz6oerFiZAJ69lI6jnK8avwOMzjKVP4z23nKS7ALYG/cfqLb7C0SUcdipRCGU0/ z0/m69mOoQ28+FTqoidj3cbs7fI36PelUZbzo9KehRS+JqRtKHzLOxHxKMPjo77zaY4B f1NTPT9ON305X8181g4kEviOywsM2li4qxRK+j6+FNa6NjN2n+mrGcHWtCvpZx3Nc0Bj 52ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782498151; x=1783102951; 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; bh=PHIivcOAmzPrQ+dHMiG0qPloG+hsppnhGlUdnRB5nw4=; b=mayooHRqS/zyREjLzOyrWsrMHOQI+6hyiK4RqxyqNZBQrp2KNa1R/X7FGBhn4PBubI qOx0p6l2R55xRrVhQv//b3DLqVn2OD6hdk5zoliHyZ9vpBIC2D1GHg9kYNFN35ps56fY gMfiHYQ+kR75HaGNCYVxXvIGzZHanHY3GHAEwYodl8sZjCmbs8fVYnx6KY/lXa7SM/Q0 L96jC0xCyqQOoYrdLbjoN4vrMm+ajcU1BLfUTJRHXaMrAqwl+smlLts4XsVPn9mbJ83K OpNBWQePuwmgPI8OKoEOQFxt+yWUuiImT0Oqw98OlJsVIxuiRcRkBmWr3SG+F4CixPXq TQCw== X-Forwarded-Encrypted: i=1; AFNElJ+NzoVhIVKzPnw41p76pvRCGBeOMSqm04ii5B+b5cwCUu3U1dvFnUkYgPGR4K71DVXF9Tlx4PUGPKXRpBA=@vger.kernel.org X-Gm-Message-State: AOJu0YzB7YfM/+AIJECIEwyW4fZoipTr3wup/CjM2IdpNdcJ7/wsUzyF sY65bsT5pL/WxTcTp6E0eqbO3LmHtFy5JTAvWCtUGcVg1eHdwFw/O51MGrhx/tuaSMY= X-Gm-Gg: AfdE7ckVdqlI5w3mWEcA8/kPGrSmjMgCd3bre118gUCvc3y9VT9jOSGPE4JVz5UvbTy ZkgJ4rtgV2dR34d20Dgmfm8gjhaMsq5nPXbKe7/CLFS93lDSvT6ZNMzJjfBFlNvtVi60Nhp2U+0 9cLVfx3IOkHIT1P4i4Tv5Am7Fq7ipj95Oob+zqhD6Z1qWt4Yp8y5gpNxZis8DIADKS2lOeQw1Yd MESNnc7rDP57OU4mh9fRdbrXKoSfTMwf3f++aRr8H9GX2MnOWImXITcwOPZ25F6OiY6+L2fkGgz DfVD+UNPs2fmQD3SqevROWaehgNNQohWNnqu99hdboJizXEm6ff99wi9YYmPNNrCivwF42HSF0V 39maNUDsETHc2a3FeJmMkzB7Jr1sPi0xoHQMj5lAx+X7f9V5CCpy/dkFBNCeNop1rozYeXGIaPE U6tjXzxF3toDx3LZY6YBsFWg== X-Received: by 2002:a05:620a:628f:b0:914:7b4f:cf5b with SMTP id af79cd13be357-9293b85ca70mr1189843385a.16.1782498151358; Fri, 26 Jun 2026 11:22:31 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id af79cd13be357-925fd390e76sm1225544785a.3.2026.06.26.11.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 11:22:30 -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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] mm: fix reclaim storms in defrag_mode Date: Fri, 26 Jun 2026 14:21:16 -0400 Message-ID: <20260626182215.1107966-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.54.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 into 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. 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 two weeks and restores the OOM kill rate to !defrag_mode baseline. Based on mm-new (2026-06-22). include/linux/compaction.h | 3 +- mm/compaction.c | 68 ++++++++++++++++++++++++-------------------- mm/internal.h | 7 +++++ mm/page_alloc.c | 59 ++++++++++++++++++++++++++++++------ 4 files changed, 98 insertions(+), 39 deletions(-)