From patchwork Wed Sep 27 16:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13401340 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 EC5F6E82CAF for ; Wed, 27 Sep 2023 16:22:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C447F8D0099; Wed, 27 Sep 2023 12:22:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD0B98D009B; Wed, 27 Sep 2023 12:22:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A43B98D0099; Wed, 27 Sep 2023 12:22:48 -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 8FF8D8D0098 for ; Wed, 27 Sep 2023 12:22:48 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 67FE1A0204 for ; Wed, 27 Sep 2023 16:22:48 +0000 (UTC) X-FDA: 81282896016.22.6E641E9 Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) by imf21.hostedemail.com (Postfix) with ESMTP id C37A41C001B for ; Wed, 27 Sep 2023 16:22:45 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=neutral (imf21.hostedemail.com: 66.220.144.179 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=1695831765; 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=dj4Uw0ya+yBYIJV/MmafOuUQqTKYXOAk3384f1ynkjU=; b=i5bGMl4U4J4UWbgtcNKVrvLBxWYMqr/sMLBzEuVAgc8G4yq8JtjdN4eT+FJsWdSa5rwVzk +z3RAkPTtgbNdICz+ev4M40qeWVSg0HLguleUproSD4/CVQJm7l7PQbhskDjTpRvNtBbjY O3AjPwYvh4FqK/93pNHUI81kPBlQWJI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695831765; a=rsa-sha256; cv=none; b=EZ/5FNxf7H8TgZ4b0CVCrPc9TD/08Rwwr+Ax3oyJNNP4l4oeOK1fbmkRCSyqii0tX+qtXu cG/xqy+LoFfhGar3hqyDGr+Zw1+ih4oJuO6kUeCH7rMe+GiYh4PjEIOhrSguyYSaO8o5QX 9CZvPBl9MaNUMsOyCcVUjqw/nWn+x0Q= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=neutral (imf21.hostedemail.com: 66.220.144.179 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 5401DCA4DC14; Wed, 27 Sep 2023 09:22:32 -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 v4 3/4] mm/ksm: document smart scan mode Date: Wed, 27 Sep 2023 09:22:21 -0700 Message-Id: <20230927162222.3827551-4-shr@devkernel.io> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230927162222.3827551-1-shr@devkernel.io> References: <20230927162222.3827551-1-shr@devkernel.io> MIME-Version: 1.0 X-Stat-Signature: txmof5youu4mapybti8apt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64A6Vp8Xc64UDDamYDsdjWP9SZR5KhJA5m54DoLtj+6164= 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..2b38a8bb08af 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 + Historically KSM checked every candidate page for each scan. It did + 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 enabled. The ``pages_skipped`` metric shows how + effective the setting is. + The effectiveness of KSM and MADV_MERGEABLE is shown in ``/sys/kernel/mm/ksm/``: general_profit