From patchwork Mon Jan 27 21:50:19 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: 13951752 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 CC5B8C02188 for ; Mon, 27 Jan 2025 21:50:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F5ED2801B4; Mon, 27 Jan 2025 16:50:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A634280163; Mon, 27 Jan 2025 16:50:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F76A2801B4; Mon, 27 Jan 2025 16:50:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F377F280163 for ; Mon, 27 Jan 2025 16:50:32 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A69CE1C7674 for ; Mon, 27 Jan 2025 21:50:32 +0000 (UTC) X-FDA: 83054576304.10.2FAC895 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) by imf20.hostedemail.com (Postfix) with ESMTP id DA7A51C0013 for ; Mon, 27 Jan 2025 21:50:30 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=dphPqxGX; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of 3pf-XZwoKCEgwmvkzsx2usqyyqvo.mywvsx47-wwu5kmu.y1q@flex--mclapinski.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3pf-XZwoKCEgwmvkzsx2usqyyqvo.mywvsx47-wwu5kmu.y1q@flex--mclapinski.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738014631; a=rsa-sha256; cv=none; b=2C8CLizXZY7ITuB9tXjbO1CmyhlY5Iw6Ze6zpnyd6e52ZWdHHGdnAujoquWMmJsborzrLC bvfillDUF1h17QxqKu7ygG5dQDKvkAj9/hG4pYsweEzn4cc7Ox5TviQl6V+mbU7+7qnWjd Mypyu4M7cEwlR5KQwN6k4Q/bOcH4YnU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=dphPqxGX; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of 3pf-XZwoKCEgwmvkzsx2usqyyqvo.mywvsx47-wwu5kmu.y1q@flex--mclapinski.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3pf-XZwoKCEgwmvkzsx2usqyyqvo.mywvsx47-wwu5kmu.y1q@flex--mclapinski.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738014631; 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=MTdaJMw+GE/ToWZXQwf98N8OcNSfcH4MlIjaDI1DCcU=; b=2JpcQAvpMS7n4YgOthPwrSHjz3N/y3Svm+FD0AOjCk+o6qb5xc1wlrA5FMj44f3H0+ldlD 6aqb6mw11wRxzOSNHaD6VefP21GmMiJuyOf8tu/7VqkaGnDA4bLeXq8Yaj4HsPD1dHYvIh gi4MGWx1sIDDtAVhuN6o1I2fgnSSfl0= Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-aa63b02c69cso516517866b.0 for ; Mon, 27 Jan 2025 13:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738014629; x=1738619429; 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=MTdaJMw+GE/ToWZXQwf98N8OcNSfcH4MlIjaDI1DCcU=; b=dphPqxGXq0is69aznkVk1c2vyn+VsfALZ9adX3hOEvaKNyUk/sattw3MBR2fl3skZh XwWUj3fa5pXUlxDJmkjtCyfPO8oe2Wz3kPXtXs2N0XoMS4c84Mx002Dws9HG0a8tqKBl qfpKMYIqsAiBMK24lVhXSwk2kZMWt9Fi3dxePNpoMKWNLFLeV4iRJi0eAQ/i6SZE3x9s K0YQvAbtlC6NPz24gWIzAastQU0vMxXPzRA1V+oTlAlYIoEJaZNbCmcmZqrxOV4AZs7p fs+YBybp6NjIBtds2GLZpBz/d/4sFE4A4K36+eP9D1pWfETtAVl0dDyAalnxYYoQvlXY iH5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738014629; x=1738619429; 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=MTdaJMw+GE/ToWZXQwf98N8OcNSfcH4MlIjaDI1DCcU=; b=GOe2Nx4XpSlY8tjYgjH+demlV5QRX2x9aGJnuFMgbJOe9wCB5/7XWe1l2c+1OF1YHF GwlYzgISyZBQuccczIQ3d3Rjrfin8b0axnDx6HiUzERqbeHpXExMOeyCcp2lfYI4YVlW p94hx8LNspTPw/vlShGv3tJ36qOxd9qJcUTmnXpXT1Foa+ss1cjv80qamDc6xQxrC12M wzmSNU7m7QlvNpwuengQ8QvoGnxeKoo8FdPlMfLfevXn+mn4/tAnwV4mU2C7F4lE4mRi amJxNfik3+C5JGrJm11jDCBm8mn83tSkPVHsAHWa37mPHb2CgOTqZkvJs51IUjXF0zF1 mCGg== X-Gm-Message-State: AOJu0YyzPY3k/zkgoLDCU076Cwu9TzrqrHXiJ5FWLyAfSYZ27OhvWz/l D3pC0Padu3idwaBVRj1kvU3lhkUx2ZWm+4kY0cWtV9XXJVWkbw+NGHpQVLI9YkQjrL+3giDgI/4 t8chxCaoDpNlwaFuIYA== X-Google-Smtp-Source: AGHT+IEZ97Jrd+XbhDMk2Rlpya1DB4YXBpa+0gMNH2ryXyYrsEg4Wyx9e7mEhh9FRPyIxeIP94pTyP8woXLmR7rg X-Received: from ejrv14.prod.google.com ([2002:a17:906:564e:b0:aa6:7b6b:b0c8]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a17:906:1e57:b0:ab3:a352:eb0f with SMTP id a640c23a62f3a-ab6bbb6be69mr81943166b.30.1738014629505; Mon, 27 Jan 2025 13:50:29 -0800 (PST) Date: Mon, 27 Jan 2025 22:50:19 +0100 In-Reply-To: <20250127215020.4023545-1-mclapinski@google.com> Mime-Version: 1.0 References: <20250127215020.4023545-1-mclapinski@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127215020.4023545-2-mclapinski@google.com> Subject: [PATCH v3 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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DA7A51C0013 X-Stat-Signature: h55o619z67it9wqkp4a8tbrzhqbd3yz3 X-Rspam-User: X-HE-Tag: 1738014630-784988 X-HE-Meta: U2FsdGVkX19WAx4UTh8MTLqTEGPkGbs1fDwnBRU1aT6eaee1fpC9v0qjgh/eRuLNHLcmDIY1VjVs8i6N5EO+7OWVfQACcs+oOoY8Q+bhkhChqS/Ki4NLwmqq0m4JR/CcmMLeXjwEuSoiG8RRgZL7alaJe1ILQ5AMUjVycPussvVRl9W5FjN9bNNvySKwfCaRDHi/uDhyKGQgJ7yaF8tFm1+SV4AEzQ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xnZ6N2Gy9qFipfemR5u4NcJaTKX0ChtBDbCFDbGCiB0Gm4I85vHvLZuWLySus/Wzw7NSW9tN7iDXya1XzXfSV+/PAEQJUvjuc9859kp/aepOi+va0sSn1JDQichrJO0JE8ZFisTQsjEMVJf5YdSbEYWSTNFtEaVD0H0ORsCUQ7jUD3sAq0hgUbe7/DGEJJKrF2f7PR3u0GKKrj2E/IacEylW/q+vte49io22TnzIJMT4mh3sWTfPHW31Mo1hr54y1ywQDOAkcn6lj5IOrKVrgb 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 --- 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:50:20 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: 13951753 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 234BBC0218C for ; Mon, 27 Jan 2025 21:50:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5F1A2801B5; Mon, 27 Jan 2025 16:50:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E650280163; Mon, 27 Jan 2025 16:50:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8AE5C2801B5; Mon, 27 Jan 2025 16:50:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 68038280163 for ; Mon, 27 Jan 2025 16:50:35 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DB815C03FD for ; Mon, 27 Jan 2025 21:50:34 +0000 (UTC) X-FDA: 83054576388.16.BFA4F39 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf21.hostedemail.com (Postfix) with ESMTP id 19A5C1C0002 for ; Mon, 27 Jan 2025 21:50:32 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="FNFpd1a/"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of 3p_-XZwoKCEoyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3p_-XZwoKCEoyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738014633; a=rsa-sha256; cv=none; b=GLmkTRbtGKYritCDSR9alcm707YigomDGPknR8W7DzBnVuzpek7WeJPtHoRqZh3nbwYUGA GHKUN3h3lLwn54sWHggQuuo27EodXV3opHeKgp1Je8ishNgel8x5tm8Et/A9xLSJfJuMzi vvODnf7l3taEYGDkJEPmbv5L0zs4wI4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="FNFpd1a/"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of 3p_-XZwoKCEoyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3p_-XZwoKCEoyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738014633; 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=L5Uvq/LtSk5V9Bp+Wn1p8p4zxiWha0dPng9zxfaQzuI=; b=a/A0AbqB1KPDMaFcnoBJhgdhmq2ynlwZu+5SifokaubnWPtkvrVlXi9f8XcUsXMqB/5d3/ skxu73vDKo7LLgDxUdANV18wp6R05TQiSIaiOsLpiFFvLpZz//rVkf6nwRarP7Kjcj/JXh rIoC5OIBEdNCMc+2PPa1vlKcyRajrI8= Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-5d3fe991854so5250159a12.0 for ; Mon, 27 Jan 2025 13:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738014632; x=1738619432; 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=L5Uvq/LtSk5V9Bp+Wn1p8p4zxiWha0dPng9zxfaQzuI=; b=FNFpd1a/dsLyDW4Uqn99/UeJLA5AzET+AnU20u+SH5U4RCbjamIKDIr9CszsZ9ag7x 3+Yx4HZJ3f/XMdRW870wYUyf9J3YIJBTB2j8U+iiZakHCPh9rt35oOOl42osgAAboO5s xGECkSFtqPKQsrJw/K3p5jSHW2mOnPGl6+o5FflqEtAHqxc9qFbYqZ5cWneTjJiPz9oN m70DijYoEqDOPiHt0xh82pcKxFLdlyB9bsqj4/bctIRfVcPA6IdfhbjnU8xbRuqK83cB X5wK/V98Q2gYRC9AKNbwCAR1by6j+oev4WMOBoLo8NBHnm7HxUMvxk+avgZeAzPHDMqG 0mkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738014632; x=1738619432; 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=L5Uvq/LtSk5V9Bp+Wn1p8p4zxiWha0dPng9zxfaQzuI=; b=LlpzipdSQvdUPQLnHNZJnaSVBSe9GyiLFe6TjV/1PymZEs0j29Z7HaxfytGSJtpeAW IlCoHKzo29crgTcLN6Qtldmw1IZzaPdYq/u0kWHYvPdpyZ85hlbQi3qPRo3c56RaWGQd ywzrijjkeNcliAu1dNNJH9pv+/VcBjk3zfswI+7k1E5bQavfoDUoYFRE7xkyJ9HFU9N+ s793g/YBpo+w6sP3jvvNPUkw59dPsk6KUQGy176mWJGvIk13rDs5DE+CDjcL8FC0W0Ew Cv6xtFm70JMNsUerEknHbsTo+uqkN1wq3F/6M45wNwjITc4ax3u2QemfYHP6A27ePIzG mOig== X-Gm-Message-State: AOJu0Yxyt86rlFjdkaRzdYFpNQuv2+9GFdiXAxQmZftxDMQ0NnM1wpOs uA9112+6tQSIuS6EAKO+Yfa+kfBxveGYfSMIP0jNRDqE3eX2lf9Kpv6gan1cqetJMbX/j1QNEJt edCGgcswA97UtVCxBFw== X-Google-Smtp-Source: AGHT+IF5MyGmzo6X6+ce58m37kliBMO5fYfLSX6/URh968H5U46tULENGEI65EXk+Tg837YFHhk3WYFX9gbmAolq X-Received: from edben21.prod.google.com ([2002:a05:6402:5295:b0:5d1:21a6:f033]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a50:cd02:0:b0:5db:ff5f:333 with SMTP id 4fb4d7f45d1cf-5dbff5f039cmr15071154a12.24.1738014631863; Mon, 27 Jan 2025 13:50:31 -0800 (PST) Date: Mon, 27 Jan 2025 22:50:20 +0100 In-Reply-To: <20250127215020.4023545-1-mclapinski@google.com> Mime-Version: 1.0 References: <20250127215020.4023545-1-mclapinski@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127215020.4023545-3-mclapinski@google.com> Subject: [PATCH v3 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-Server: rspam04 X-Rspamd-Queue-Id: 19A5C1C0002 X-Stat-Signature: w9npxqcxadjei54smwb4gxgdbawgb3ud X-Rspam-User: X-HE-Tag: 1738014632-623170 X-HE-Meta: U2FsdGVkX18UKLH23E8w3fCQLK7gl0t4F5eh8nIqSC8leaI1mXNxw8TzY9Elz1NtTtgaxEa4h+4QQTmkNODQK/a/TO1I0FwcFgeYns67rJbmEVSxbsB7T84tAYvXrl9ugLKWEa9DSvzuMmNUhkKkwV8qVU2UihZ9mP3cIMzVaC4u5gv14MG9w8cTSGfEssE1NzY4KCBvCvlQ19xpw2ltPl+K5IZ5XgHJs3kpV/+VusjbTEAb35K4moDhBeigZ+TgRNF3lQ86l+9sx4gF0mjlyyWz0BjVUAF28ZVf4uL96dfF2RPBKvrrg2z3cV9TJpxsoZ1U324F8W4MX6pQc8AJd0B9tlWGhc8jntRgpk7KEaEIg8acyVMY8gJWndeRPglzyYqauVPPE+HXbewU19an+Ov9cmjL4ugPJp3elsEnpr7+ICI45LOT7Gw6hg8vLobnNxrZBuJcqM0MR3vA8zbECif8L9GZD3vFhYbSn4Pro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O 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 --- 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,