From patchwork Wed Aug 24 07:07:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12952985 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 47562C00140 for ; Wed, 24 Aug 2022 07:07:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B13256B0078; Wed, 24 Aug 2022 03:07:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC1786B0075; Wed, 24 Aug 2022 03:07:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96258940007; Wed, 24 Aug 2022 03:07:50 -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 87D486B0074 for ; Wed, 24 Aug 2022 03:07:50 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 59942120831 for ; Wed, 24 Aug 2022 07:07:50 +0000 (UTC) X-FDA: 79833606300.30.737183E Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf14.hostedemail.com (Postfix) with ESMTP id 13927100010 for ; Wed, 24 Aug 2022 07:07:49 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id f21so16190467pjt.2 for ; Wed, 24 Aug 2022 00:07:49 -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=PXafh5f+pigI8lTygHH0lurdqVrGUMub4Gos5atZnOQ=; b=HsdOV6X0ITgH2yGuQ3b98iiy8QNVcOLPz8ObGnZUz5a7ATRlrUzRTDHNLfsUrNG+qY OP3oKeKkjbewVjarYo1XUABAuOR+w9ye8pTUiHS8fCbP1GZv4J+DJw3HDWOij9WEXSID 1WeLvvlf+oerfF8O8Iu1t/8mHftJVnGAceyjfudLCbcNHuidZJJCa0P9na4ZbABt6DGM WcIB0nGznps1CxEY3SbcdpH6vggWfQCKu+Rh41HIXsDoKAMYyiwHCW4xElaRqIqEXTMB Nuhfuo7VF6KOQqv4cCInEQCUZJP9g2Hjk4QYFxIRRasmj2jD/lQN5nYmfzynHEypu+W+ FWBA== 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=PXafh5f+pigI8lTygHH0lurdqVrGUMub4Gos5atZnOQ=; b=pgJXfR4kXo8FJBbaqd3WEQ2KLMqy1DQC4agIlL6DDyu7eV16dS/ruOZ9JS7tYBdpV2 TQmuKnZUNfjxVMkjrvlqYZOGnyVt0mGeJCDwt16UsQmfS7kv7bA/vU/66IQsX+iSspDV LPdREbNPvZAUviIYPOcalG6RfLMb8FFicwy5CZrsrzYB8MCSRR6mQ7n5o/Q1ncbloBYV rCpOcsG63mNoOWVn3+9Kbf0jz6uSCW7tMsd4EBAYLCvSm99LjnJ7y7NF9amIygvYIdcq yQcz7wzuidejZuGuulSEV5aO5VcrA2F356JRFtcQ0jZqN2Dw5BvsP+I0piSTuD/1S6UZ EjjQ== X-Gm-Message-State: ACgBeo3SkAKlfL/VdbKReUScgnJCjew22At/g/Ft4cGidMEnZSoixM/J QHUGMt8KVsgOaImCQxrzJr0= X-Google-Smtp-Source: AA6agR4pw6w0HuTOmjtqzCYa/gYOpKO0DzmiYndqTYq3H/EuqbX7SSXSaG7zatYXeRMMNAu1UX7Kpg== X-Received: by 2002:a17:90b:3149:b0:1fb:71ad:256b with SMTP id ip9-20020a17090b314900b001fb71ad256bmr4679326pjb.18.1661324869038; Wed, 24 Aug 2022 00:07:49 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id z12-20020aa7948c000000b00535c4b7f1eesm12118187pfk.87.2022.08.24.00.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 00:07:48 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: akpm@linux-foundation.org, corbet@lwn.net Cc: bagasdotme@gmail.com, 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 , CGEL ZTE Subject: [PATCH v3 1/2] ksm: count allocated ksm rmap_items for each process Date: Wed, 24 Aug 2022 07:07:38 +0000 Message-Id: <20220824070738.220038-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824070559.219977-1-xu.xin16@zte.com.cn> References: <20220824070559.219977-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661324870; a=rsa-sha256; cv=none; b=4n6tyqLVPni213+M2eej4FVlpinhMiqYJNDfvSu5KY+gfeGpxFAUft2AdPo7uUMsDy0HXk EIltpB5kqrmMDZyM5dP+4oGTTIwcnNNkv5LF1wIO1yStIiegw37MGp7PtrfOriGdFT2CFR Ls8yi1B5gPrqkX7KTlBxnopGm6BAJFU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HsdOV6X0; spf=pass (imf14.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661324870; 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=PXafh5f+pigI8lTygHH0lurdqVrGUMub4Gos5atZnOQ=; b=zz2HcOwmTwhIE7eFrf4WQWPqmNOw6/s9pDuCZaAUS7qXgE78k8MIIxoZQetlW2i9MiUrHN 3V/9FUEshfGlfHe2qon4vNp1tv8/NH9tq70+AeSuD0bd+KAEk2QhQVgURKtrzA9tzFfHyj eGkCbxF3TxqHNQJyaNylv868rBY01s4= X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 13927100010 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HsdOV6X0; spf=pass (imf14.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: cbnxxokb9fh8oq74rjti3ebdfnxgdnd9 X-HE-Tag: 1661324869-154817 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 4ead8cf654e4..9977e17885c2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3199,6 +3199,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 @@ -3334,6 +3347,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 }; @@ -3671,6 +3685,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 d6ec33438dc1..a2a8da1ccb31 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -656,6 +656,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 #ifdef CONFIG_LRU_GEN struct { diff --git a/mm/ksm.c b/mm/ksm.c index a98bc3beb874..66d686039010 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -387,6 +387,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); } @@ -2231,6 +2232,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 07:08:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12952986 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 17C99C00140 for ; Wed, 24 Aug 2022 07:08:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC3F9940007; Wed, 24 Aug 2022 03:08:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A73BD6B0075; Wed, 24 Aug 2022 03:08:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93D09940007; Wed, 24 Aug 2022 03:08:28 -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 83C9F6B0074 for ; Wed, 24 Aug 2022 03:08:28 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6025F140B9C for ; Wed, 24 Aug 2022 07:08:28 +0000 (UTC) X-FDA: 79833607896.01.36D561A Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf04.hostedemail.com (Postfix) with ESMTP id 1EB714004A for ; Wed, 24 Aug 2022 07:08:27 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id f17so9503609pfk.11 for ; Wed, 24 Aug 2022 00:08:27 -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=LEEMGQDs4/g59g9kDUdIuPraqbT+/kClJ8jAWK7HzkvrxU/dqKEUb0RDp/+CpxB66Y 3lCtmtIwLBpblH9Wjcjt7xvfpfOdXVIGHNBqpC5fiKiURR+vNyU+h2GkTeTLrClT69Mj UR7k+RkuheEe/W1EPL80oMbF7pczj7/zvN9htxsvmBi2hynsUwL7tmb3sHwhgK6G1zAO XSLOBK7t02VBHAOGHL55R6Gz1f2zjZw+DvudGfmyeN6I2oF+LDLJB5q9Vn1Y8+2PIxxF eataJ1qMgMdzAxciIS61HSYj02dBib4Ibq3Jl3kETnCP91qSi43T3UJs6selWo9VSudR /g5A== 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=SFJQX5BVSlqxnSkLNBL5N6O631iATM0SBRRouflZtJsVXKUh0JGylS6LroIPcmK5yF EI/AIPx0yEwxXSwlK0HsgR5Ro6fDswgn1yowGVUR/rQtH8ghw/4Ky9gxCJ5i8ANj+2SX ShuPHx3i8fS0TCDf+ckr3H8MCkxlPKQMxMx8Y8LV+ncKas3kjKCPq9ZY3Iot19cxvsGk u8ndzgyqqHNAX3U0oBESR1FyaXDWrgegUKckR8L3BDKAkPQ5CXD17mIZPG5ShjYUBsuV 8J7drMyZ6q9+6lo5wSGuR/6WPeYRlHqbsiNgQVXShJgn2ZLujcEC9nQf/WlN5xiUjOHC ecEw== X-Gm-Message-State: ACgBeo0RHBPqgwxWAUJM3OcAXpxQf7fRAdAULD2mn+9wJcXzqM/H8nOz x2bZf7NLxSS4B9ojbjmXOkk= X-Google-Smtp-Source: AA6agR50+EL5onhLdSLsvcV3vYXXL6Et8CPOgYqocPpC7tATpo1aqiWNYcQDHNDkTpbWlqQhAwkEHQ== X-Received: by 2002:a05:6a00:1588:b0:52f:a5bb:b992 with SMTP id u8-20020a056a00158800b0052fa5bbb992mr28066493pfk.38.1661324907176; Wed, 24 Aug 2022 00:08:27 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id l9-20020a170902f68900b0016be96e07d1sm11654373plg.121.2022.08.24.00.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 00:08:26 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: akpm@linux-foundation.org, corbet@lwn.net Cc: bagasdotme@gmail.com, 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 v3 2/2] ksm: add profit monitoring documentation Date: Wed, 24 Aug 2022 07:08:21 +0000 Message-Id: <20220824070821.220092-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824070559.219977-1-xu.xin16@zte.com.cn> References: <20220824070559.219977-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LEEMGQDs; spf=pass (imf04.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.210.174 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=1661324908; a=rsa-sha256; cv=none; b=p7jT3IyTnR+S0nB7KgnKkctmwqNdtw7vwcRwgVsl1N3px1mmWYvO9bYfCcz0EB1cgqsFe+ tJKWV33VVa+qI3vixEXyPXEkK/CCG6EfwSqbt+gaeZP03FZI91hwmRV3nt5VANNqThBNfD R+XmOWrfeYOFG1Bkswgi9VTr0i7J1+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661324908; 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=yOtG/BnPO4XViASlRVU6rPmcaRLe6sL03ukBNQ1bSgR+duSaBY1pLo6l21S0BHLgRMG7zd peycAVXABtjeYAbgVw7t7IRpjShN8E3FjFaaTGgEALgb/OJOX2Qr/MaYcNbkCIaQpzLnJD ZUOBUeXLnluUvmDIaDQ0wTxGCttXGsw= X-Stat-Signature: b14sf7qfayixn9t9ks33uyzf5taaoy5g X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1EB714004A Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LEEMGQDs; spf=pass (imf04.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1661324907-706931 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 =====================