Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp200213rdb; Mon, 18 Sep 2023 12:13:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvcZPL3Q/zY/5vN6EwRO1QyPizptZcrqdPtAWe2gCi9O1aXTQ+4Emc8/EopTJ9ynlOZcdx X-Received: by 2002:a05:6a20:104c:b0:154:3f13:1bb7 with SMTP id gt12-20020a056a20104c00b001543f131bb7mr10781592pzc.49.1695064401821; Mon, 18 Sep 2023 12:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695064401; cv=none; d=google.com; s=arc-20160816; b=px7T+uHyrzHynZr8CFOxiuHLWLaXC9V51o1wNEQsnrqop3dBe369Pl2gsH6JnAaqd1 barolMFs+U+UWmmlPiTZcgoJoylKwZMaopBZNOUXPgtuWQS6QK+6Mvrjqtr/R/aK7NrI rG3MYhq3KEzWiLnebaWeq4+VW+4L9+wnks3dBTJNTYMfpW55adhOda+aoj4PczckeLGt 6jM58KnyJ2i8O6XSfAiuVGoc6tjlWEpgEP6BH/BXRt1nH6M8piVX0tl/8BtDSsKc97Dj jM1gBf9ubFxomSL4FoZ7r7dJjGtLrXSQyndefr2+BpWw4+pQVL89yFaHkFyZ3J03QaYj 6hcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nRm5bKQCajx84URLpQRvcjK4/PXHSs3c43bjhVyrNbg=; fh=sS+J4OyOC0EcVLWJpS3mBHGeO+0+dYZJ+ImCUfzsrH4=; b=TcPdR6IHGzEOm24WtMvu8B1GuAdZuqYUDNa1WTEAsKN6LBmb1HYhfI0l9MdoqMuoaF iFpjc8ujWukJhod3ZoAWrZoYQsUAorq1aSYSLEGBzShVVWBZdUx7TnnzX2WU5wjzEMWG a7jNe9iJdQY3KrP8rmdZ9k2Qt17UgztOZo0vvfYyh35Z82n+3/lVXEk0Bqb6SaTtM9BM PxXiNBZ4WxrN0mpc3P+tkIZOapyUJtOwMfHAsRHpNkzY1fa2V0zefJ7sHJp+uAiyenVX GGPnVpxbTMmDaZFzS/O7pwC/3flDyAnGEMD3rPdRIMhBJ57zn6CKfamPgFxWaVN3leLn /BnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z185-20020a6333c2000000b00577dd005706si7904750pgz.779.2023.09.18.12.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 12:13:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 402B2804916C; Mon, 18 Sep 2023 11:58:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjIRS6u (ORCPT + 99 others); Mon, 18 Sep 2023 14:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbjIRS6n (ORCPT ); Mon, 18 Sep 2023 14:58:43 -0400 Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E33D11F for ; Mon, 18 Sep 2023 11:58:37 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RDNS_DYNAMIC,SPF_HELO_PASS,SPF_NEUTRAL, TVD_RCVD_IP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 11:58:53 -0700 (PDT) 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-g= uide/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. =20 +smart_scan + By default KSM checks every candidate page for each scan. It doe= s + 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 thi= s + 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/``: =20 general_profit --=20 2.39.3