From patchwork Fri Jan 24 18:21:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Clapinski X-Patchwork-Id: 13949818 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 BF5F3C0218B for ; Fri, 24 Jan 2025 18:21:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21A1628008C; Fri, 24 Jan 2025 13:21:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CB45280079; Fri, 24 Jan 2025 13:21:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06B7C28008C; Fri, 24 Jan 2025 13:21:56 -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 D8E5C280079 for ; Fri, 24 Jan 2025 13:21:56 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8DB77141342 for ; Fri, 24 Jan 2025 18:21:56 +0000 (UTC) X-FDA: 83043164232.18.1E55915 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) by imf08.hostedemail.com (Postfix) with ESMTP id C67D216001E for ; Fri, 24 Jan 2025 18:21:54 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=SmMNSBwt; spf=pass (imf08.hostedemail.com: domain of 3QdqTZwoKCIgyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com designates 209.85.218.74 as permitted sender) smtp.mailfrom=3QdqTZwoKCIgyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@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=1737742914; 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=EmZHaJDsiucuS2I5hmcRew1BX+PLLWZVwz1UvaTDX14=; b=DhH0aTuHadx16+X2iaFjEILqVRggeaVWG4ZZF9dQK1LcOoUE2HE7+UlGV6bFjEo7jbjhZg rqClJkbkabA3+JrXGNNVY/zkqvxwJvVURqVqVk5mtQTWceGR4NpRc6jGUHsQipc+oWfi7j yzGaVORZidWOYx6YuXbxa9cQAkScfKM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737742914; a=rsa-sha256; cv=none; b=ieVNlpOeTiYqrc6XXK0h3FNCYnDx4qmGmF36may7qSZd5cTu4PTS+KtS7+T+mbKt9D32re e6im0gLGx5TJ/i+vnmToWOsFv6Mtn1afHPs4fQE1IJdqwCVmUEIz52qfVNGM8ptu4CP8sr 15Ob6DdqeWyWfOC7juTLPzUECL4EOak= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=SmMNSBwt; spf=pass (imf08.hostedemail.com: domain of 3QdqTZwoKCIgyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com designates 209.85.218.74 as permitted sender) smtp.mailfrom=3QdqTZwoKCIgyoxm1uz4wus00sxq.o0yxuz69-yyw7mow.03s@flex--mclapinski.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-aaf8396f65fso232619866b.0 for ; Fri, 24 Jan 2025 10:21:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737742913; x=1738347713; 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=EmZHaJDsiucuS2I5hmcRew1BX+PLLWZVwz1UvaTDX14=; b=SmMNSBwtFgzTkVlKIlK7jzbnu/xElxrdK82BESTdJ2luHRF7hGca3W25kH2mw0Oze8 uG1yv2Is0OfXg2IkCRQi+bKM/BLNRl2Hx+fVnGdgKhq2BNAN65NgFjzwqppTuUvKgkA8 kG2cA3UlhFdRTEaBAUBAaVceqomNyNWG1WjdJRl2kOU7C+2Z3BHWbLAtl1v0jb5q0Dj3 wsyf1XXAd127Ln10S9hXca22eyzD1fcs93WMVPvCxfEh/dnsJwTIwFOTZoeRedGSd6AQ TMahmmuo0wu/t6JAQg8+Bey+ybx1b8cYjH0R/kJUXGG6OwW2PUoOhA4G66HcxJ+veYlw Bw0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742913; x=1738347713; 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=EmZHaJDsiucuS2I5hmcRew1BX+PLLWZVwz1UvaTDX14=; b=bF1Szx6hzzWthbiEEkTKGSdBHKCt7GvtUux2/Pf1AwzPC1HpU6Y+g/BVRX8pTFF4VP MIGeoio7IY9qay+/T0Pg9GeuKmfLKvTGHk+OauoP3OiXFqVaoWT+RZdk7bwh/onQtkgY msdaABKZUZPTsdPAH6CRUr6vIJjXOaZSkW4NEJcNhmxUQFjw/QFLiZhgQ4G87SfjfNml EbDm1eapf1B08Zzq76BrLaCIBatLvEt6WDHGddKEzmLgPF20CJ2VxBmqrmcrILg4BFFc 6+Tf/rAp4i8eJzmzuf3KrAGK2kdnChXEoeGgmyH/PGHfZ2rkho2sVX/SBQMODT7q7lAF vfAw== X-Gm-Message-State: AOJu0YxZ8SDSsB5ibJ9I1cy5K1d90slCD9ChJqU9pJTFK9wXgGbEubIQ h6TjaYORZiVvQvK9OZWLoTstFTnYws8JvSJvVkLTE0xYal7kFJhbhh43uqzo1RPOe4ZRImOo50E g8wrH0/dhYF2P328lNA== X-Google-Smtp-Source: AGHT+IFo+R1qJYiam+4Ip+3MGO+gEoGw7GKy/IdyI5u6KlHyx48ROGLESvd8X9UAOjzkINMvfA5EEUZ7Y5bodrXi X-Received: from ejux6.prod.google.com ([2002:a17:906:4a86:b0:aab:957f:1a30]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:2da3:b0:aa6:85d0:1492 with SMTP id a640c23a62f3a-ab38b378c99mr3048449866b.37.1737742913550; Fri, 24 Jan 2025 10:21:53 -0800 (PST) Date: Fri, 24 Jan 2025 19:21:40 +0100 In-Reply-To: <20250124182140.2243862-1-mclapinski@google.com> Mime-Version: 1.0 References: <20250124182140.2243862-1-mclapinski@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250124182140.2243862-3-mclapinski@google.com> Subject: [PATCH 2/2] mm/compaction: expose a new param for proactive compaction From: Michal Clapinski To: Andrew Morton , Nitin Gupta , Pasha Tatashin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Clapinski X-Stat-Signature: jrdsy9cesgdd9ou38bzw47uneco7c9id X-Rspam-User: X-Rspamd-Queue-Id: C67D216001E X-Rspamd-Server: rspam03 X-HE-Tag: 1737742914-295142 X-HE-Meta: U2FsdGVkX1/KrTql8ZgSIvn7ZBeAYobPzApqB7JhRFpdxsh9nv2ltVlQVBJEkNNMgyZhjklz1fgaXW/NP+cqYa/zS2PkZNBblK0TON9xmAUTQRtzeXG39CZGbc3VFHhm9dq4hnMgCK9YDG2I7DwVUQBtKC9xeM8ubkZHX5tEzJtrfDD+c6IHYeOTY9dpSoO+4FdscBBGWiVwj2Gjm/uQoRldCFPH4duRFdeSGjBvcq88nKKPHGx3iaXuhJwgh5vyQl0n0PLsTqSuTx04f2GRPx5JiTk96X4gll3atdX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TvmmPE5QBMp1gw6SvJuybc9J3oXDDv2Ki8x9WgCdnfh4RQFo6WCprWvAVQOlRwD4QsJrsFiRRz5sGc8olD1SWjR6utKpScXNuoD5R2eBf7JFxqTc6n8F6IlDsJ/b/K/CUMlMglO9Fo/yZOEwsGyMZPcvKqZuYRsvS337YejVmOakqfegR2UDkCjqYhGvex+ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Expose the diff between low and high watermark as a sysctl var. Signed-off-by: Michal Clapinski --- mm/compaction.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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,