From patchwork Mon Jan 27 21:50:18 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: 13951751 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 EB8FCC02188 for ; Mon, 27 Jan 2025 21:50:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83A552801B3; Mon, 27 Jan 2025 16:50:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EA5C280163; Mon, 27 Jan 2025 16:50:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B23F2801B3; Mon, 27 Jan 2025 16:50:30 -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 4DFA2280163 for ; Mon, 27 Jan 2025 16:50:30 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EF3461607D1 for ; Mon, 27 Jan 2025 21:50:29 +0000 (UTC) X-FDA: 83054576178.29.A570C19 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf02.hostedemail.com (Postfix) with ESMTP id 4248F8000D for ; Mon, 27 Jan 2025 21:50:28 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=qbkPmd1M; spf=pass (imf02.hostedemail.com: domain of 3ov-XZwoKCEUtjshwpuzrpnvvnsl.jvtspu14-ttr2hjr.vyn@flex--mclapinski.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3ov-XZwoKCEUtjshwpuzrpnvvnsl.jvtspu14-ttr2hjr.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=1738014628; 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=/+GwZcy6oea9sDXucrjwiRlD2OEpidzptTvEnfreSro=; b=HqlnaTjkbufOqutqcs/MOaqK7RgBRTu4OiVgE3nze+Tkd5asR/AnoFcwXuMMpjt9lTGrvI mXFRUuYFjcKqBJuIwHK+sqNSh1scXe/BAgymjie07vFowivPlZKs5VnNwxm1wNiT/hMfcD jxrl+KIVL2S4CgvxCNh79eRbR7s/bMQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738014628; a=rsa-sha256; cv=none; b=7COWFxruH7kh+acBLGUBUYnVfE+lxminXRrApVyXbT5bMInkOoJbhJOWI54HQcrXQJaLh0 EXUV7jniTQQm4sCVi/dlWkaFav15T6EEU55le7ETQ62eXzPZLOvajB8FNrU3cCM/MJlMSb ICb71/boEXJ7TTIzYL2c3kUjgYTuiCA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=qbkPmd1M; spf=pass (imf02.hostedemail.com: domain of 3ov-XZwoKCEUtjshwpuzrpnvvnsl.jvtspu14-ttr2hjr.vyn@flex--mclapinski.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3ov-XZwoKCEUtjshwpuzrpnvvnsl.jvtspu14-ttr2hjr.vyn@flex--mclapinski.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-5d3d9d6293fso4594611a12.0 for ; Mon, 27 Jan 2025 13:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738014627; x=1738619427; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=/+GwZcy6oea9sDXucrjwiRlD2OEpidzptTvEnfreSro=; b=qbkPmd1MEcimQPPJ4b1hBvFszvePo/qYjPXIopqPstA2d9X3YzyLzlRrhKupK5AZLE E5mqLNYHnAVXsEe3LABlJyK7+4uUWyuSefWP5buIhAH4Ef8AjId+sYvtAiiTAGgHm/OZ Nem8dIpxPyA/wnhObS1wdLsbNAJIauwQbbL2xhUhFq2WCxUHcni7vsIODNIlr4JIC8+l 0C3J+0HVzeIHuEXjCnaOX7wIs0v9kpSVUXzwX7yy4UgNPWaqtZsI5EgEe82h5eLxYxyi lmc4jkl2oKMMI2Zch8Ajv1lNHTfZRX0FxNl/8aozwNeU0UQeIB/ZFBzJ2lbaJle9HU7h Kq/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738014627; x=1738619427; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/+GwZcy6oea9sDXucrjwiRlD2OEpidzptTvEnfreSro=; b=fkszO5sv7B9PMOzYC/iABcBFv8ts4zXz8AIroJfOSAbCWpgp1LtP8tQCY7OPZDwmKl j96SpnOU/HHt2pen3Dn9Rx+8v40Nbwv4D7vWCIFawViSQkGBBdwOpdQwl8oiGwU2NJpi 8tEEGd9RnBtJHrHJ0jy5PfbC+NptDh3oGWTSj+sIu2l5szzluDCzBVEyxhHNcGmBEahi 1kCxdMiMh0bG8YjY8UeZ1Ykh8iSkJ3o6dSYSfBIAXE6cn5abGhh+t6zXQqaUxQBok534 2oVV1yqbBm4YwzovCEsI4H5zO6uXDuCpwN38vwPua5Fu/MmU5nulgTBQCngFZEYH9eRt 1ycw== X-Gm-Message-State: AOJu0Yz/OqU20MYUSITKMAfI7ZQ8Mrm3asuxvWH4O5uIT9uL/pPObCQa vEUC7edv6A+XTESVJXIxjiEnPTsGbYuVeMPuO+SdPowAAl36Ip5kFSYs4wrNs/8X01FdPZwJ2dv UyKLfmqAX4k3qlAt44g== X-Google-Smtp-Source: AGHT+IE7oZO+AY06HPrt6u9q0BfA11TSbQbCT41gIOOlH62klA26q+U/uRgcfbTsi/aTw3yJ5/K2tyWi9xLlu2PM X-Received: from edad25.prod.google.com ([2002:a05:6402:4019:b0:5d2:1b7e:45a4]) (user=mclapinski job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:5110:b0:5d8:211a:4d59 with SMTP id 4fb4d7f45d1cf-5db7d318ee8mr40341298a12.19.1738014626986; Mon, 27 Jan 2025 13:50:26 -0800 (PST) Date: Mon, 27 Jan 2025 22:50:18 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127215020.4023545-1-mclapinski@google.com> Subject: [PATCH v3 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-Rspamd-Queue-Id: 4248F8000D X-Stat-Signature: 4udgiuoh7kdae6swqh89x871ptp1gqby X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1738014628-794768 X-HE-Meta: U2FsdGVkX19gjE/AQQ92fAuulN76JYeeqbBN4zjMZfR7k2nlJvHlbl74/t5X1jf+JC6K2Q1hanvP92yuh8BmSctPdKr9kf0ddukyz9+gxi2YPlvqZjKNbjfA3GRxGfhkVkon06EJSimbaw0SG2OT0fP+XOQqU5S+s8fOglgnCXPtXz+EcHHvd2Vkdl1XjWLdwvq0GZGq3V2TwZ0uZ4JA1FyOmHzBRyJqzF6sQjmntD9I5iYCwRLpi3YPndUlV7mM5ZpYZQ7KlV0rbEYPOSPocj85826hJ532/mZgctkF0O+UWsiOMr7pA9aHwm8m3UFbYbWSieRXYUc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ehiOpzlnd27xmFfAeUWXXbzJFZUQhcmxNdBtiu2u3wUZmtihTjbF25jB2KodTv6KOiuZ9IGHhppnU7WG03pP9YQYDtnlWn9fjXAKiGKtYeBvFf8aH6Ikr6ZhMIHIB28NPqx86l/Y9yqUQtYDX4UzRUTStqSOvh8K12Bq86c4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000445, 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). v3: Remove gerrit ids from commit msgs. 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(-)