From patchwork Tue Sep 26 04:09:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13398638 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 72F4FCE7A8E for ; Tue, 26 Sep 2023 04:10:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFC8B6B018E; Tue, 26 Sep 2023 00:10:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAC706B018F; Tue, 26 Sep 2023 00:10:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9B816B0190; Tue, 26 Sep 2023 00:10:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BAABB6B018E for ; Tue, 26 Sep 2023 00:10:31 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8FD3E1CAB29 for ; Tue, 26 Sep 2023 04:10:31 +0000 (UTC) X-FDA: 81277421862.28.76913BF Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf25.hostedemail.com (Postfix) with ESMTP id 08955A000E for ; Tue, 26 Sep 2023 04:10:29 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=neutral (imf25.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695701430; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nRm5bKQCajx84URLpQRvcjK4/PXHSs3c43bjhVyrNbg=; b=X3dzosJgS7egcXWItdvWCbqiSGoQmhxUgdYkJgA09v0DBGgCxIu6FXn4u8YM9Olvv1tR6M mszWzADKL3aKHlZeYTGO2wjVWn/hs1zc2lVaJOV49phZ9cLqT8T44P/SxtVfbb7lXOx8B7 mE3Nt9lm6NeRggldGChlE6x85/WVK9A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695701430; a=rsa-sha256; cv=none; b=kHaF0aBFjWr9s9vWesks4c9mbt+Ljtap6HtcCE0G0AL1fweVj37GWLENv6VnZ62DMO5URg 6kyDt13xw1FW1+dkp1m4O3k8zvKC8/ZagHhJnv1OTFhr+Eo3aH4Cw5RAIMA23VDOgp/K7Y MYAHAPNiJFHDFztltiYLtN0qrABibas= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=neutral (imf25.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none Received: by devbig1114.prn1.facebook.com (Postfix, from userid 425415) id C9CEAC8F245B; Mon, 25 Sep 2023 21:09:46 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com Cc: shr@devkernel.io, akpm@linux-foundation.org, david@redhat.com, hannes@cmpxchg.org, riel@surriel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 3/4] mm/ksm: document smart scan mode Date: Mon, 25 Sep 2023 21:09:38 -0700 Message-Id: <20230926040939.516161-4-shr@devkernel.io> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230926040939.516161-1-shr@devkernel.io> References: <20230926040939.516161-1-shr@devkernel.io> MIME-Version: 1.0 X-Stat-Signature: iamdrjkhkfyuwy6oud66w5ipz44nhxn1 X-R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7ZRlgCQrpjAH0S1rWTCUYAUVubDOFmpiPnqaLAR4rZuuWZ9lL2Q== 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: This adds documentation for the smart scan mode of KSM. Signed-off-by: Stefan Roesch Reviewed-by: David Hildenbrand --- Documentation/admin-guide/mm/ksm.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst index 776f244bdae4..1762219baf51 100644 --- a/Documentation/admin-guide/mm/ksm.rst +++ b/Documentation/admin-guide/mm/ksm.rst @@ -155,6 +155,15 @@ stable_node_chains_prune_millisecs scan. It's a noop if not a single KSM page hit the ``max_page_sharing`` yet. +smart_scan + By default KSM checks every candidate page for each scan. It does + not take into account historic information. When smart scan is + enabled, pages that have previously not been de-duplicated get + skipped. How often these pages are skipped depends on how often + de-duplication has already been tried and failed. By default this + optimization is disabled. The ``pages_skipped`` metric shows how + effetive the setting is. + The effectiveness of KSM and MADV_MERGEABLE is shown in ``/sys/kernel/mm/ksm/``: general_profit