From patchwork Thu Sep 29 02:52:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xu xin X-Patchwork-Id: 12993434 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 7BB00C04A95 for ; Thu, 29 Sep 2022 02:52:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7BB66B0073; Wed, 28 Sep 2022 22:52:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C29476B0074; Wed, 28 Sep 2022 22:52:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF11D8D0001; Wed, 28 Sep 2022 22:52:21 -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 9EAC46B0073 for ; Wed, 28 Sep 2022 22:52:21 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6FDD3140629 for ; Thu, 29 Sep 2022 02:52:21 +0000 (UTC) X-FDA: 79963599282.12.9D7A99A Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf22.hostedemail.com (Postfix) with ESMTP id 1E528C0004 for ; Thu, 29 Sep 2022 02:52:20 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id y20so105491plb.2 for ; Wed, 28 Sep 2022 19:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=VOQpuvLZ0z/uJAR/JakCoFvCPaF9FfRjV7Nht49vP2I=; b=PBVutv8VuBbw48h4nskgkFVuAnP5eBT75kv2eLzpZBlee8Lo3Z/3IDv1ioOnu1evDa 0XpVIJ/A7pI76qLM5IV4aajrcKk/xvLA8gcfmV4uLGp/vscuDRfCV84Fo2Wejfrpnqgv 8H9mrgVt5bq5KNNoT7wDg3bX3XKsptnDpIiY4sejurxC/d2Lp5Ml17Yxv06NPPg1X5AA yq7328fLQMdo7vWurd4Dr2EyjLVgtYOlIKTQ7/xZEBtyz/A40DhvKm5AYDAOwF/KsYQa dS9fpnQKnSgDIIEPtpm8ujmL7pQdionOZNVQeXXQJpn6ui277UhaDcmPnMZA+WPfwOkc 9tZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=VOQpuvLZ0z/uJAR/JakCoFvCPaF9FfRjV7Nht49vP2I=; b=eDl1fK//JwNywBkulUp7N2CyfKjd1tkSbqqKovLF0r4zKjBxT7PRRojtCRCBGFTRtt aKkb3EYt1DCbLurdFxAqosLqiUfgKlXu+T9HOIc+9S5dx287u/s5JY4KRxI46hEa7I/3 UKhx06lZPfbIsQl7giT5BV2Iap8SbPKIrdOfwqSkLoyNvvt1ApginM2XIbXAZ18YXtXW CzaDhhpcRk1bjwrPn2iLoYiUMlwPBRS0JGASYYOSwFsKe0UwExa0xjO68WkxvdDa5Crs N0/lR5K3qnNeipKab8Ep29WiefsKO2v/YoCK17qlf6P+2Il720Ssv3AlFoyDwfeJma9b RClw== X-Gm-Message-State: ACrzQf00vNjD2Up2DV1bW15YojSdJ6L+zkvlfE6RRL+Q3G8kDdjLkel+ miJXzI/OJEa6ZujlKa5dK0w= X-Google-Smtp-Source: AMsMyM57m3Juvh+quZOZ0wbrpUDOJ5u9pQWLkWe/nbhTCX3DoREYsd1oR5XsPUxvbffX/xKYrxHpCg== X-Received: by 2002:a17:903:2286:b0:178:349b:d21c with SMTP id b6-20020a170903228600b00178349bd21cmr1175303plh.71.1664419939950; Wed, 28 Sep 2022 19:52:19 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id p7-20020a170902e74700b001789ee5c821sm4599034plf.61.2022.09.28.19.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 19:52:19 -0700 (PDT) From: xu.xin.sc@gmail.com X-Google-Original-From: xu.xin16@zte.com.cn To: akpm@linux-foundation.org, david@redhat.com, imbrenda@linux.vnet.ibm.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, xu xin Subject: [PATCH 0/3] ksm: fix incorrect count of merged pages when enabling use_zero_pages Date: Thu, 29 Sep 2022 02:52:06 +0000 Message-Id: <20220929025206.280970-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664419941; a=rsa-sha256; cv=none; b=SgEQpTZsIGTQHBipHyrSr37sr67Z42eYSSC6t7/grJTyn9Xb3clQeD3XsyvpOSohtB07iQ eUCVcyT8sJUd8NJjVhjx/yUb1XTJ/Lav2i1Z9W/IXzOdTfcszGS//oa0qIQ3rLZJPZnmir fn7aawUKhOMHRbas+5cExo3y/wiRq9Y= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PBVutv8V; spf=pass (imf22.hostedemail.com: domain of xu.xin.sc@gmail.com designates 209.85.214.194 as permitted sender) smtp.mailfrom=xu.xin.sc@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=1664419941; 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:references:dkim-signature; bh=VOQpuvLZ0z/uJAR/JakCoFvCPaF9FfRjV7Nht49vP2I=; b=HPw/HpHJ/H0dKV5hCmnL3I5CW8uuSpRxHHUUykDncWkPDMLGm6homBARtsUjd73ksAf/HU 6/+AvecGH6PFhk7EJy0DbIB/wCYaUsPTndCBRIKO07JmheRbdxdfFl9hrp/7SHN+0vwUO2 cyhnetLCs6yeBRS06ab3e3zRkPjtnAc= X-Stat-Signature: r3cjreru83gznrohtza9datc8rcswiim X-Rspamd-Queue-Id: 1E528C0004 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PBVutv8V; spf=pass (imf22.hostedemail.com: domain of xu.xin.sc@gmail.com designates 209.85.214.194 as permitted sender) smtp.mailfrom=xu.xin.sc@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-HE-Tag: 1664419940-987852 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: From: xu xin Before enabling use_zero_pages by setting /sys/kernel/mm/ksm/ use_zero_pages to 1, pages_sharing of KSM is basically accurate. But after enabling use_zero_pages, all empty pages that are merged with kernel zero page are not counted in pages_sharing or pages_shared. That is because the rmap_items of these ksm zero pages are not appended to The Stable Tree of KSM. We need to add the count of empty pages to let users know how many empty pages are merged with kernel zero page(s). Please see the subsequent patches for details. *** BLURB HERE *** xu xin (3): ksm: abstract the function try_to_get_old_rmap_item ksm: add the accounting of zero pages merged by use_zero_pages ksm: add zero_pages_merged in Documentation Documentation/admin-guide/mm/ksm.rst | 10 ++- mm/ksm.c | 122 +++++++++++++++++++++------ 2 files changed, 106 insertions(+), 26 deletions(-)