Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1479034rwb; Wed, 28 Sep 2022 20:03:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fUmiGAEsaRgzEg3p2y2MIdCiJ0sgQzSvXHjoZqEzPIkaXQT/OLGO4P5L+v5uaJeoS4AFS X-Received: by 2002:a17:906:eecb:b0:73c:5c85:142b with SMTP id wu11-20020a170906eecb00b0073c5c85142bmr816922ejb.433.1664420586858; Wed, 28 Sep 2022 20:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664420586; cv=none; d=google.com; s=arc-20160816; b=PJE9AytZnOYPEEixx0YP3zcZYr1PZT8jLOIfFcAPi2fGaEiNA3s6KazaGUfpl3bBFm aW4UjiVvbU20w5nJA89Bajw283syMSlqGvQ+gcmBvtV9qOFvhHZEs20ZruWV+RP+9qxO JHCYFUJkMjFXsj0BM319Vqbp4P6W9WwAZInF+keh3Th062oOl/60wqL5b9P6G7Lii4y0 mvwdPB3zR64nLZD3qVb9SMFgTqhJ7W9ji4DYi8njpLeuS8ahhKqcL9m5GqooTC5ekWP/ hYCkl+qiPtD2v+TyIH0mgH4jGkHflzJ1dUhhMQQ4Bhg9LIfI+e6inhi9UWaxsCszBN2m ijeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=VOQpuvLZ0z/uJAR/JakCoFvCPaF9FfRjV7Nht49vP2I=; b=GeYUe1Qb/Kr7+bhJr/4RL0j4kN3514vr88ji/fMFmFnT4POem26x2bmJ3enb8/Z2IP 95PEncoo8E9IJYwgWCW/GkLMbbuVCxhLD2j5mCL9cil8IehvfXnJAahmN+Vj3SiwtEWY VPcOBVp9cluEH4nS/JqsdBkDVpNbrXVgxttnSo3czg7g9gWQE9dNmV4ldTS/OGUi5c0o XAPHVzxa3aaW3GtigBXDoHh9hpZW68rTTAHj+7o7gBVjn9ZACFA8gFHr1OJzZ1dfn6Ri f4xkQu9Qj6OYoSglzE7g0g3QSKzFoR1HbSGQixgompOxdAGM/V8CbuQFpjxPvbhFp3YI aNcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PBVutv8V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a509b0f000000b00447b2f52d55si5892050edi.627.2022.09.28.20.02.40; Wed, 28 Sep 2022 20:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PBVutv8V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234774AbiI2CwX (ORCPT + 99 others); Wed, 28 Sep 2022 22:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233713AbiI2CwV (ORCPT ); Wed, 28 Sep 2022 22:52:21 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 727EB17AA1 for ; Wed, 28 Sep 2022 19:52:20 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id w20so68529ply.12 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=vLaHmkhsh/kyTL2xGvt80YKptvsIGp11o2/4JN6qteabNY1/Rrwh56/8hSmWgyMObY buAX7XumXYa0ZVvwJvv5XfghS8i2rM68YoT20kh6GzXm/0mI6X/Y7yMcGzRiHR5y+9h/ SRYyFpOGSfVCP9/JnmxlfYvDo5rhGOS1S9ZNOxd6ud8G3EBXdHpTCZ9F5t+sN2zLenH4 FhSSAjFgYFUpjdddkEcw+YZ1y5bH1ncBd321Rt0zzgylmNm2u0GtRvk3IB4ehwrzHSoI LQbsZVmnGpwy+cQdWboQHPOzCXQIEGEs0EH6NhFozOO1OtCUuD2kK6onYr0gQ3hpC4sk epOQ== X-Gm-Message-State: ACrzQf0eSv2VvvTQPHH5+edXLas9DboCNdQDA6q4GLEdDPbFAyUus5Gi olTTK2p2WOWMsNy/d3nL9DfkMGZtJPcXQfu5 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.25.1