From patchwork Tue Sep 12 17:52:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13381991 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 C54B2EE3F0B for ; Tue, 12 Sep 2023 17:53:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 906886B0140; Tue, 12 Sep 2023 13:52:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 867DA6B013F; Tue, 12 Sep 2023 13:52:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 730C36B0140; Tue, 12 Sep 2023 13:52:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5AC336B013E for ; Tue, 12 Sep 2023 13:52:57 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 27DA5C0310 for ; Tue, 12 Sep 2023 17:52:57 +0000 (UTC) X-FDA: 81228691194.09.8494375 Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) by imf15.hostedemail.com (Postfix) with ESMTP id 6E83FA0022 for ; Tue, 12 Sep 2023 17:52:54 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=neutral (imf15.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=1694541174; 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=7hiLlIvC4E6ZG09k10WszVkbuStDhbkQ3XWN2o6TQ4s=; b=Spgd7S/rtPswNSjjDXdqLp+4uz+HEnTrRHSTJxH6TTuu8dAUS5CGXDk8wkBlvegEipWsUr yfFrRmQX44M1qekYwPUk75eb25pRABj1AQh3czt/5STtbaSZVKBNrHXf2FtGxJbl940wsr h8bK7nzBeA5NcsIM2Xl8G32TAjDlac4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=neutral (imf15.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694541174; a=rsa-sha256; cv=none; b=yjA0Yjz51wTQ0OqYXpqvQzXUrXHQ8zmoacA3PS7W2ufv8hJLp0hxNbzICUwQOT2kvBJt4Y UgqLGc7WPh6ZHGrDNNwappEDl3lbpE9zBV2XTZ8POtOo/Um4b6JpxDeFQGDl5I/ka7LuTO 2lOuXQBpTt9zxj/trJvw9rR9POTNhpY= Received: by devbig1114.prn1.facebook.com (Postfix, from userid 425415) id 467C8BCD162E; Tue, 12 Sep 2023 10:52:39 -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 v1 3/4] mm/ksm: document smart scan mode Date: Tue, 12 Sep 2023 10:52:27 -0700 Message-Id: <20230912175228.952039-4-shr@devkernel.io> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230912175228.952039-1-shr@devkernel.io> References: <20230912175228.952039-1-shr@devkernel.io> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6E83FA0022 X-Rspam-User: X-Stat-Signature: tb367ka96scs6yg84jx7mm8ouepzib4j X-Rspamd-Server: rspam01 X-HE-Tag: 1694541174-247768 X-HE-Meta: U2FsdGVkX1/+JoSaf6V2583HiSys+Nf4g6drvEuAAUjbOjdxKXOlF243drn5+8Ebt66Mw9jQnb//YmZx9QWDJXukv5+0xp8lpGXEnUxDEgFyRWFBAbIYoJe5JT8YgPjNlk/faudQwQpsgLRPZGdcHduEDep0qn4Ul0818Ii1aTbsApQdaDXojfRs8tLcTKoUS3FAKD505gsiMcG/38lBPiMvjrbGjr/6HsR2clj8Onsab7sjPWNwBtvcGFKGoCPdd7e8nnVqWBIpwzzsJvSqj1kHYCebytp1IMmVnBvm/rfkGcnUkr4TsviSOJQrjVz/ALGOItFHkOlpoI5SsKM+NsYxNJG/1iMctAfH6XB2869ttd4inKgP5WiMzg0vsHf6xsLF81F7mgo9oDjv1SAdl1kE033MfQy8QU9ximomoBtGCqQOAcmGBrGavntIdm6kn96b3nqe3bNwwPuLI57m0CaskJ8P+j1ehvM4KOBzceIcc8vjN9OduD1fpw4k3pAQvG9+LZh3nz8KO1MJs/dcvHsVGJDWNRdRW4NeksFHk09uxF73RSYtKvDo8WBTYMrRQo3L/bjKQUquVG/Izj4K682Rw0M6ErdW2s8DDCDTwGD1EGvmsKWp5hHZiR5zmop1VtsxUMpuLamRR7MjReB+C3iAJ6VM2RFaixzaNl1pvlXqv5IkS4oyY2O0lz5CD4y36fAVNLjQGVEgr8sFlcVZynazRYmkLOMuGO1qgiqYubORB9TmoBwUssVbhJKXMvPruK8b1ldHvMlhLotToeuSymw/3nEkGqEbNdiGFPo3zRRT68lpUy/s4vTBPTOH0cdoN5mZZNtTQhlOcgJ5PNrIiMAx/gh9/GG7etcPRlXjBU63zeOkHlSRp3BA+5gBoUr2Cwx9zVmtqWs9mhF7WcxzhqfNbYOnqI7FP0YFCfFgE0e2EianhEIXN9q0LYbO33xrg4mvl266+w24fpVgMhS Z9lk7SHf cX6fB02trddoXBVE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, 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