From patchwork Mon Jan 27 21:46:25 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: 13951746 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 A5769C0218C for ; Mon, 27 Jan 2025 21:46:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2910428017A; Mon, 27 Jan 2025 16:46:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 240F528011F; Mon, 27 Jan 2025 16:46:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1089728017A; Mon, 27 Jan 2025 16:46:38 -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 E3F7B28011F for ; Mon, 27 Jan 2025 16:46:37 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 940841C7849 for ; Mon, 27 Jan 2025 21:46:37 +0000 (UTC) X-FDA: 83054566434.02.F679A65 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf24.hostedemail.com (Postfix) with ESMTP id D2539180002 for ; Mon, 27 Jan 2025 21:46:35 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=qUUXFgTP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3uv6XZwoKCFsF5E3IBGLDB9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--mclapinski.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3uv6XZwoKCFsF5E3IBGLDB9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--mclapinski.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738014396; a=rsa-sha256; cv=none; b=TBczs5pP1Awxq0aTnNyNE4abFVcdvXTKv4ZOxylDg9MBklEQvd8o2u163pLpUMmp0sooZB dDutmqfZ+1KNgZfppX4f+Rgcj+VE3Issx5x9GB3g37II7WlCV3T4CdHtuExFRqmeNmBl/i 6ffTC1WL18i7OL93Q0CTnk5are7OviM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=qUUXFgTP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3uv6XZwoKCFsF5E3IBGLDB9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--mclapinski.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3uv6XZwoKCFsF5E3IBGLDB9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--mclapinski.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738014396; 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: references:dkim-signature; bh=sy1JlawxVbQmxkhNYCv/CozJXbpDFTEaCjWdXQXq84E=; b=PsRrVqf+kViUdGCog9SV4mO2D2A7ObLScOuaV4hpjvOPUIoOHAuaIP2vwQsng7P5g4d0QO zqFvgCJ00SjiCZ8kXwF31qkz4qz8N2Wp0Ie+sJl681/C2/2KF1PzFnar+FbvKVF/2n2ygX 1a0IMpvm7oV2z4C/xkRECS1YrMSFTps= Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-5d3ce91c403so5333411a12.3 for ; Mon, 27 Jan 2025 13:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738014394; x=1738619194; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=sy1JlawxVbQmxkhNYCv/CozJXbpDFTEaCjWdXQXq84E=; b=qUUXFgTPpVB/BOHH0P8AwBCiILfUnK4CP8R5sec77HE54D1FEZ1J1sGnidEzflElK+ rANgrxN/qDv5s9rYvzQ93HOSR29bXmWA57ENKzF6NyCYxdwHF4gapztgOZaVvIJVNtaz 4SWr39nfWlh4KvD7JifvgCzqSmo0s75oc19Dwshy5/VSdDLn31GB3JIaIuh6IkbQweBD lpxSCEbRC9TZB1BR9y9OLm32bT3/YL+KH9CMwlOWwRGn/xp3AwBxXzS2bXHZi+QUapC8 ZckPxzggTFp/sxPq5S7px+VY4MHL0hPeJvfYNDZF5Ju2oouub9SOLa+xrD9SulpBPpPD RglQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738014394; x=1738619194; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=sy1JlawxVbQmxkhNYCv/CozJXbpDFTEaCjWdXQXq84E=; b=l2aibEdD1R8xXI+EiCFnj8hYDD++f8Q8VOrLf7p0Or/Eubi0kpzdb+owWAYk9KyAZE TMJhmGb1nrzqAyyVPei9nypkQ0SUC7SVc1HHUGtWotA/LPpkyugIVnLovNHjZG6EU+TM lPgjQBJo4jYAewYWUk+exCvx8x5HzknxLEXi4kbgVPv5cK1jSQXLIKlvAfoY/0KTwpqs DXyb7m3gr0KzLrO3+qRjqF7PdDowplmN/uHwu48MgeT4qP+GShBiQK4KymyB5HFzVLya ZCjum74e5IJz8uNaKPJgTWHTubG3JxAfISqOuGaimckP7tJ/cMfjWsT/78MTAYzVuHDA YEgw== X-Gm-Message-State: AOJu0YzMrVOvpe8/L04SPiLfQEvM0jdRntfO6u6IbQdpKstx49jisVOI 6eSJKTIc0vOr0g52DC7dIE6vDrEf1w4TaPwF5LAnXfyRp0XHkM10PU4aITFPFjuxq8d6Kzxnit+ TVd78di1D/5KhDQ+O6A== X-Google-Smtp-Source: AGHT+IGwM2B3nNZTOo1ItMReN6P5kqCT7ubnYCju8SAgZqsZuRxmAdKLeOGBzhYvzGmtPAgGsMNobRgy04+z+fqv X-Received: from edbev12.prod.google.com ([2002:a05:6402:540c:b0:5cf:c034:73b2]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:4413:b0:5d0:ea2a:726c with SMTP id 4fb4d7f45d1cf-5db7d2facf5mr33809378a12.8.1738014394456; Mon, 27 Jan 2025 13:46:34 -0800 (PST) Date: Mon, 27 Jan 2025 22:46:25 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127214627.4021412-1-mclapinski@google.com> Subject: [PATCH v2 0/2] mm/compaction: allow more aggressive 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-Queue-Id: D2539180002 X-Rspamd-Server: rspam10 X-Stat-Signature: tos7kc1taszz9b99cmjsd419tpj9x9i1 X-HE-Tag: 1738014395-531141 X-HE-Meta: U2FsdGVkX1/T6X/eRxtqR1wIRB7YpgxHd/s4iVkDwKESKAaYhkehgI4sw/gKwxFZRm/m5xklIhhClI8dZKSPOr+oqCPMpUfp0kumNA4pqr4J20mUqApqVHf/n6Ji/oa7qYCQ1OSC41PRbZvdljY60Al7X2eLAZRWcBuTXFZdd+gMvsZirBXkRrfo/+Xk1Xv3f9KilRtVoGlXCHmcfPU1V0VDF6Tg0JhH0fqHbAyLFFRU93febkh+cJSaf3SrlBdQ2YqgUJ2uY1W3n5ZLjf6qtZMw6DpzKuyYuBu0rmKUz6U4n7njCzVGuoLM2EpyUMQoWn/ftG2UtE7bmoyI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H7pAP8aIfKt9YylaICr+3R51Ol33aia/F0/+/LepyUW7cr4W2b7YwsKdmb6irgKsjpSml1nOsYORV1bEXKxx/8G4sdJx1ejR5n7c9ii3jDsxXRFAmzXuiWdMmwh2LGT3akqkrDsT36PhEKAP333Bc= 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: Our goal is to keep memory usage of a VM low on the host. For that reason, we use free page reporting which by default reports free pages of order 9 and larger to the host to be freed. The feature works well only if the memory in the guest is not fragmented below pages of order 9. Proactive compaction can be reused to achieve defragmentation after some parameter tweaking. When the fragmentation score (lower is better) gets larger than the high watermark, proactive compaction kicks in. Compaction stops when the score goes below the low watermark (or no progress is made and backoff kicks in). Let's define the difference between high and low watermarks as leeway. Before these changes, the minimum possible value for low watermark was 5 and the leeway was hardcoded to 10 (so minimum possible value for high watermark was 15). v2: Change commit msgs and document the new sysctl. Michal Clapinski (2): mm/compaction: remove low watermark cap for proactive compaction mm/compaction: make proactive compaction high watermark configurable via sysctl Documentation/admin-guide/sysctl/vm.rst | 17 +++++++++++++++++ mm/compaction.c | 14 ++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-)