From nobody Sat May 9 09:09:06 2026 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (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 172B221ADB7 for ; Fri, 24 Jan 2025 18:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737742911; cv=none; b=bG5gN9P1RcQUSZYrJInC/VSKu5d63vsALO4DYiDo1Ik4nb4kjYiKVPCXs4v35slF3eCNUVJ6Ovsjf1y5Q1Gjbu6dQuWCQ34TeF9zvmggTvfGHjN1ES5TW5l+te2t1oWM5MAs/dYgVDLQDtASbBCLD4C+11bLHbjRZ7mZm7bMeKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737742911; c=relaxed/simple; bh=2teDC77wBdkx/l9SEkD300ISryVWr/cnRxpiSxLEc2U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ayh9ZZySmiiUNZTopSS5JvWALrFQtUPu6k+BbNFLUEgP6Ix4jtyr4ydcW00J5NgHMQ0POp+pQGyGQABA/tJFui0Es2dW8vr+/0+tIAVrv3MEs/FShSMR4pYkSD45BXYsg+9ZyF+OCk367DTLEZosep3a6h0CX5LyLPTKPrYqrvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--mclapinski.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3e51fKR1; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--mclapinski.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3e51fKR1" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-5d3fe991854so3103184a12.0 for ; Fri, 24 Jan 2025 10:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737742908; x=1738347708; darn=vger.kernel.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=3e51fKR1S9GkS51OTK8ebLj3AssXyUABT8cH1QmAvI4RcyGrnPXNfpTlqJZVaZlgeH g1UNYWlbHKAg9i9YoM7fo4WdKW//5hlqVxndl2OfuFdZmDwrAu7mAzvCOJwd5dK/IiER 1KCjs3cdthLsXhmUCOwredBRwHcp/d8yLWY5dJuptz4Nu4uGbLAV6JNBFumFg4jFJ9dT V6HYOtgjXaiJ2RNv0FcJIVKPtQ/P/EL3Qri8SnVDsgzt5494FWocB9d+kyrKmyeXVpd8 JsYwQSQRm5mZ415/LWZ8x+n3dqY/6a9Mc+QnRlCbQCQRG33e6M4d/x/mHqC17Rm+1kFp nRxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742908; x=1738347708; 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=oOHaN/UE3adoKWKsybxeCN8wk9Z0Rj/gq/DCr1tbnQ/8eHfWRWFW2LDK0O8gSCYEno 8A0lVaFHWkrKCtE0hwUGdzNJaRqDWYFGYYRRGDHXrJlpbaQ3RRx8vmsIXzj27ZK4sAnM fft/fhhr1OBQxmKLkz0JQ+LveE0PFTJyWUjtzwQUkCqep7vOVUmnkrliRkKn0fVWj6Jr 3bDS+aSSM5Dw4UM8ywNvkhNQwqpZ/QOCI2sPfS0dnVA9IbHJ/AW5ChtysdaaYrOYkJMe 66JL2LHVwAgPp2Mtkh2aKp425mOesvIZcmpE8sxE9TRsebRpcO3HloaxRwnW7UNp3cqX 8zgw== X-Forwarded-Encrypted: i=1; AJvYcCV+0vTzl9iYu+2D8mjXtFUHhWsWiQUNn+d8UCFhzxNLuc17JU+QZG+pru8S1MHRIy5HxJHZIhvYWlcpsm0=@vger.kernel.org X-Gm-Message-State: AOJu0YwkDE0YsKN6qgXmL1HdlGQ0wVZPo8U1cz7CGEpTNZW8ju9JafNJ +xI1YGsCb5xhYaDAr3kbpZrs0aCr3x5ZcsVlUE5m1SyJTl85E3MrN+Ljxoq3fD9zA8ng5E8n9W5 ewtfv13kuBwWAyy48nw== X-Google-Smtp-Source: AGHT+IGlll3ZJRgeYACjNMmQxU9JVECoCUtaZdkmY0U4Nk6wmeTTDMDT8oLJGMhd1iCVoe1QMCnpb3RypI8fcHaV X-Received: from edbds6.prod.google.com ([2002:a05:6402:1cc6:b0:5d9:12d3:9537]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:358b:b0:5dc:21a9:d0f1 with SMTP id 4fb4d7f45d1cf-5dc21a9d13bmr896896a12.14.1737742908471; Fri, 24 Jan 2025 10:21:48 -0800 (PST) Date: Fri, 24 Jan 2025 19:21:39 +0100 In-Reply-To: <20250124182140.2243862-1-mclapinski@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-2-mclapinski@google.com> Subject: [PATCH 1/2] mm/compaction: remove low watermark cap 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Pasha Tatashin --- 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 lo= w) * activity in case a user sets the proactiveness tunable * close to 100 (maximum). */ - wmark_low =3D max(100U - sysctl_compaction_proactiveness, 5U); + wmark_low =3D 100U - sysctl_compaction_proactiveness; return low ? wmark_low : min(wmark_low + 10, 100U); } =20 --=20 2.48.1.262.g85cc9f2d1e-goog From nobody Sat May 9 09:09:06 2026 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) (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 2343821ADB7 for ; Fri, 24 Jan 2025 18:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737742916; cv=none; b=uj4cVMZdO43X2aKlQwQh1WaMiU7mFysfdFRh06QKZZyjz+KHU7bcczYgY6d6JRYRdsGfwJRRs25SsvJIMO6uTOtHfn4ci3loJmOWv0sUes9dnlQHfnGZcrB15V+iua7rNWbv83aYFYHPGFI7JizGbcSaua3xfFWdvkSrUBs1QC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737742916; c=relaxed/simple; bh=RTzmkiPZlEV0aLYEuzuKrPzOrubHmeEhd/mztUPOYAE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RBWI6hYZJapLBGcyZncl9IDAWXXwq7EAsIaexPmiWofn0icVs3wsixzpZv7dY4pLORVsoBeuvyoZDHPoGfM0UaaqpVCW2tQgsYrojbBw6cZBlt20LOx/2Isw2Uj/Rep/PVbDmZ66pknSC3tv8r+ddtdDcI5zT8voqCmeQpre/ng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--mclapinski.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tEkOgg1H; arc=none smtp.client-ip=209.85.218.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--mclapinski.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tEkOgg1H" Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-aaf8396f65fso232619766b.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=vger.kernel.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=tEkOgg1HhDlpPuL5rIdUmiXkrLhWLjH7qojjAm3nzzcqdLgYPjQc47P+reySefW05B Zr2Eqzi9m0mQhBJrZILSQROATLEhM/AyjJVikJzacHbm+E1ST2Mu7J19m7S8SNNGDPv7 sII4K+q+dnR3XlnutkSrBgxobHtKWDPo2obUqs2xzrsAYRGZdDveLWUi2w71TuhngFZS 6v8yXEdDOtC4awmFiMQcf/9Vm8Ash03sHkXHi8TEDOJGoGG9wPwKzA/yJQSHO30NWrLA XciYzDX4FvDV+2mqHpDpCLVAIowk0gXR+SdRIge9/EJEFdmj1aYMPtSXmP3+zJVgIx66 DCHg== 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=nOT53RIm1+km4g5kuVuleCx3RxShpVM9fmWXa+U6eLJYaqLaQjsuAjxwj1YVTOSlYC oE9uvrwzmfBkPBZdIf0G72E7XHXC5xnJsrE9eduOHyI8rf0tWUFDruv6LltFgGiSpilE RV9X09FDaVZt2Ql2JCSAyOkCyFYTFV7xvOKS8AgVzSNqC/oD5Xc1D8xtE6yAA27VGCIz MG91vNykAz7F9JyNMRkuohhzuHEVBW7PJLREqnSNR1Wrk2r2sNpJtNXhrmQ5HwEzT79h w40R5VKrgPaHVytKtGO/aed4eri3padDiO3X8JKJmMAxJKpc7QPBRjUlrLtq8s8gmWXB idRg== X-Forwarded-Encrypted: i=1; AJvYcCWIcN1eoxrfjZhg33l0h5PQbCz81fioMMvK2msBOd+35tEkyDzQNZ054UQX2khRfYs1xI4roPrfOL8jaeA=@vger.kernel.org X-Gm-Message-State: AOJu0YyAACOs5k8H8rQxgpBMHFYzVyZQOZR8RWgCwZCmxEdAxJF3lMa5 6yAgO85NN8ezqQZzjzSms789zqyePillgW+xyiPeEavOWttdhPhbMbzXozf5VEIMQ1zc9G2ENqe N9XaAbPGZ22S/cKFImQ== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D CONFIG_COMPACT_UNE * background. It takes values in the range [0, 100]. */ static unsigned int __read_mostly sysctl_compaction_proactiveness =3D 20; +static unsigned int __read_mostly sysctl_compaction_proactiveness_leeway = =3D 10; static int sysctl_extfrag_threshold =3D 500; static int __read_mostly sysctl_compact_memory; =20 @@ -2254,7 +2255,7 @@ static unsigned int fragmentation_score_wmark(bool lo= w) * close to 100 (maximum). */ wmark_low =3D 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); } =20 static bool should_proactive_compact_node(pg_data_t *pgdat) @@ -3314,6 +3315,15 @@ static struct ctl_table vm_compaction[] =3D { .extra1 =3D SYSCTL_ZERO, .extra2 =3D SYSCTL_ONE_HUNDRED, }, + { + .procname =3D "compaction_proactiveness_leeway", + .data =3D &sysctl_compaction_proactiveness_leeway, + .maxlen =3D sizeof(sysctl_compaction_proactiveness_leeway), + .mode =3D 0644, + .proc_handler =3D compaction_proactiveness_sysctl_handler, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE_HUNDRED, + }, { .procname =3D "extfrag_threshold", .data =3D &sysctl_extfrag_threshold, --=20 2.48.1.262.g85cc9f2d1e-goog