From patchwork Mon Sep 18 18:58:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13390257 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 596DFCD13D2 for ; Mon, 18 Sep 2023 18:58:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B37006B0443; Mon, 18 Sep 2023 14:58:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE4826B0446; Mon, 18 Sep 2023 14:58:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 937626B0449; Mon, 18 Sep 2023 14:58:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7DC1D6B0446 for ; Mon, 18 Sep 2023 14:58:38 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 59F31120B46 for ; Mon, 18 Sep 2023 18:58:38 +0000 (UTC) X-FDA: 81250629516.03.D61F55F Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf06.hostedemail.com (Postfix) with ESMTP id B886D18000F for ; Mon, 18 Sep 2023 18:58:36 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; spf=neutral (imf06.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=1695063516; 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=p5nvpdKflSHlKNAzmLapJGZEtyZ3jDhwuiof3cVO6/msYxim2p7H1JiY3ELRAUH6JluUg3 rRdiWFsHo++63irXzemRog4FX3oAQsy4s4GAn36bWRQNu5y9FiAPa3yQy+lqJ4vLeo2wVC AWVVwLPA2xKpDJX8jZJ5BmEBVOoRMV4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=neutral (imf06.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695063516; a=rsa-sha256; cv=none; b=bcaBy94HZsicop+fvZoXwXY57iSPZRQeitvLSgt/We8YxLq6yEfmtauFCyNOAVhMCXAJVv RNGVpopwW7Ohpzauvw+nZrBIw4gWtTke6C7ki5Izf86mOYhwBJact+zD1qjd0IGmzBv2I9 Tm69LtlguY3pqzCW7l6bBNzQJTy7hIw= Received: by devbig1114.prn1.facebook.com (Postfix, from userid 425415) id 35309C25F82C; Mon, 18 Sep 2023 11:58:22 -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 v2 3/4] mm/ksm: document smart scan mode Date: Mon, 18 Sep 2023 11:58:15 -0700 Message-Id: <20230918185816.1518366-4-shr@devkernel.io> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230918185816.1518366-1-shr@devkernel.io> References: <20230918185816.1518366-1-shr@devkernel.io> MIME-Version: 1.0 X-Rspamd-Queue-Id: B886D18000F X-Rspam-User: X-Stat-Signature: oe61hrt3w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Qc8VB+uLy/iWCxZbAnKI8MA== 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