From nobody Mon Sep 28 07:18:17 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 444AE30D411 for ; Tue, 25 Aug 2026 04:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632751; cv=none; b=qH3yHenHqi616UUhxIBho7rBKyWniq8DuUXZrIjl8l+ov505Cim7efTEtC6ypocCxOV8GudHAlpEP7jEEjQswFSGAetkuD4hEw2dgbfXmSD0uPLtU6N/rTqOJxZIDKF1p0TZwrwyzahla4tlZ0bNGc3mbDacoBaPTsnXJRGchnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632751; c=relaxed/simple; bh=jORe+HMsb/32ll7TNYGKmrBrpiL8BZrh25lJSUMzchY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XFHZ8J+oSqKTgEwYy0KUyF3grolFypJxV5qR5aW3PeX9IqR95KgjUsDznI1tKrkELb5K0ybG/DFsjulF7xzvzc2bb1NM5B7318AuLxWoaR5tAFlZFy7HCPMyAWiTQ0tfizWsf3Np15psRGbL1pQhzCLzUiezVdDsW0E1hflql4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Or6ZlTOA; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Or6ZlTOA" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2cf6d65d8a7so51827295ad.0 for ; Mon, 24 Aug 2026 21:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787632749; x=1788237549; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NZ6nX8pkGtbAXbIikOXYsenna9XbdloYL6dA4yPYQqw=; b=Or6ZlTOA1jhLD+jL2XAMuQI7qYxcO23LCAurpgik6652C0WwFvwqMPOB1wWgCJABhL icHcUH0viJCXaRpsM1z8cuHh2bVfleo8jpcySfsDdoE/fJKppSwy8jLIw9XMMdxBUaXB rTmcgmSpecBMMdNhZqCBWjDUHjZDmgMQK5MSKPTiygMHNYaHoX9Rt96Dem/4m7ylgbkz Br0bULVWgHd6xxFzPweQmrPvuuSUB7iYSilwzFDpULthR8N1pQdbnZdZq6Zg2cJHv6aR vHgBVJS0GxwvqoTHPgkokwLxy9KB+YUAqAU2UJ7UpUr+jNPHBH4QDPyRq8UcIJC1yu4X zHiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787632749; x=1788237549; h=content-transfer-encoding:mime-version:references:in-reply-to :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=NZ6nX8pkGtbAXbIikOXYsenna9XbdloYL6dA4yPYQqw=; b=SniASNCEOfWf7Tw/h/9c/TIW26q/R5bfABN/GFIZgR/HosB+8XNT5SYgWZ0pUdxTyn 3GnCfimSdd11ybbnnfzF2sQE+1QZenO0jOQ5MHNN02fKkDfZ/tTwvSwulSzPS4hZX2ri kxMFLUUsxOVEe+zD7a6a8A8chWpcDL7L/fikBatu7TK7kLo7jvNg5aCEpnX57DSpVj5M QpZ8BDowDMay/ZTu5cNiCCnDhLc/O9OO2wfQnoUZbPoPbnY6tiJ9JkH4v85FWioi1nTL 7iXXw9yklmTpGf7ZmPNNK0HYDuYqRNlC3eZeABDzLdwHNek3mWVRJRNC+GryHynJFFAR kbXA== X-Forwarded-Encrypted: i=1; AHgh+RrXfx+Ta7/fbwztVGTqQKqLOQ3rOx4yIwaLbDry4ItAAaErAftcmf3Awq6hv6zR7ZC0D3ECUI6P+FhE+lM=@vger.kernel.org X-Gm-Message-State: AFuF++mx4uDm9apgtV1wEvKJxszXXlJVWrh6R5+yLu+4zCd3YaNn3I6d rhc9WcNWJ9QJ1mPf7u/3ZGvuR9U897XHqXAAKw2NGlKK5qXXn0zFFAyR X-Gm-Gg: AR+sD13Y5Hjv8QevCxTM4iu36Hq56ntUPfFTDHrhFOSnJ2+NcBJACs7eNsYSu4AdANZ aEEvFAtUeoVB1JjXq8TzqJHzkRmrXz2MpVKsCvo3WJQDgFq4Lei15cn44IREB67PqDGxY2yP6dW P82o3KzjMVLDCeazO69S1r4n0HwAec9lAHujpcJyX19BWiESGcWIWy/qXy8oKUiq863Bn7HXeSq 4ZWx6tDudmY/Gx2cbaX44KO6f5CMMnSeXM7nBGm04yOMHBud3JGI4fkcwHWjCWQ1A/c0AkniQT5 VAJS4SZuma1UC3HFwXISGmvWRoEFOfaWzNPRJOp6EMDHSjz7TVIdCmnzIR59F98D1IonBeZ4CYy p5GHGwwanyNmA/Hm8xZ6gBYAZ3Wag7I25g7JtkVN4rZd/dHwEHPHLF2jCcZs6hhl+u73rj4tRcn u6y03Fm6RE+0T2EEuOyyQ9NYCyN+PUelVq9iMfkafWvmoscfIuOwkhayj7UG4SdBLkUR1tEME/G MhVGA== X-Received: by 2002:a17:902:f683:b0:2d6:3c1a:85e0 with SMTP id d9443c01a7336-2d6dccfb542mr67347255ad.14.1787632749539; Mon, 24 Aug 2026 21:39:09 -0700 (PDT) Received: from zhangbo56-PC.mioffice.cn ([43.224.245.235]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d6f726e222sm502155ad.19.2026.08.24.21.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 21:39:09 -0700 (PDT) From: Bo Zhang X-Google-Original-From: Bo Zhang To: akpm@linux-foundation.org, vbabka@kernel.org, david@kernel.org Cc: surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev, hannes@cmpxchg.org, ziy@nvidia.com, ljs@kernel.org, liam@infradead.org, rppt@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, kasong@tencent.com, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, zhaonanzhe@xiaomi.com, lipengfei28@xiaomi.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Bo Zhang Subject: [RFC PATCH 1/4] mm: compaction: make proactive compaction mTHP-aware Date: Tue, 25 Aug 2026 12:38:30 +0800 Message-Id: <20260825043833.2659350-2-zhangbo56@xiaomi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825043833.2659350-1-zhangbo56@xiaomi.com> References: <20260825043833.2659350-1-zhangbo56@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, proactive compaction only evaluates fragmentation relative to COMPACTION_HPAGE_ORDER (typically order-9 for 2MB THP). This makes it unsuitable for systems that primarily need smaller high-order pages, such as order-2 (16KB) for mTHP. Generalize the fragmentation score functions to accept an order parameter: - fragmentation_score_zone(zone, order) - fragmentation_score_zone_weighted(zone, order) - fragmentation_score_node(pgdat, order) Calculate the min order in huge_anon_orders_always to configure the target order for proactive compaction. This enables proactive compaction to maintain free page availability at any order, which is particularly useful for mTHP-enabled systems where order-n (n < 9) allocation pressure is high. Signed-off-by: Bo Zhang --- mm/compaction.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index a049415512c6..a4f87232ad80 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "page_alloc.h" #include "internal.h" =20 @@ -81,6 +82,15 @@ static inline bool is_via_compact_memory(int order) { re= turn false; } #define COMPACTION_HPAGE_ORDER (PMD_SHIFT - PAGE_SHIFT) #endif =20 +static inline int compact_hpage_order(void) +{ + unsigned long orders =3D READ_ONCE(huge_anon_orders_always); + + if (orders) + return __ffs(orders); + return COMPACTION_HPAGE_ORDER; +} + static struct page *mark_allocated_noprof(struct page *page, unsigned int = order, gfp_t gfp_flags) { post_alloc_hook(page, order, __GFP_MOVABLE, ALLOC_DEFAULT); @@ -2208,16 +2218,16 @@ static bool kswapd_is_running(pg_data_t *pgdat) =20 /* * A zone's fragmentation score is the external fragmentation wrt to the - * COMPACTION_HPAGE_ORDER. It returns a value in the range [0, 100]. + * compact_hpage_order(). It returns a value in the range [0, 100]. */ -static unsigned int fragmentation_score_zone(struct zone *zone) +static unsigned int fragmentation_score_zone(struct zone *zone, unsigned i= nt order) { - return extfrag_for_order(zone, COMPACTION_HPAGE_ORDER); + return extfrag_for_order(zone, order); } =20 /* * A weighted zone's fragmentation score is the external fragmentation - * wrt to the COMPACTION_HPAGE_ORDER scaled by the zone's size. It + * wrt to the compact_hpage_order() scaled by the zone's size. It * returns a value in the range [0, 100]. * * The scaling factor ensures that proactive compaction focuses on larger @@ -2225,11 +2235,11 @@ static unsigned int fragmentation_score_zone(struct= zone *zone) * ZONE_DMA32. For smaller zones, the score value remains close to zero, * and thus never exceeds the high threshold for proactive compaction. */ -static unsigned int fragmentation_score_zone_weighted(struct zone *zone) +static unsigned int fragmentation_score_zone_weighted(struct zone *zone, u= nsigned int order) { unsigned long score; =20 - score =3D zone->present_pages * fragmentation_score_zone(zone); + score =3D zone->present_pages * fragmentation_score_zone(zone, order); return div64_ul(score, zone->zone_pgdat->node_present_pages + 1); } =20 @@ -2240,7 +2250,7 @@ static unsigned int fragmentation_score_zone_weighted= (struct zone *zone) * the node's score falls below the low threshold, or one of the back-off * conditions is met. */ -static unsigned int fragmentation_score_node(pg_data_t *pgdat) +static unsigned int fragmentation_score_node(pg_data_t *pgdat, unsigned in= t order) { unsigned int score =3D 0; int zoneid; @@ -2251,7 +2261,7 @@ static unsigned int fragmentation_score_node(pg_data_= t *pgdat) zone =3D &pgdat->node_zones[zoneid]; if (!populated_zone(zone)) continue; - score +=3D fragmentation_score_zone_weighted(zone); + score +=3D fragmentation_score_zone_weighted(zone, order); } =20 return score; @@ -2269,12 +2279,13 @@ static unsigned int fragmentation_score_wmark(bool = low) static bool should_proactive_compact_node(pg_data_t *pgdat) { int wmark_high; + unsigned int order =3D compact_hpage_order(); =20 if (!sysctl_compaction_proactiveness || kswapd_is_running(pgdat)) return false; =20 wmark_high =3D fragmentation_score_wmark(false); - return fragmentation_score_node(pgdat) > wmark_high; + return fragmentation_score_node(pgdat, order) > wmark_high; } =20 static enum compact_result __compact_finished(struct compact_control *cc) @@ -2311,7 +2322,7 @@ static enum compact_result __compact_finished(struct = compact_control *cc) if (kswapd_is_running(pgdat)) return COMPACT_PARTIAL_SKIPPED; =20 - score =3D fragmentation_score_zone(cc->zone); + score =3D fragmentation_score_zone(cc->zone, compact_hpage_order()); wmark_low =3D fragmentation_score_wmark(true); =20 if (score > wmark_low) @@ -3238,10 +3249,11 @@ static int kcompactd(void *p) timeout =3D default_timeout; if (should_proactive_compact_node(pgdat)) { unsigned int prev_score, score; + unsigned int order =3D compact_hpage_order(); =20 - prev_score =3D fragmentation_score_node(pgdat); + prev_score =3D fragmentation_score_node(pgdat, order); compact_node(pgdat, true); - score =3D fragmentation_score_node(pgdat); + score =3D fragmentation_score_node(pgdat, order); /* * Defer proactive compaction if the fragmentation * score did not go down i.e. no progress made. --=20 2.34.1 From nobody Mon Sep 28 07:18:17 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.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 93BB53019D8 for ; Tue, 25 Aug 2026 04:39:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632760; cv=none; b=DcegK5gu3h69LJz50yET0ruzNnjql29YRFMVomOQvCbapSTyIqAPTqxuNzhDl37spO/Ax/apK0kDUEiHFk7JtOvaIXW3I2mPsdK2s3Fs+m/H1CeMppuTjbruDmS72MoEyx471TkavJSWLZ7Bxu2H3BfO7Bdth64nycDJ93q50O4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632760; c=relaxed/simple; bh=3W5r20R+wCgMUy7p4TvCq7He2NRKlVsAPdh4fqJFyRc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lo9E03WpktU25HgL87LMsn6jQSfBDv+fq4Y9ITzBXcXw9LeImlvaerK8ylZqfy5DnGV0n6U513vQM2xvqYsBhbIwAX1uHBTq4GS7R9r6Mx90ADHTt3CHYSkkxMX9bvwyOQMnlJM0GjvxBmXQz+rQyXHd9R0tyfEqpbaMA/v1KNw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YaC85d1Z; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YaC85d1Z" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2d6f624c323so980785ad.0 for ; Mon, 24 Aug 2026 21:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787632758; x=1788237558; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JgDt7RRYHrlBCjbTUkuVrBzfVypoO7XYvJ7qcxqZml0=; b=YaC85d1ZU8/Xc6ZgD1ZdFN+4xnaVYk8i0jHPD8OBPa+eXI2BDwZ+lVu+DUz9tw3gy4 BMkkbBjwdJcE2VARP15Lt9jdWSL9DaBfw7BY2I8x7sXfydlbXgiXEguvAZq4m1jEkQJg 3svKBLpveFjZA6HnGm38507D2pgoolubDzPh1+ao950Q5miAUo42/oehlTkdOw4SURzk 1ZABAHyFWPLTGSdDfqLntHwA1nJq8OwsPcE6BQOxBp2CtWPJvI5R51uBMHeQ8jSQyxI2 Lcpu09ahZ82xwL08HvRDBN26hmWc5b157pQx/PYOxzcGMgO3oOMKNeIi0XD052XcZija rZKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787632758; x=1788237558; h=content-transfer-encoding:mime-version:references:in-reply-to :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=JgDt7RRYHrlBCjbTUkuVrBzfVypoO7XYvJ7qcxqZml0=; b=SWMizYB5UEISXV+XHVuXzFMY7sFTh9BIKynZ8IPZXaciPol5qL38QJha9yJyN69x/X 2HQ4ij8WffIF7/QtWKQgl6dDHdVZyY0kyhipsIIcNICC5DozYy4E/NGj9AOj2AfejzZW MQe3QdsJOKJICklukfEd4aYpPR33q+mtv7kfBZvwKz9HXfxoNy3gQtMIo3CErW6Rnqo5 Jo97E3HTZ0/7lDvgXfmnMsAKHZTxTg57Zs+CAD5NqZ9qPLvhqMYMoS1HGH4PIG6EhzhX zogNX5Qegg6deFNYiw0lZjOd4ufjg0t4PT935fssWaXswv81TmHbOVVLVIsc1bwAXA2/ 9klw== X-Forwarded-Encrypted: i=1; AHgh+RrovselRfWoxx5FpnLL+TmrLHPnjd9YUvFxSgsezOmnkC/4jROtwHIgVDFxMcZWn4hKQmR2v/XuIVoSREM=@vger.kernel.org X-Gm-Message-State: AFuF++k8AjQg7nNLcfkxEhilucCerkvzL4Mhre29yraH6TzbuuLOstEa 3eSy6h/sqkUSAI5N0IfbRQDFW01ANmW+OSgARnEqFBiVWQZB7UzGrb+l X-Gm-Gg: AR+sD1046a4wbo5NwrOjzbnhiK8z+sWC1K+GLeX017ucJdHhzBjY7sCLaryTtMcmmA9 BpWcNk6OZDpaRtCOwcqhkum3/VKu5sjH96lzTJi9z9sbsJfThfdfh88qUYmXsgwE2WqxhCqEQCF TpTyemJsOfNnlMauE9bpJZSO/uiSsrFHuR++TlpOlA4ISRqiYbwlt8EK7qClMJknkQSfvw96Tfc +FH1HCWOoZiKnTuRq751d3/WSHzYPQvEMBYEaxZWYeVO8szowJy/aKUMdFRRexkrUuUVwZ+YbnT M3jAAfrmgu3fsIUea0NsauxFB9RcCvUB5pjX6K4XMSDVXtOX9tubkRy7Gn6i+f2b2hflPOyJtV7 kFBugU28lxVjVdnTN/PocAcWhPqWxolzpbDvxrSpmX9upE0+IpOh6eOxcrT+xS1hRo3VYH8bRrF o5amClMdV+j5uxcIdaYO+67/Ed6/+rBjR+YkYmS32XV2lwrCoRwTX5ycAxYa3MqgmbTPDPWaQ3A ug8CA== X-Received: by 2002:a17:903:2311:b0:2cc:6018:f030 with SMTP id d9443c01a7336-2d670ce466dmr376747535ad.14.1787632757691; Mon, 24 Aug 2026 21:39:17 -0700 (PDT) Received: from zhangbo56-PC.mioffice.cn ([43.224.245.235]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d6f726e222sm502155ad.19.2026.08.24.21.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 21:39:17 -0700 (PDT) From: Bo Zhang X-Google-Original-From: Bo Zhang To: akpm@linux-foundation.org, vbabka@kernel.org, david@kernel.org Cc: surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev, hannes@cmpxchg.org, ziy@nvidia.com, ljs@kernel.org, liam@infradead.org, rppt@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, kasong@tencent.com, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, zhaonanzhe@xiaomi.com, lipengfei28@xiaomi.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Bo Zhang Subject: [RFC PATCH 2/4] mm: compaction: skip isolating large folios that satisfy the mTHP order Date: Tue, 25 Aug 2026 12:38:31 +0800 Message-Id: <20260825043833.2659350-3-zhangbo56@xiaomi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825043833.2659350-1-zhangbo56@xiaomi.com> References: <20260825043833.2659350-1-zhangbo56@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When proactive compaction is triggered via compact_memory and mTHP always-enabled orders are configured, skip isolating folios whose order is >=3D the minimum always-enabled mTHP order. These folios already satisfy mTHP allocation requirements and migrating them is unnecessary overhead. Signed-off-by: Bo Zhang --- mm/compaction.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index a4f87232ad80..a15ed2576562 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -837,6 +837,12 @@ static bool skip_isolation_on_order(int order, int tar= get_order) */ if (!is_via_compact_memory(target_order) && order >=3D target_order) return true; + + /* We are compacting for multi-size THP allocation */ + if (is_via_compact_memory(target_order) && order >=3D compact_hpage_order= () && + READ_ONCE(huge_anon_orders_always)) + return true; + /* * We limit memory compaction to pageblocks and won't try * creating free blocks of memory that are larger than that. --=20 2.34.1 From nobody Mon Sep 28 07:18:17 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 F37143019D8 for ; Tue, 25 Aug 2026 04:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632767; cv=none; b=LBmv33Cdnvm0ky84ZAM4KL6Nrz34ahVUILqBklBt3x/ch6xptl14BSS8iIU57ppO8V1oCw3dqrR++MPYDo26K3tGDt+jHpvFThD0yJyPv9ol1svSf9fBiGwvIALe7hl3lKZr7ZHD9++CRvQyJ/xmpaqLdLllP7YF6RYlhOwYbHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632767; c=relaxed/simple; bh=+Vl+7l2PLV00bqHFuhVgD4yxGSgEqidIf5RrfIM19+k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MDW6XB4lTcoCHdoYnoxXewByYiurPNduM9YEPi7S1rdkIxSzLewXeJUJKh9wtOysZxznE4LkZv3Ma0FFUC2XZoQltGJKPusmsQcQWKGEe0+wDXOJEax4HLbxyAld+pF2h7tj5B/3wvBFpB0CNuqvQaMp6frvHh1XwmFQ2vc6vEE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QYZBzt8f; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QYZBzt8f" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2d6f55a7089so1420715ad.3 for ; Mon, 24 Aug 2026 21:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787632765; x=1788237565; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=eWFRj4+Vuu4BIcgt3B0a1nLqz2rP8eB/Ak+39tP9gvs=; b=QYZBzt8fj9lOd6e8itS70mUhZM9ebR7ps9f8BeXIlWR4Sv442DG7TPdWrxj4lPfNeJ tUZNIIcKZtXJCPgd/z+aB6ZgsPKmnzFBusQEcjW8xDBxOEQAjyiGzSB1Z37HxM6jIvBd 0QV7DZ/cimvpTq1RjMirb09ivvcBYYYV7ngM6UgiCNMNkyfe7vH7cI1Wlx4uXRd6TZ10 pIQp9WGQueD4z8zo7hkgpTtj8hkZfBSJBlVuTUfx4ynMJx9UgyEMTeL1YCPlO+7dkBaN ugV9pFEUMt4FFWMZmH1O1/rlfSFwHQPHb/sLKKVlANI86+zut+p77x8M92PBFKQibY9u PjEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787632765; x=1788237565; h=content-transfer-encoding:mime-version:references:in-reply-to :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=eWFRj4+Vuu4BIcgt3B0a1nLqz2rP8eB/Ak+39tP9gvs=; b=gC7bDCr0MtTaPWibe1mQAe/EoMClOxfayBXb8vtPZc1etWDCorzuTziCcO0coL+Y9r /36u2088Z7dPtldRqHUl72UiAfxWW47T4XjVXhkQLPG47cYdzcxC5EFknMo/2VaqIMnT LfzazYwMhb+Cj1d3RPYhsERs/EgoBdSLD5L/zqgWNAa5B1Rd00D8i+fzJtPp2yrL4mdX fJ3PlTPJSMKsyzCmnWyx0oz5xlrvKA+rXNd87Ey5mwhWIs9EqU0R04gUkQdlFfvLFKL7 DUE+7WD6281sD9v4L8PgkLYgYK3a5sYt1Rq4JtWhY2266nW1ZAK+jVXEonHYjgdAUxgc 3UHg== X-Forwarded-Encrypted: i=1; AHgh+RrhGLKF0b6qGVuoIteGOC7mOP+yaaeb4mKcMoWcLSGhVRILG2jTcFAAuFmlMZKXoCV4egbkkOahEkoVsdQ=@vger.kernel.org X-Gm-Message-State: AFuF++luCKQxfNLdJATedmgPh8UunEiKwE0mf7Ds685CbUlWMpyAqsW7 cGe6r3AizphGspB4pVh5phwMsDCm1ZJ/nOonX4ihdrrqsqM3wE8EGmZf X-Gm-Gg: AR+sD10sZwkQmBeb66rAOwmN4+soWxtW8+sa8Cc0BSmaPrPGWdRwT7c92UuxQY9OYva GPXM5fP+7dAXxu9D0mD9Ek/cKnaqXuE1o7v2UYxNmoGH1oLcTQGQuwz+JPM7uOFc9tJq5ZLweUE MoIMRRrMmJ6t/PWbpSw2qGH1artotXHw4Hr4AsSPDlZlyf2SuZfixaj3NQvec8f02wYeOEwBB8k S+gNT7qdq8degrAUhdeYN/UC3M7K6veIM392WKTJuiNPXTSbHX7EZpvxSyLxXa6r1fUf84Q87oO Y9ZL3pa2lD9elR23KLBPEvYiQ07HJLMLm5qXjxDlM2TIXbyxLox1SZ6BE0b4+eQb1oFipr1J/43 eHGTnjrJqN5+geXxGCtzveNslaE9UNX/S3feMOsDz9ykXcc5DiZlgXT0XcQrmntr7Ex4LWOCSnm DG8ZG5L0+Qd3XDMGazjbR/7vdWLpiZv3nW2VYzoa6JGNz6NQ+GU5aue1sy/HSr+CfrY/4iRBZXo 1LnFA== X-Received: by 2002:a17:902:da86:b0:2d5:cb05:49d9 with SMTP id d9443c01a7336-2d670bd7471mr388769855ad.5.1787632765279; Mon, 24 Aug 2026 21:39:25 -0700 (PDT) Received: from zhangbo56-PC.mioffice.cn ([43.224.245.235]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d6f726e222sm502155ad.19.2026.08.24.21.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 21:39:25 -0700 (PDT) From: Bo Zhang X-Google-Original-From: Bo Zhang To: akpm@linux-foundation.org, vbabka@kernel.org, david@kernel.org Cc: surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev, hannes@cmpxchg.org, ziy@nvidia.com, ljs@kernel.org, liam@infradead.org, rppt@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, kasong@tencent.com, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, zhaonanzhe@xiaomi.com, lipengfei28@xiaomi.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Bo Zhang Subject: [RFC PATCH 3/4] mm: compaction: don't skip proactive compaction for non-costly mTHP Date: Tue, 25 Aug 2026 12:38:32 +0800 Message-Id: <20260825043833.2659350-4-zhangbo56@xiaomi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825043833.2659350-1-zhangbo56@xiaomi.com> References: <20260825043833.2659350-1-zhangbo56@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When the minimum always-enabled mTHP order is below PAGE_ALLOC_COSTLY_ORDER, do not skip proactive compaction even if kswapd is running. For these non-costly mTHP orders, kswapd reclaim alone may not produce the contiguous free blocks needed, so proactive compaction should proceed concurrently to ensure mTHP allocation success. Signed-off-by: Bo Zhang --- mm/compaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/compaction.c b/mm/compaction.c index a15ed2576562..15b92475562a 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2323,9 +2323,10 @@ static enum compact_result __compact_finished(struct= compact_control *cc) if (cc->proactive_compaction) { int score, wmark_low; pg_data_t *pgdat; + bool costly =3D compact_hpage_order() > PAGE_ALLOC_COSTLY_ORDER; =20 pgdat =3D cc->zone->zone_pgdat; - if (kswapd_is_running(pgdat)) + if (costly && kswapd_is_running(pgdat)) return COMPACT_PARTIAL_SKIPPED; =20 score =3D fragmentation_score_zone(cc->zone, compact_hpage_order()); --=20 2.34.1 From nobody Mon Sep 28 07:18:17 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 7F9FC348883 for ; Tue, 25 Aug 2026 04:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632774; cv=none; b=A7//ztM+XC6/kCEBaEY2oCqI3YlgeL9rawQD6H4hxGTfhxuLzkIj6NmMAyLZBjvaCk9JNNvb/ZDrrhLveiAcymugz+JJgJ46SETvNzLXbX3+d5Kz3qwpGWfLDvqP0giPMAzXixoAfve2tpU4BpPb0jonNOZKSvCZw69P6RGfxaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787632774; c=relaxed/simple; bh=ZxzbowbjlwGeALhI83mN9Es0rctTGEEYcDjeJfYnptY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nu3V0yOrmP5R4COcO4nB+GPPeK2adEuKHoj9hSbVf5PARQfQgTCazzYM79WTQY8Bg68B15KH8b+GhdesfWaZq4fvaFXiv13+4sgcL7JnXLd/iUIvzanlatXD3pXoUgIluttE2bSLvUDYTTT5jG9I7PV+4m28k8FKeYF5p+O8mqI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DuKviXsb; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DuKviXsb" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2ce87c7e3bbso47437525ad.1 for ; Mon, 24 Aug 2026 21:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787632773; x=1788237573; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HPfrun+7l966UjlqQm4w/H3qmkSf5+9NW9rMf6ob2Zo=; b=DuKviXsbhUxQGCSydVj3b8jk0/fg7ikpF9xCvfutdYYan9AY4pa2hA94sINt59kBox IYXJwLe57h4wdF5cGUQIsSUnzrQAZhdrpSlw8EekwZ0AZGBtHzqBXi2Ma0YUmpb/EFHt 1DmqU06Gb2rrvs2azgRPM3VIG6Y2W0XANujVyI/N+qcVBOhdTGeSC8mciVQUHqHf9873 ZOrSSBCgjrG9GapBa1sJ5S7DytgEvkJW6kaj+xoQImqUXFac+OQ6LLBWJEUIPjWcNEO3 8FpjcQip/SXi6u+wCTYK1WFhEpAJyYpEkoAhUw699Y+QO4Vnyl4i341HzzRjAsNQsLPk oK8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787632773; x=1788237573; h=content-transfer-encoding:mime-version:references:in-reply-to :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=HPfrun+7l966UjlqQm4w/H3qmkSf5+9NW9rMf6ob2Zo=; b=fr5GRbKXXcQByZ4dyVZ+i6qMHxLGdnONWTv2M+2bbxAiKE4fcrxn+Zwo0UEtz7fjlS scw0R2wWVlms8hwgZJtySUPP04OrP2o5ybRpKkHNxoAsKcDGRdG3hlhJA23r4bDrGwJr WandTUeyy8yDAjRX/5aUCynkvEpbss6YSCefU5tdHQyOjWff+/29rRBvHpG/GxbGSTja MBU+0lGjiij3wTv37lLQj643XBG3CW5AQCX5eKR8bcIFtsaQ/xIE1/DBUYFC8ylrGVar b9E7o1AMHksGCEPRP4UpH2dGncGzx16ItFRTh4OYSzTCSTf/Q8wzNB5JkZamGKgRCJFN lO/A== X-Forwarded-Encrypted: i=1; AHgh+RqAKOFlVbg19+D6H0/Yg14fg32fDWrZ0RBLN97w6QGBRyBYb8R5uJQqYnv+bPxV81k4kOaUJ6hQwP3vXTQ=@vger.kernel.org X-Gm-Message-State: AFuF++mi2qHpDoIBh2Uy0OLj5zfor6IRcytJe2mFfTaJtIz/npvwSmlp AMMeF0bIRhTUCRZTrHXEtBbK/pbvF6sXme2VmzL2y0IqOdK8xd83RA3m X-Gm-Gg: AR+sD10Gi6UYArxg8Q0YBx3SIEBbkvWfdv0u+QYeivDhk3qelhyJfrRHTKQuTGlzleO xu8LJ8Fd74g8Y+3PAo0vPfpqswRKVuJbMfkbioHlAxTabETO/LemaoAt9OzGmIIwPMDwJQNxR9e xEM9FfevgNmsZ3OcL9ah9h3S/p8cxhObnuntjWaECJBYMVf5TvJKhRu+zuuMXA32RZ8Px4no9kY K7ej8Xmv3d4X6XNniOwUGO5bQ1Tm/KkPobkfxaNtrvfKfC5iBzD3X8olAmyBQBO37y1/lTp6l8N cq7LyjqLsd3hHQGUKqaIDYkb9/klKadbziib95TRc2tbDw4buN80V+jfULrGxL+t2C5MhPcsMRA ERJp2dHWK30QMRy4bfyjQXCGslWdghDIzyMKdz9C1PwwIFy1ySWsWTz2oR3kDzgnO4qtXX5XBM3 ZVSNFcWmftgZSC/2iwHeNMZpCXdS+m9+h/yQWa/Frkc/MqN+Z58pjh8SvQRHoOiPJsS1FmDv00e 6a1udsZAwJ5JHOY X-Received: by 2002:a17:902:da89:b0:2d3:716e:e2ae with SMTP id d9443c01a7336-2d64ae18c43mr573095945ad.6.1787632772791; Mon, 24 Aug 2026 21:39:32 -0700 (PDT) Received: from zhangbo56-PC.mioffice.cn ([43.224.245.235]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d6f726e222sm502155ad.19.2026.08.24.21.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 21:39:32 -0700 (PDT) From: Bo Zhang X-Google-Original-From: Bo Zhang To: akpm@linux-foundation.org, vbabka@kernel.org, david@kernel.org Cc: surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev, hannes@cmpxchg.org, ziy@nvidia.com, ljs@kernel.org, liam@infradead.org, rppt@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, kasong@tencent.com, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, zhaonanzhe@xiaomi.com, lipengfei28@xiaomi.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Bo Zhang Subject: [RFC PATCH 4/4] mm: adjust free_pages to make __zone_watermark_ok() mTHP-aware Date: Tue, 25 Aug 2026 12:38:33 +0800 Message-Id: <20260825043833.2659350-5-zhangbo56@xiaomi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825043833.2659350-1-zhangbo56@xiaomi.com> References: <20260825043833.2659350-1-zhangbo56@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To improve the mTHP allocation success rate and reduce fragmentation over time, introduce zone_effective_free_pages() for mTHP-aware free page accounting. Refactor the free page counting logic used by pgdat_balanced() and compaction_suit_allocation_order() into a shared helper function zone_effective_free_pages(). The function selects the appropriate free page metric based on context: - defrag_mode: use NR_FREE_PAGES_BLOCKS (whole pageblock accounting) - mTHP always-enabled: count only free pages in buddy blocks >=3D the minimum always-enabled mTHP order, since smaller fragments cannot satisfy mTHP allocations - otherwise: use NR_FREE_PAGES Signed-off-by: Bo Zhang --- mm/compaction.c | 38 ++++++++++++++++++++++++++++++++++---- mm/internal.h | 3 +++ mm/vmscan.c | 23 +++++------------------ 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 15b92475562a..29be72597415 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2528,6 +2528,38 @@ bool compaction_zonelist_suitable(struct alloc_conte= xt *ac, int order, return false; } =20 +/** + * zone_effective_free_pages - get free pages relevant to allocation order + * @zone: target zone + * @order: allocation order + * @use_blocks: if true, use NR_FREE_PAGES_BLOCKS + * + * In defrag_mode, watermarks must be met in whole blocks to avoid + * polluting allocator fallbacks. kswapd usually cannot accomplish + * this on its own and needs kcompactd support. + * + * When mTHP always-enabled orders are configured, count only free pages + * in blocks >=3D min mTHP order, as smaller fragments cannot satisfy mTHP + * allocations. + */ +unsigned long zone_effective_free_pages(struct zone *zone, + unsigned int order, + bool use_blocks) +{ + if (use_blocks) + return zone_page_state(zone, NR_FREE_PAGES_BLOCKS); + + if (READ_ONCE(huge_anon_orders_always) && order =3D=3D compact_hpage_orde= r()) { + unsigned long free_pages =3D 0; + + for (int o =3D order; o < NR_PAGE_ORDERS; o++) + free_pages +=3D zone->free_area[o].nr_free << o; + return free_pages; + } + + return zone_page_state(zone, NR_FREE_PAGES); +} + /* * Should we do compaction for target allocation order. * Return COMPACT_SUCCESS if allocation for target order can be already @@ -2543,10 +2575,8 @@ compaction_suit_allocation_order(struct zone *zone, = unsigned int order, unsigned long free_pages; unsigned long watermark; =20 - if (kcompactd && defrag_mode) - free_pages =3D zone_page_state(zone, NR_FREE_PAGES_BLOCKS); - else - free_pages =3D zone_page_state(zone, NR_FREE_PAGES); + free_pages =3D zone_effective_free_pages(zone, order, + kcompactd && defrag_mode); =20 watermark =3D wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); if (__zone_watermark_ok(zone, order, watermark, highest_zoneidx, diff --git a/mm/internal.h b/mm/internal.h index 38b1165212c9..14bb9543879b 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1654,4 +1654,7 @@ static inline bool can_spin_trylock(void) return true; } =20 +unsigned long zone_effective_free_pages(struct zone *zone, + unsigned int order, + bool use_blocks); #endif /* __MM_INTERNAL_H */ diff --git a/mm/vmscan.c b/mm/vmscan.c index c1404a59523d..a419a2c2fca4 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6966,7 +6966,6 @@ static bool pgdat_balanced(pg_data_t *pgdat, int orde= r, int highest_zoneidx) * meet watermarks. */ for_each_managed_zone_pgdat(zone, pgdat, i, highest_zoneidx) { - enum zone_stat_item item; unsigned long free_pages; =20 if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) @@ -6974,21 +6973,6 @@ static bool pgdat_balanced(pg_data_t *pgdat, int ord= er, int highest_zoneidx) else mark =3D high_wmark_pages(zone); =20 - /* - * In defrag_mode, watermarks must be met in whole - * blocks to avoid polluting allocator fallbacks. - * - * However, kswapd usually cannot accomplish this on - * its own and needs kcompactd support. Once it's - * reclaimed a compaction gap, and kswapd_shrink_node - * has dropped order, simply ensure there are enough - * base pages for compaction, wake kcompactd & sleep. - */ - if (defrag_mode && order) - item =3D NR_FREE_PAGES_BLOCKS; - else - item =3D NR_FREE_PAGES; - /* * When there is a high number of CPUs in the system, * the cumulative error from the vmstat per-cpu cache @@ -7001,9 +6985,12 @@ static bool pgdat_balanced(pg_data_t *pgdat, int ord= er, int highest_zoneidx) * counter won't actually be per-cpu cached. But keep * things simple for now; revisit when somebody cares. */ - free_pages =3D zone_page_state(zone, item); + free_pages =3D zone_effective_free_pages(zone, order, + defrag_mode & order); if (zone->percpu_drift_mark && free_pages < zone->percpu_drift_mark) - free_pages =3D zone_page_state_snapshot(zone, item); + free_pages =3D zone_page_state_snapshot(zone, + defrag_mode & order ? + NR_FREE_PAGES_BLOCKS : NR_FREE_PAGES); =20 if (__zone_watermark_ok(zone, order, mark, highest_zoneidx, 0, free_pages)) --=20 2.34.1