From patchwork Wed Aug 24 12:46:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12953478 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 88DBBC00140 for ; Wed, 24 Aug 2022 12:46:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B7D8940008; Wed, 24 Aug 2022 08:46:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29786940007; Wed, 24 Aug 2022 08:46:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15701940008; Wed, 24 Aug 2022 08:46:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 067A1940007 for ; Wed, 24 Aug 2022 08:46:23 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D1CB1C06F8 for ; Wed, 24 Aug 2022 12:46:22 +0000 (UTC) X-FDA: 79834459404.28.4AD3396 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by imf18.hostedemail.com (Postfix) with ESMTP id 79D721C0017 for ; Wed, 24 Aug 2022 12:46:22 +0000 (UTC) Received: by mail-pg1-f172.google.com with SMTP id s206so14938226pgs.3 for ; Wed, 24 Aug 2022 05:46:22 -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=3ofBEgoOVULXRx9YcQITS6kJlSwXHxOcRDY8bmuQ+uo=; b=NYC0P+VvC3h/qTsakz1cthPNN6d0FSa/CYEhKgFHhMVQFz5I0VHJw5acQMB+cJxtdg nnU/tDqXG6W2Y0nMwoO00ADoUZDT2fX7FJdTXFMHlhVsvg7iZFacy3t2TV5/FjURCLzo HylQLQN259LAegfiak5+uqCcTPMABKgl3yBrMJ3UFKZEwEpqi4AszeZODfyApIV4pimQ ++ROAvmiK0Uw7LuoQMle0VTrFC9XJCHu5ATLXebq9z+I+qLHqNSuNToy/mGdlZNFqbnN fY2WhXGJn+7WmztHZUhW1rLBf8akcWKn6nDTf60IkUBdSvMA3wJrarhuuFbB9i9pNvfk 1Bug== 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=3ofBEgoOVULXRx9YcQITS6kJlSwXHxOcRDY8bmuQ+uo=; b=b//X+sylpj5BFfo1tdhkAOOab1AMZbvhBd353d1v39iR7GxEtIn//T8qCqiNIeuG5W zp4hVUVODFf8xh+Nwgk1teCCtNlNO3F8JMDmgTQuHUl9WjYjPTvGXZqxOvjERMB3uv9o wqSlskdXMVhMFatvInxjXyaNt8QHnOLPP47vqGuZj1j8U+/L6/c/KS/R5/8v39i8T5hG YXVTEg2hsLx3CuDR6kEYqT800XIMJP+BcVnyc4Iibu4rV0A0nNjS/vFnmpnbvNIFOS19 kWaAh4IK5iEimhA9e0BLb6dgRkRLWaIM4hFXs8Jx5mj6Ytnldx0w2aRvG1sgNvsYrc7U ZjJA== X-Gm-Message-State: ACgBeo1NEZdS7GV4KRrwyWarQmNT9Ur01Yol+Kwu7SyHvIaHpEQVIwZ4 2TcFffqf1W2yE3utWd9qshU= X-Google-Smtp-Source: AA6agR7CoO2D9s/3qmn9/iCPy26WOtaYDVN7fIrc2I5o2V7sIFjhhRlUaQG/0F3Z41g231kvMm6D+w== X-Received: by 2002:a63:8a4b:0:b0:42a:5144:a44 with SMTP id y72-20020a638a4b000000b0042a51440a44mr18608141pgd.164.1661345181365; Wed, 24 Aug 2022 05:46:21 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id rw13-20020a17090b2c4d00b001fb3522d53asm1271613pjb.34.2022.08.24.05.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 05:46:21 -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, xu xin , Xiaokai Ran , Yang Yang , CGEL ZTE Subject: [PATCH v4 1/2] ksm: count allocated ksm rmap_items for each process Date: Wed, 24 Aug 2022 12:46:15 +0000 Message-Id: <20220824124615.223158-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824124512.223103-1-xu.xin16@zte.com.cn> References: <20220824124512.223103-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661345182; a=rsa-sha256; cv=none; b=DcqoTc3sutiRl5ZpGk0MMSgJNwdTGki+n4KNydMJVYQQ2TNczeN4N7W/GonznUiDQ/SEdy zlJAJ87ezing6DZ6bkd+m8FVu4oiyQ/uRRwhmIf45ACr4IZLdZkGQESQ4EozIi4rNeH+8z 6RpTXnVSZ9KH7Lj9ymJRD4rf5LebIo0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NYC0P+Vv; spf=pass (imf18.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.215.172 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=1661345182; 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=3ofBEgoOVULXRx9YcQITS6kJlSwXHxOcRDY8bmuQ+uo=; b=EoQBGzmoLGNAkDZITzJu+pEDHdg5TmPmn/GmcmWIumU2GOwxYIL4c9zalcfZ9Eo+XO5V/U cFmDg+5vnzP6dDdH+yaNSpI6sJiw9GlGjPfeky6v+J8iSZIOdhUkiKBawRLS1tcjpA0nQ6 pg4bONYE5bEkzZ5EOPDK4BDt1eOvD7g= X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 79D721C0017 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NYC0P+Vv; spf=pass (imf18.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.215.172 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: oyznepjzi5dp65kjejys865zj6j5tioe X-HE-Tag: 1661345182-61380 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(+) base-commit: 68a00424bf69036970ced7930f9e4d709b4a6423 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 12:48:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12953490 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 45452C32793 for ; Wed, 24 Aug 2022 12:48:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D19A1940008; Wed, 24 Aug 2022 08:48:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC837940007; Wed, 24 Aug 2022 08:48:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9104940008; Wed, 24 Aug 2022 08:48:54 -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 A9C5A940007 for ; Wed, 24 Aug 2022 08:48:54 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8A5411604B0 for ; Wed, 24 Aug 2022 12:48:54 +0000 (UTC) X-FDA: 79834465788.08.B798C12 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf23.hostedemail.com (Postfix) with ESMTP id 410AC14003A for ; Wed, 24 Aug 2022 12:48:54 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id v23so10295621plo.9 for ; Wed, 24 Aug 2022 05:48:53 -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=3OQD2+oSTaOvMGB6cXQRW5a+Su7VAZ4WsnuVjsdDDzM=; b=SOLX/QZmuIMPp/2Uy5E2CSAvHb3+m0SzUirILcS/EyK012Umz3AIw5jq35bTeKP/W3 8hj9kX7BOqCt8zpWftYwwOYR2DAHqy6PKJltIDwnlvBb/VXcpefOZScCwgSFGU2BwMSA lEpxytTHRX6mJkCbRObicYCiC9EGxuBd4YgVLSmc7AwAm4sSue60aeoDTZXDzwE5HW0y auNxftyQXFx6uaXUtp0c7D8IxLutVaWbbIZb9CxGA6BvUWGENUIzvInwHLHfTrQSPpVI dl2go6my+QL5J7TOPuGz5Uz9RgDAE4D2BFvB9u+HJMX6WWXP7qNC5/I2y3g3miYcKnRE 6Gew== 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=3OQD2+oSTaOvMGB6cXQRW5a+Su7VAZ4WsnuVjsdDDzM=; b=64tQcJaXU07o38OlRJtgInZY2lYcB3HagqCgGayGNuWJajj+WiEwasT5L0i9A2jxJx ZLSA1dnCitJRUJx/QkUM81sLY2eUcbXa3GZ45btiuj1wPJ2II2/+XO7A1ZAGP+V52r1Q zCSzJx6GToiqV7mME+RVdEnyyyg0Sj+WrH9qI+YFvXJzMrtvKTRS2vmOYQ7EPg3JDjHB JeHz8vJsefgkd8VaYYtirnQ6pcWqAT1WmdBgmGa5RpVP+8QOQcVm7xdkH3fNU3WDEgcC pACfe49XeZ0cmWkR8SMIpurDS38QBaqbODPeKDbQm9hb1iGimkaWRRDbWRcYNo2iXlcy hg6A== X-Gm-Message-State: ACgBeo0MSCC2NdpiOLeFgpT0iF0vhZIHtTj0FJjhYolyLyV+XBSJVz2c y2SlCyj4hizeBuufobRZH88= X-Google-Smtp-Source: AA6agR7i2f7HdP9QZhENuohXe5QBXSpJvJM6qjCdMoq6KBiyK5/RzX1er86DvyF8scdrDgu1w7RwIA== X-Received: by 2002:a17:902:a982:b0:170:d646:5851 with SMTP id bh2-20020a170902a98200b00170d6465851mr29526104plb.134.1661345333276; Wed, 24 Aug 2022 05:48:53 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id e6-20020a17090a7c4600b001ef81574355sm1318786pjl.12.2022.08.24.05.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 05:48:53 -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 v4 2/2] ksm: add profit monitoring documentation Date: Wed, 24 Aug 2022 12:48:46 +0000 Message-Id: <20220824124846.223217-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220824124512.223103-1-xu.xin16@zte.com.cn> References: <20220824124512.223103-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661345334; a=rsa-sha256; cv=none; b=phoGxMXLro4QgHaqCDX4IcyJ62tPTp+NweH6ywOdZLNAAaJQCY5zrC/WCsjoi6s4F4qpg5 g6E3md0CSIwUOjbYMbDBTVoLzDBIMYg9ZuhzVdlO7KomvqYowUXj6ejnAkwlbMOswy11NA 5b2WPRzrzgkHiFe67CoMo4TOMP4S1qQ= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="SOLX/QZm"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661345334; 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=3OQD2+oSTaOvMGB6cXQRW5a+Su7VAZ4WsnuVjsdDDzM=; b=nEBqT+CtXrFoXdVuC2NlmskertLN/92dRoapG2GQ9lSQ++qJKMnhtT49XK9+D+dZnEu3L3 zC+A45Lpfnm7tY2kHJgSRXpCP/d1XRPq0ff/JlCYZ8cFWZ1lHRMTtOp2DZQ5eU5wNCfAds hOUsCeOeus5sjuo8RJ8hTl3ZSHS+0T4= X-Stat-Signature: rmqbextpyrn7x7xpugnk7rtuk8otc7t9 X-Rspamd-Queue-Id: 410AC14003A Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="SOLX/QZm"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1661345334-578805 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, 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 Reviewed-by: Bagas Sanjaya --- 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..c2893027cbe6 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_pages * sizeof(page) - + ksm_rmp_items * sizeof(rmap_item). + + where both ksm_merging_pages 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_pages`` 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_pages`` 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 =====================