From patchwork Mon Jan 27 21:46:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBDxYJhcGnFhHNraQ==?= X-Patchwork-Id: 13951747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4BD2C02188 for ; Mon, 27 Jan 2025 21:46:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63C162801B1; Mon, 27 Jan 2025 16:46:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EAD22801B0; Mon, 27 Jan 2025 16:46:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B3F42801B1; Mon, 27 Jan 2025 16:46:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2C5E42801B0 for ; Mon, 27 Jan 2025 16:46:52 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D52D7B080C for ; Mon, 27 Jan 2025 21:46:51 +0000 (UTC) X-FDA: 83054567022.17.8A5D74C Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf25.hostedemail.com (Postfix) with ESMTP id 03572A0002 for ; Mon, 27 Jan 2025 21:46:49 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=CdNnlh0A; spf=pass (imf25.hostedemail.com: domain of 3yP6XZwoKCGkTJSHWPUZRPNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--mclapinski.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3yP6XZwoKCGkTJSHWPUZRPNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--mclapinski.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738014410; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sg18kjAFZeqr6iErPKWsTCmY69Yia/6QwhH3blqcAPY=; b=u6PwGpuKLPUO9lYG9jluuO749MJ0x/IWFOUVjJGh6H8hbiUKVXW1aLhb8TFjirkfa1xeVx yQWTcburrXBBrvEojdTE286kagrK0cGCX8grkyjPOKHipnUIrSIgk+7W94I68SE7cS8iiH esu0bhxPRP9OS5bCqcGhZr2kuBcKHlU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=CdNnlh0A; spf=pass (imf25.hostedemail.com: domain of 3yP6XZwoKCGkTJSHWPUZRPNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--mclapinski.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3yP6XZwoKCGkTJSHWPUZRPNVVNSL.JVTSPUbe-TTRcHJR.VYN@flex--mclapinski.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738014410; a=rsa-sha256; cv=none; b=umE0F3+lOgymYr+1gyDUSAn1yPsrfa2MNXq45d/cTc6fTpp0bg1Ew0MLRzvV8Gd4A1Lc7g VZSlACdE2kBZ6Mhq6CRaAwcnTIltNuKLP+HAKI/pzXDM7Nz0DTA3uhKDNrOqaJwfZ68pIr 5x0UdDd6qgOWIQEqXan8vgDdfE6ToD4= Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-5da15447991so3826955a12.3 for ; Mon, 27 Jan 2025 13:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738014408; x=1738619208; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=sg18kjAFZeqr6iErPKWsTCmY69Yia/6QwhH3blqcAPY=; b=CdNnlh0AnMfytk4kvdFssTGl+MTcm6Hkr43GxD6INhjblSCa6A2h0qnpjp5yCh7AM/ a0nCCtqgqtHZ1up6Wv0v29xmK3bNzgu5VpW4B4jVVWDbrBkPvKmqK1HatQlls8Aht2He TSIXDWEnZaCwvfrEZxenEC6d1lmS3SMFBQwgU4BqkSPNeH2Qvg0IhA8EKY3cW62d4JCa LJ3JUeMByZDPIipx35Fa556tSwewi4K/vEa4DFGE/oj/iV3R0cOUN6+X/qv4jeY9lR7n uR9LIQ2zzC+7cH4EL+DXOOvTDqn9yUrMnbWzyEDP3WSoqVOw7EslgvbL8DoSwsSXzVo6 COfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738014408; x=1738619208; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sg18kjAFZeqr6iErPKWsTCmY69Yia/6QwhH3blqcAPY=; b=Qp1Ema3mgw7hy4m1tPVjf/i3dH1j8+xdnFc/5jofZiuiOXe2CqDtNj927VP/ETqXEZ jYL3m7PBsYQS7EdPsGhJHV3iaqk/yYCZwJfmBJBBP/5335Wv7U/ctDbFI5wp8VuJkm7v nCqRoWpaAVfVKIariVCiBbJWMaZcevfHGsW3YcyO8HZX37k3jSKfy2O2YJ4Wj+z94YmA bd4GZHHqpy+9wpeIZ7qEmA8qrRNw61PpVkmRBwoVIgTnQEJXCZ4wXymGhPXfQughr/9Q u1b27CjuDEba8RcAXbSBVIhWTJqmQGuUxEAziH1k42fk5ZAPEI4fKQOVBWAlPyqVVURY GAgQ== X-Gm-Message-State: AOJu0YwmmwlBjFN1Vl6+9ffregwlcGQHmVFtbSPq0fzOxO9uGl6qEXBD eNBA3CnjDtrWRgC4+YW2jGXtOKZsrQNDJh/Di1IyXONQ8EJfazmm2iyqvA5Jq/9HXeUYETr/gP6 AnUP8vT+4v/N15aF8qw== X-Google-Smtp-Source: AGHT+IGaiRZr4EJB8fg1nV9+CzFnJep+BrzNkzXZQp0+QI20M+WZbOx8WndefkOa65xga+7THi3tCjTck34BBOyH X-Received: from ejeh21.prod.google.com ([2002:a17:906:3995:b0:ab6:945a:f185]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:1e8e:b0:5dc:1059:6b2 with SMTP id 4fb4d7f45d1cf-5dc105a5ec1mr41424107a12.7.1738014408681; Mon, 27 Jan 2025 13:46:48 -0800 (PST) Date: Mon, 27 Jan 2025 22:46:26 +0100 In-Reply-To: <20250127214627.4021412-1-mclapinski@google.com> Mime-Version: 1.0 References: <20250127214627.4021412-1-mclapinski@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127214627.4021412-2-mclapinski@google.com> Subject: [PATCH v2 1/2] mm/compaction: remove low watermark cap for proactive compaction From: Michal Clapinski To: Andrew Morton , Vlastimil Babka , Pasha Tatashin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Clapinski X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 03572A0002 X-Stat-Signature: 1cda15gja9n9e8cjuu4tmtfkakmxirb9 X-HE-Tag: 1738014409-154352 X-HE-Meta: U2FsdGVkX188FF1LkiKZLwLNIiCx1WKV8jtXNoiZxcz/b9aSfLWqH4c/4e0PghgONZoqEWRlwMU8Uu6OR/c+9Mc79JcCHMjOiU00ONcglA8vcVnZKuU56glucVLPBTz7LPo2NZii6X7u0L8C9CZ8DVE31z2h65Yj8FEKpA4wvF//qyg85TNcgX7DLT89ca/z12WE/5Qj5Zkjh70ISsS9oFsK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IcQNrEcf19cu36SbN5/kOMWtlOA505gTgIC+pHDRdbGCnlGBt4vao2N0//IdztN91z/QqKKVnG03QSFhTgyBzQ4+JnVhClrjOsp2/4cmkfUDMxdVs+PpNysIz1orG4+IMg3PLj4wD7no+MTiNUtoQSb/qeRsC2Clc7avUXb7C+rTwHasVLhxzo/ADIKpr+PuFiJ/a6MrHosohDGk/UzRIPnVHQelXi1883VFJ5ztSOBYc4Doi9eoaghQ17C3a/Kx8JdWi/LiMsuqvxC71p6jw2NfZedV7MqKPPZceAw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Previously a min cap of 5 has been set in the commit introducing proactive compaction. This was to make sure users don't hurt themselves by setting the proactiveness to 100 and making their system unresponsive. But the compaction mechanism has a backoff mechanism that will sleep for 30s if no progress is made, so I don't see a significant risk here. My system (20GB of memory) has been perfectly fine with proactiveness set to 100 and leeway set to 0. Signed-off-by: Michal Clapinski Change-Id: I007e3a02d126d3858ceecf5ce57a1c360177c37b --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/compaction.c b/mm/compaction.c index a2b16b08cbbff..29524242a16ef 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2253,7 +2253,7 @@ static unsigned int fragmentation_score_wmark(bool low) * activity in case a user sets the proactiveness tunable * close to 100 (maximum). */ - wmark_low = max(100U - sysctl_compaction_proactiveness, 5U); + wmark_low = 100U - sysctl_compaction_proactiveness; return low ? wmark_low : min(wmark_low + 10, 100U); } From patchwork Mon Jan 27 21:46:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBDxYJhcGnFhHNraQ==?= X-Patchwork-Id: 13951748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79A19C02188 for ; Mon, 27 Jan 2025 21:47:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 097F32801B2; Mon, 27 Jan 2025 16:47:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 045FB2801B0; Mon, 27 Jan 2025 16:47:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E500E2801B2; Mon, 27 Jan 2025 16:47:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C2E1A2801B0 for ; Mon, 27 Jan 2025 16:47:09 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7E349160727 for ; Mon, 27 Jan 2025 21:47:09 +0000 (UTC) X-FDA: 83054567778.04.59F206E Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) by imf11.hostedemail.com (Postfix) with ESMTP id AE9A640019 for ; Mon, 27 Jan 2025 21:47:07 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=iBckJDMJ; spf=pass (imf11.hostedemail.com: domain of 32v6XZwoKCHslbkZohmrjhfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--mclapinski.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=32v6XZwoKCHslbkZohmrjhfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--mclapinski.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738014427; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7UVb+GoBBSHoiZedLFy6B8b5YfCszIM+0jeoCG22gAA=; b=5stBZHK+cJreBFRtSCznBihYOv9m1goZo+tWVvH/hGBntJIaUAfB/y6UgeKpDSYs/Hhrjg oHyBoAgEjBgFC2SMqA/pMBGGmH+yKSIBQ4cvfAg4xXYJt/7snZfUIYE7sCsPA7SYSrmNPj uvbAACbzhRE+CgTw1opbOk54QIPEToI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=iBckJDMJ; spf=pass (imf11.hostedemail.com: domain of 32v6XZwoKCHslbkZohmrjhfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--mclapinski.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=32v6XZwoKCHslbkZohmrjhfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--mclapinski.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738014427; a=rsa-sha256; cv=none; b=yES0D0ZEvFrC4TodYBK6CQJ2bdUk+3eNVIQXNUZqIhF35XtXFsfmKwoLm2xP4znzhrPgNT J9llsIaDRAN16hgY4VWsLNsTmNOKklWlvSaz4hJpd4wWvTQXWEaTMyM16PkL19l8MBW6H3 0NRc8o9PTgI2Y7L/K9FzcBF5snA1ppk= Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-ab6aa02e747so130571966b.2 for ; Mon, 27 Jan 2025 13:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738014426; x=1738619226; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=7UVb+GoBBSHoiZedLFy6B8b5YfCszIM+0jeoCG22gAA=; b=iBckJDMJ02U7A+BVSz1hoqfIuKO75fccOvrRIYJwWJTnazqHCJShhWS8rJ6yjlylr4 tTUW1ej3WM6u0juOAyHfpVLjmhuU7Xd2dEiMzVL9ythj0LWE8wTMSIolAPPZ3A1mYiov pYdMmn6tD19C7nYHlwiIjlLCS9FkMhMnsHW6AFEBMFiILPwbNA/Uo9SJR5xOlM1WHHsC cl3v/Ss+t05BMuWoiF0Ubx+Zh1bvkHIcDFmpmxFGAGx5T0Ftb6zOE8CGzI/eg36R2YWo ZH4pinNFZcVdZ7wjcsaowXyqW2HFHHYSBtKmsYF3L5n0q1W41CQb63XeCleLofNRkONd MYuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738014426; x=1738619226; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7UVb+GoBBSHoiZedLFy6B8b5YfCszIM+0jeoCG22gAA=; b=Ak97qTsQ8l5VhIGwI6EZoXZ1hsdmHJqiOkmPG5widFmCFpQ4ZS7mKRCrtv880kvAk4 RT+WLUAj5TjuyruKL5l0m57020u/P/T9LUoB0cHwk5KUtImiI/AodLzhhNN2YbNgVUCB pTTEVySnHPW4AyyjDU+G0tH+uIZKJamfVQb34b+y7RG6FpxMfOEo/GqW3QT5x5DqEKLg KT2/uMR91I0EMOd/1LYdxQ/KeNfywccah4TJSQMVDISxKWQOBv7Tk3+jXi2MKfMYLADh Iw4ErD7SbArfsNaV+JAxDpzIHMdhZ4gX5u17jKIuRmlxxfvcVsVmgpgj9VOIPqOi7sJV CG0Q== X-Gm-Message-State: AOJu0YzMFmm+hIQnsypvWewP0kRMQnWb0O4bhI3x+7jgKT7DMUAfRUIF Q6HkIOrEALayvkqP4c5k6PrP1YY06giRjBMRh0UFp31cxhQ3R8j6AHJxzNzyKHCxGNfGhOuX60G hHSNy74pHER5/L/fHRA== X-Google-Smtp-Source: AGHT+IECc9KE6PE4hZ2lv2wDyvkCk2SPm4zj7FVDRyIlw43wk0T+qFIScoGSEgOBvO62QokHsGzieqtaukjywscp X-Received: from ejccm19.prod.google.com ([2002:a17:907:9393:b0:ab6:8e30:8be2]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:7e8c:b0:aa6:af4b:7c87 with SMTP id a640c23a62f3a-ab38b1ff093mr3382815566b.21.1738014426260; Mon, 27 Jan 2025 13:47:06 -0800 (PST) Date: Mon, 27 Jan 2025 22:46:27 +0100 In-Reply-To: <20250127214627.4021412-1-mclapinski@google.com> Mime-Version: 1.0 References: <20250127214627.4021412-1-mclapinski@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127214627.4021412-3-mclapinski@google.com> Subject: [PATCH v2 2/2] mm/compaction: make proactive compaction high watermark configurable via sysctl From: Michal Clapinski To: Andrew Morton , Vlastimil Babka , Pasha Tatashin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Clapinski X-Rspamd-Queue-Id: AE9A640019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: tb4ggr68suimxieog3is1skhj8pqngsx X-HE-Tag: 1738014427-73409 X-HE-Meta: U2FsdGVkX1+MzgUVkDprLNsvb5sP5cKyqiJHnPqt0EfLLpxRae6Xz4gXrv7BdZZ10V8JXHzDzKybKcKczexvc3svv2Q+ow/A5Rxriaz3yPPQBITvDpSQHiM8EIdCrthfA7d6BWcFOVYGqcdajMBauYA6gAXltF7hwJNur/ZE5DqIJ2xvQ+7A625S5y3BuFDjDNkjX4/I+HTCHvTKJtYmYVPUjJ2E6GRE4JNFQ0yCumVV25O/9XgMHu9N291BtE9GTTs5k62sgPp+TvX+OxHPt3gWMADqY8PPfgb5FDe+z7wm090EKNZOa8Vqng9QCPIzYpd4S2OJLdfZ48fAvrac1PdrF3gKcn5EwwdAnDz05+XAFz1RtsGup0vK7H+qxSEkF3S2zoMEZcvatCELsZm1cgMtBd8OO8Mj7hA+B9zaWXd2cwYMa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tJEkCrEjTz+hQhmgI/5wY1mGlyfUC4pR4redNxMzixY4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Currently, the difference between the high and low watermarks for proactive compaction is hardcoded to 10. This hardcoded difference is too large for free page reporting to work well. Add a new sysctl, `compaction_proactiveness_leeway`, to control the difference between the high and low watermarks. Signed-off-by: Michal Clapinski Change-Id: I4fecd273e9ac55a3e75770ff18c53d5db6acf1ff --- Documentation/admin-guide/sysctl/vm.rst | 17 +++++++++++++++++ mm/compaction.c | 12 +++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst index f48eaa98d22d2..ec6343ee4248d 100644 --- a/Documentation/admin-guide/sysctl/vm.rst +++ b/Documentation/admin-guide/sysctl/vm.rst @@ -27,6 +27,7 @@ Currently, these files are in /proc/sys/vm: - admin_reserve_kbytes - compact_memory - compaction_proactiveness +- compaction_proactiveness_leeway - compact_unevictable_allowed - dirty_background_bytes - dirty_background_ratio @@ -133,6 +134,22 @@ proactive compaction is not being effective. Be careful when setting it to extreme values like 100, as that may cause excessive background compaction activity. +compaction_proactiveness_leeway +=============================== + +This tunable controls the difference between high and low watermarks for +proactive compaction. This tunable takes a value in the range [0, 100] with +a default value of 10. Higher values will result in proactive compaction +triggering less often but doing more work when it does trigger. + +Proactive compaction triggers when fragmentation score (lower is better) gets +larger than high watermark. Compaction stops when the score gets smaller or +equal to low watermark (or when no progress is being made). +The watermarks are calculated as follows: + +low_wmark = 100 - compaction_proactiveness; +high_wmark = low_wmark + compaction_proactiveness_leeway; + compact_unevictable_allowed =========================== diff --git a/mm/compaction.c b/mm/compaction.c index 29524242a16ef..fd546b797e544 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1921,6 +1921,7 @@ static int sysctl_compact_unevictable_allowed __read_mostly = CONFIG_COMPACT_UNE * background. It takes values in the range [0, 100]. */ static unsigned int __read_mostly sysctl_compaction_proactiveness = 20; +static unsigned int __read_mostly sysctl_compaction_proactiveness_leeway = 10; static int sysctl_extfrag_threshold = 500; static int __read_mostly sysctl_compact_memory; @@ -2254,7 +2255,7 @@ static unsigned int fragmentation_score_wmark(bool low) * close to 100 (maximum). */ wmark_low = 100U - sysctl_compaction_proactiveness; - return low ? wmark_low : min(wmark_low + 10, 100U); + return low ? wmark_low : min(wmark_low + sysctl_compaction_proactiveness_leeway, 100U); } static bool should_proactive_compact_node(pg_data_t *pgdat) @@ -3314,6 +3315,15 @@ static struct ctl_table vm_compaction[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE_HUNDRED, }, + { + .procname = "compaction_proactiveness_leeway", + .data = &sysctl_compaction_proactiveness_leeway, + .maxlen = sizeof(sysctl_compaction_proactiveness_leeway), + .mode = 0644, + .proc_handler = compaction_proactiveness_sysctl_handler, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE_HUNDRED, + }, { .procname = "extfrag_threshold", .data = &sysctl_extfrag_threshold,