Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2686621rdh; Wed, 27 Sep 2023 09:37:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyOiUmjSc3ZF3OV8rk2DWlV1QNxuKPVVVD+Y/M8pYkyU+bZLdTW86rpVTTI+uqpiCWinQA X-Received: by 2002:a05:6358:e49a:b0:143:7fc3:324f with SMTP id by26-20020a056358e49a00b001437fc3324fmr3392163rwb.5.1695832651238; Wed, 27 Sep 2023 09:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695832651; cv=none; d=google.com; s=arc-20160816; b=dynQKfv5kqpIqdbcRFizs3tWa+JzguZp+GYAANoT2Tklqn1MLqhgW8lx5nM2zetC/G sOA8Ri9uuX4d9cH8LyFlJU6owk8k4ZaouRh8EVcDL8wACUSLX7wJDonowyZkFayg5fhg b5oWIC1jmvEOEDqDYhG/YaAzXfiepALXxbGSz8V/u2vCoQEEoIE00wZP97CyXk0MCMR5 vhmJFDFMjMVwa+kvVBXaYcVXkg2lRDCa2/EARtfDXLGOebPCbzUF4QTG8reFuYslD9+c GLuHmmpv8SKnnmkugu0yhYbOSCwA4xc5tigpdoblkMcppEmGbIPbnL3CLeea1j+8pyTQ EsSQ== 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=dj4Uw0ya+yBYIJV/MmafOuUQqTKYXOAk3384f1ynkjU=; fh=sS+J4OyOC0EcVLWJpS3mBHGeO+0+dYZJ+ImCUfzsrH4=; b=pY50RdsueuSY2KEgVLIxZzeRaESL2Oq1jivGdlycAEnrthReB1YkeG1/PTZzm2tceL WFb1HWFUujJ79YMN6cPjZj/UE/sE5G1VuqC4USVswsiiJLUYn9kcJaae9R5HlnglxIis EJz5BohuNLKUo605d0DXubN5W2ii2Qx69+mhq9Dt3ooshhHcflTDjgW6PsN0oiqJ7R7H 72s0b2wqoopAUXXqOhDZiYFnMTbdIIX0Fz1YUvFDgk9GKCseN6svYy3pCxMIqMwieOFA fgRGMbVzwPr7u47bnv5FJF0kz6lpSJJHTuP1uXKqJ+wxi4qZDXClTKoPPk/BOiBUWl13 nbUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z66-20020a633345000000b00573f9d84ecbsi5373415pgz.387.2023.09.27.09.37.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 09:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 3B48D804C1BA; Wed, 27 Sep 2023 09:23:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231657AbjI0QWy (ORCPT + 99 others); Wed, 27 Sep 2023 12:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231463AbjI0QWr (ORCPT ); Wed, 27 Sep 2023 12:22:47 -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 6C1229C for ; Wed, 27 Sep 2023 09:22:46 -0700 (PDT) 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 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 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 09:23:09 -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..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. =20 +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 thi= s + 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/``: =20 general_profit --=20 2.39.3