From patchwork Wed Aug 24 04:01:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12952896 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 94CC4C00140 for ; Wed, 24 Aug 2022 04:02:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1326F94000A; Wed, 24 Aug 2022 00:02:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E1B0940008; Wed, 24 Aug 2022 00:02:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9B2994000A; Wed, 24 Aug 2022 00:02:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DAD05940008 for ; Wed, 24 Aug 2022 00:02:00 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C2A91140361 for ; Wed, 24 Aug 2022 04:02:00 +0000 (UTC) X-FDA: 79833138000.16.DD552A1 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf11.hostedemail.com (Postfix) with ESMTP id 663C54000E for ; Wed, 24 Aug 2022 04:02:00 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id s3-20020a17090a2f0300b001facfc6fdbcso309835pjd.1 for ; Tue, 23 Aug 2022 21:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=6rqGt2HECmyWVySSRPmsVLXpDMjQHW89zdrF6Uaa9Go=; b=qNI+Wccmbs61DxivbeWnR1PjHf3zguDNC7LtoV1kGJKl47X802NludrCcVmEhX8ln+ 1wQu8kbrw0IgIxqNey60vBcraFpHVA33aVXBBGKss9e+zrYSIGS1tetTQkEbAwVHaQIt 60veos1D8ou+tXlqwuRvWlx6/+L4xRn3vza4MstspX3coyHvXDna3c6oDG353Uuzzgxo OiLlCXqw65P9wJsN8nhiPee09D8dAa1Rh2mGkwlchVdQR2UdcvNn1hM+A4Fzoc/NXbPj tgpufNqW2dOjTgaE6SX5ujQZmOXBm4EhaotnPf/uw5cljbCKhqZi39GfSBeyDF4R/8Z7 NB1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=6rqGt2HECmyWVySSRPmsVLXpDMjQHW89zdrF6Uaa9Go=; b=wXSveAFTxkppC6LxLPR7oAmWmvGaDU1O90mgIYudqa1npNQbhjre6h6d3TEkIsF0OD SSmOiQbrwmjDifAJHf0XEtqzTCZtmVIE80bsd0QDBRLDXCMAPLRBrN8GMpCPms+eO3KI J23Zvj32PYGxvOZsFRUukpC35LWfxYgMnwH0k8JNCTEFsoGScAuiFt2Q9Umnk3ym/MoJ p/dtDt2OlXVUYFLEkN9fXR4u4ucLOikg3z+vgpmZb460pxyNKBLsrxYmq4B2ZrJo8QXc nz0frOhKdunt3c3OoABRqhTRU+d5WbxWWJ+0NziPrwmndksSqVgCKVB18/Od3/ToVZjF vzRg== X-Gm-Message-State: ACgBeo2SNtUOyfQLy+h7pj4aIklDlrn6cdO/jk2tR03W8Do6xyaCFP6v C+ZrmMGiUwXABxvhYt9wr5M= X-Google-Smtp-Source: AA6agR6dILThb7G09ug65nK1BovcekJnf2vbw8kik1d+rkwqW/XM/BP71zTpQFYe0ePfp9Lz/oqoKA== X-Received: by 2002:a17:902:bd08:b0:16e:e00c:dd48 with SMTP id p8-20020a170902bd0800b0016ee00cdd48mr27294120pls.93.1661313719363; Tue, 23 Aug 2022 21:01:59 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id bk2-20020a056a02028200b0041c0c9c0072sm9925880pgb.64.2022.08.23.21.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 21:01:59 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: akpm@linux-foundation.org Cc: adobriyan@gmail.com, willy@infradead.org, hughd@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, xu xin , Xiaokai Ran , Yang Yang , CGEL ZTE Subject: [PATCH v2 1/2] ksm: count allocated ksm rmap_items for each process Date: Wed, 24 Aug 2022 04:01:53 +0000 Message-Id: <20220824040153.215059-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824040036.215002-1-xu.xin16@zte.com.cn> References: <20220824040036.215002-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661313720; 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:dkim-signature; bh=6rqGt2HECmyWVySSRPmsVLXpDMjQHW89zdrF6Uaa9Go=; b=O/R6N79aMrDeL2tYNwD2rLykr8F2ssMiFULpLjvrUo5tfo7mucXsf6UrVCLbByoheeVFLR 9q9DOErn0FFzwKj6ef9kjqZmqL/E5R9o04DHeQS2vvL320EP8eF+idZDG8SrxeNV+LJPk8 ucGSSsn3GjUnb7XLJtkipgeZbsHYqSs= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qNI+Wccm; spf=pass (imf11.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661313720; a=rsa-sha256; cv=none; b=iUqB8A28uXGtJ97vxardqo1lwbDZhleQVhBNce9nOwOs32ShTZszAshboIK2aXBU/QS6BH EXcDVJibFxPR9ViH9ep7VdrfeLCid0WqAdIDOPRiKqv9QD/VKUGXx8w1tVpdjlAgc4XAUH Od8ThS+/3Kp9SM2eCSR/+XagU67b68Q= X-Stat-Signature: 5spmpoo33f9boq63bankqot4cmikbgig X-Rspamd-Queue-Id: 663C54000E X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qNI+Wccm; spf=pass (imf11.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-HE-Tag: 1661313720-558053 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: KSM can save memory by merging identical pages, but also can consume additional memory, because it needs to generate rmap_items to save each scanned page's brief rmap information. Some of these pages may be merged, but some may not be abled to be merged after being checked several times, which are unprofitable memory consumed. The information about whether KSM save memory or consume memory in system-wide range can be determined by the comprehensive calculation of pages_sharing, pages_shared, pages_unshared and pages_volatile. A simple approximate calculation: profit =~ pages_sharing * sizeof(page) - (all_rmap_items) * sizeof(rmap_item); where all_rmap_items equals to the sum of pages_sharing, pages_shared, pages_unshared and pages_volatile. But we cannot calculate this kind of ksm profit inner single-process wide because the information of ksm rmap_item's number of a process is lacked. For user applications, if this kind of information could be obtained, it helps upper users know how beneficial the ksm-policy (like madvise) they are using brings, and then optimize their app code. For example, one application madvise 1000 pages as MERGEABLE, while only a few pages are really merged, then it's not cost-efficient. So we add a new interface /proc//ksm_rmp_items for each process to indicate the total allocated ksm rmap_items of this process. Similarly, we can calculate the ksm profit approximately for a single-process by: profit =~ ksm_merging_pages * sizeof(page) - ksm_rmp_items * sizeof(rmap_item); where ksm_merging_pages and ksm_rmp_items are both under /proc//. Signed-off-by: xu xin Reviewed-by: Xiaokai Ran Reviewed-by: Yang Yang Signed-off-by: CGEL ZTE --- fs/proc/base.c | 15 +++++++++++++++ include/linux/mm_types.h | 5 +++++ mm/ksm.c | 2 ++ 3 files changed, 22 insertions(+) diff --git a/fs/proc/base.c b/fs/proc/base.c index 93f7e3d971e4..b6317981492a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3196,6 +3196,19 @@ static int proc_pid_ksm_merging_pages(struct seq_file *m, struct pid_namespace * return 0; } +static int proc_pid_ksm_rmp_items(struct seq_file *m, struct pid_namespace *ns, + struct pid *pid, struct task_struct *task) +{ + struct mm_struct *mm; + + mm = get_task_mm(task); + if (mm) { + seq_printf(m, "%lu\n", mm->ksm_rmp_items); + mmput(mm); + } + + return 0; +} #endif /* CONFIG_KSM */ #ifdef CONFIG_STACKLEAK_METRICS @@ -3331,6 +3344,7 @@ static const struct pid_entry tgid_base_stuff[] = { #endif #ifdef CONFIG_KSM ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages), + ONE("ksm_rmp_items", S_IRUSR, proc_pid_ksm_rmp_items), #endif }; @@ -3668,6 +3682,7 @@ static const struct pid_entry tid_base_stuff[] = { #endif #ifdef CONFIG_KSM ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages), + ONE("ksm_rmp_items", S_IRUSR, proc_pid_ksm_rmp_items), #endif }; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index cf97f3884fda..0b9e76275ea7 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -671,6 +671,11 @@ struct mm_struct { * merging. */ unsigned long ksm_merging_pages; + /* + * Represent how many pages are checked for ksm merging + * including merged and not merged. + */ + unsigned long ksm_rmp_items; #endif } __randomize_layout; diff --git a/mm/ksm.c b/mm/ksm.c index 478bcf26bfcd..fc9879d7049f 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -421,6 +421,7 @@ static inline struct rmap_item *alloc_rmap_item(void) static inline void free_rmap_item(struct rmap_item *rmap_item) { ksm_rmap_items--; + rmap_item->mm->ksm_rmp_items--; rmap_item->mm = NULL; /* debug safety */ kmem_cache_free(rmap_item_cache, rmap_item); } @@ -2265,6 +2266,7 @@ static struct rmap_item *get_next_rmap_item(struct mm_slot *mm_slot, if (rmap_item) { /* It has already been zeroed */ rmap_item->mm = mm_slot->mm; + rmap_item->mm->ksm_rmp_items++; rmap_item->address = addr; rmap_item->rmap_list = *rmap_list; *rmap_list = rmap_item; From patchwork Wed Aug 24 04:03:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12952897 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 6D00BC00140 for ; Wed, 24 Aug 2022 04:03:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0464A94000A; Wed, 24 Aug 2022 00:03:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3847940008; Wed, 24 Aug 2022 00:03:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFF7794000A; Wed, 24 Aug 2022 00:03:20 -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 D22E7940008 for ; Wed, 24 Aug 2022 00:03:20 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A6B541A0212 for ; Wed, 24 Aug 2022 04:03:20 +0000 (UTC) X-FDA: 79833141360.18.3FDD69A Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf11.hostedemail.com (Postfix) with ESMTP id 369D44000F for ; Wed, 24 Aug 2022 04:03:20 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id 83so9612521pfw.6 for ; Tue, 23 Aug 2022 21:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=C9ysgA8b1YgCBIvEexgqiQq6OdwO0KDUjA0c2BYGnmA=; b=VEsHOnCWEXfZFWljS3gMXqT+43LsE3qQQEn6Wxws2JCmIAj78tGJc65sRXirHy62g9 o4Vkh+lrklx0j5niQvV1bTn5+OvjBmMSXd1f3nOBgrUtssCjOwAigJ8NOzks/Gf5v+2P tHKZK+1d97PbfG94gV7iFbXwNlCD/U16aA6QaUmNlu7BSlQAmPYh8np1fNKRqVolcGK/ Hh/05DNxZN50tBa+DXpz6wGuH2S7mTQiZvV5hpEhBVZanzKiRQdEns9K5Am8sDbsGWmR opE8XDGLDhiQA7CMWo8HA3g39ytKGDIs+5RM2P3hyMIAHCOo5zZZH0XgjxgtYNw0WqEJ 6NGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=C9ysgA8b1YgCBIvEexgqiQq6OdwO0KDUjA0c2BYGnmA=; b=RXHGeKQc2q2h8ox2v7wJA37uqDEbBG7PGnysp9uoCRrh2zAfrYrfzLf85mWr1XoyML u2bps+3/IPce4JVlWyNZH+qemEwC8e/1BCUR4gm/G159yfVtNgdLUvJhoWupxOxcsv4h jVerkNQtSwXmLMGLDrbincOiFEL+aDLZxthn9eNGu4qdbwXGmNgTdz2ce3ODDBIz5mQV IKZuim+egcksiT5wni6AwVFQEbgNbeloM1XDLNutootMnfItnCivJGTYd2QtklsG1naa wB6wC0+bFgrcSUa/YMW9n4PnvJM2L//m/+E/mDtv628RPMpls6YA9rFk3ZPWiqMiyUES a3OQ== X-Gm-Message-State: ACgBeo020/vgzDAgNu0VHGwzGdvH8uNpWbAetkHVVdrHD13aCapnAPD4 aPcUawJ5wrfIF/wB0MVZ7Ng9vj8Cu6M= X-Google-Smtp-Source: AA6agR6IzgeF8jGuGG1mbk2YL+egSHkQLMmccGQwPlHhVJ1tdw9/WNs4QOtdcEhb/viGaO7zAfJ1Wg== X-Received: by 2002:a05:6a00:244a:b0:52b:e9a8:cb14 with SMTP id d10-20020a056a00244a00b0052be9a8cb14mr28070025pfj.32.1661313799208; Tue, 23 Aug 2022 21:03:19 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id n17-20020a170902e55100b0016dbaf3ff2esm11427481plf.22.2022.08.23.21.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 21:03:18 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: akpm@linux-foundation.org, corbet@lwn.net Cc: adobriyan@gmail.com, willy@infradead.org, hughd@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, xu xin , Xiaokai Ran , Yang Yang Subject: [PATCH v2 2/2] ksm: add profit monitoring documentation Date: Wed, 24 Aug 2022 04:03:13 +0000 Message-Id: <20220824040313.215119-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824040036.215002-1-xu.xin16@zte.com.cn> References: <20220824040036.215002-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661313800; 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:dkim-signature; bh=C9ysgA8b1YgCBIvEexgqiQq6OdwO0KDUjA0c2BYGnmA=; b=4wPxOGxZ6MxqdotMpAxrUqQ2EmeR5kbGBjSfRB4Rx6vGgO9wodLcb1ajdn5s8YHNVk4u9l ToRObLFvDOfd9kdgcMperW7lyv/TSgfogFqbUY/wgXFiYugzIdqE/l7s16VHn9UdY/F+LE TobrKaja1rkiOzzetuN/o1Ya/uCoTlo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VEsHOnCW; spf=pass (imf11.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661313800; a=rsa-sha256; cv=none; b=QKEUZdx6X0nNarfTPzZj1TQcunrrJqbTmkY/IlAt5meTPGP7lb7/Z48YPsFDEvet2RCtqo HGP1aFCmiLiuN/pNzotx/4Kza2BeV/bTG+KhIiCY+5lNNFgSI5dt1SU2W3PgOjhCS/FtB0 yfw4YfL/g1FnkFrjb+5BDBfaVZbi5vw= X-Stat-Signature: h91u7ytc5egiyifyp7s5dxbbbutchzft X-Rspamd-Queue-Id: 369D44000F X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VEsHOnCW; spf=pass (imf11.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-HE-Tag: 1661313800-857502 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: Add the description of KSM profit and how to determine it separately in system-wide range and inner a single process. Signed-off-by: xu xin Reviewed-by: Xiaokai Ran Reviewed-by: Yang Yang --- Documentation/admin-guide/mm/ksm.rst | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst index b244f0202a03..40bc11f6fa15 100644 --- a/Documentation/admin-guide/mm/ksm.rst +++ b/Documentation/admin-guide/mm/ksm.rst @@ -184,6 +184,42 @@ The maximum possible ``pages_sharing/pages_shared`` ratio is limited by the ``max_page_sharing`` tunable. To increase the ratio ``max_page_sharing`` must be increased accordingly. +Monitoring KSM profit +===================== + +KSM can save memory by merging identical pages, but also can consume +additional memory, because it needs to generate a number of rmap_items to +save each scanned page's brief rmap information. Some of these pages may +be merged, but some may not be abled to be merged after being checked +several times, which are unprofitable memory consumed. + +1) How to determine whether KSM save memory or consume memory in system-wide +range? Here is a simple approximate calculation for reference: + + general_profit =~ pages_sharing * sizeof(page) - (all_rmap_items) * + sizeof(rmap_item); + +where all_rmap_items can be easily obtained by summing ``pages_sharing``, +``pages_shared``, ``pages_unshared`` and ``pages_volatile``. + +2) The KSM profit inner a single process can be similarly obtained by the +following approximate calculation: + + process_profit =~ ksm_merging_sharing * sizeof(page) - + ksm_rmp_items * sizeof(rmap_item). + +where both ksm_merging_sharing and ksm_rmp_items are shown under the directory +``/proc//``. + +From the perspective of application, a high ratio of ``ksm_rmp_items`` to +``ksm_merging_sharing`` means a bad madvise-applied policy, so developers or +administrators have to rethink how to change madvise policy. Giving an example +for reference, a page's size is usually 4K, and the rmap_item's size is +separately 32B on 32-bit CPU architecture and 64B on 64-bit CPU architecture. +so if the ``ksm_rmp_items/ksm_merging_sharing`` ratio exceeds 64 on 64-bit CPU +or exceeds 128 on 32-bit CPU, then the app's madvise policy should be dropped, +because the ksm profit is approximately zero or negative. + Monitoring KSM events =====================