From mboxrd@z Thu Jan 1 00:00:00 1970 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 4E34FC433F5 for ; Thu, 29 Sep 2022 10:42:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA0EE8D0002; Thu, 29 Sep 2022 06:42:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D50408D0001; Thu, 29 Sep 2022 06:42:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C185A8D0002; Thu, 29 Sep 2022 06:42:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B20648D0001 for ; Thu, 29 Sep 2022 06:42:50 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7C163C1227 for ; Thu, 29 Sep 2022 10:42:50 +0000 (UTC) X-FDA: 79964784900.13.346E572 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf08.hostedemail.com (Postfix) with ESMTP id 0A5E916001B for ; Thu, 29 Sep 2022 10:42:49 +0000 (UTC) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28T904hF028572; Thu, 29 Sep 2022 10:42:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=3OEtUohKov+5N35Ww2H23sWgdBX4b8OAubti8YZUKtY=; b=YuWlIy73LdpdCvXyA1B2gJpjynm3OQI1XAJWCQ45MTr2984uf5ZHF4AzU9RMbiAnSCIE hgDyD0ffy8IEJ93CF4n+0cIAIVnDDelgEQ2tk+RcDU8ZJZsXG8TMDEmuC+XR8GjWxh1/ B0KV0pqI7zPNnzQ06zzxtlx8mqHH7ye0JvNcsP3zORWzo0JDjPG8JTLc3lVwJKKRXH+s wALiXwnmhPMp3GWGvMLqQxcbHhGq+XXbvPlpNSLgxCIKqJtL0inQW8d+sb72N7HXVfkQ sNslyEvomhUHZPwlEkFaA5M88Pml8xKo/WTOs7lWPj54HzsBde2+a6+h/hQJBM5ptonN iA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jw8bmtwuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Sep 2022 10:42:48 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28TA77kf035972; Thu, 29 Sep 2022 10:42:48 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jw8bmtwu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Sep 2022 10:42:48 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28TAZfMr025329; Thu, 29 Sep 2022 10:42:46 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma01fra.de.ibm.com with ESMTP id 3jssh8vw4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Sep 2022 10:42:46 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28TAcQbB50004314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Sep 2022 10:38:26 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C80852050; Thu, 29 Sep 2022 10:42:44 +0000 (GMT) Received: from p-imbrenda (unknown [9.152.224.242]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0A14E5204E; Thu, 29 Sep 2022 10:42:44 +0000 (GMT) Date: Thu, 29 Sep 2022 12:42:42 +0200 From: Claudio Imbrenda To: xu.xin.sc@gmail.com Cc: akpm@linux-foundation.org, david@redhat.com, imbrenda@linux.vnet.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, xu xin Subject: Re: [PATCH 0/3] ksm: fix incorrect count of merged pages when enabling use_zero_pages Message-ID: <20220929124242.60ef57ee@p-imbrenda> In-Reply-To: <20220929025206.280970-1-xu.xin16@zte.com.cn> References: <20220929025206.280970-1-xu.xin16@zte.com.cn> Organization: IBM X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: RyDh9rc124c3v-DbLRaw4maZtGvjDtez X-Proofpoint-GUID: pZ_VTkvTqeOfgtB6K-hbdZwLkMppifpv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-29_06,2022-09-29_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 malwarescore=0 clxscore=1015 spamscore=0 mlxlogscore=633 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209290064 ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=YuWlIy73; spf=pass (imf08.hostedemail.com: domain of imbrenda@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=imbrenda@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664448170; a=rsa-sha256; cv=none; b=qq0/14GMFNAfXRG7lJnx4Yn4d3peMJOb7xnD34NDzM1SeXBjPaPZanXV3pX/WTyMg8xxkA kxSpJ5LK9sRpXMH4uPdvs26vu82aWr/bNwe2Lxc32XL2QyLJ7KjCdxTJbq4meaLX1GBtgz AQimf0x3FznTEvxZcpLVRvrgazPugww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664448170; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3OEtUohKov+5N35Ww2H23sWgdBX4b8OAubti8YZUKtY=; b=sJV0UPqwspLORGk4B8Jhp2ECzAfMIlfyNMIAtDZhYWQf1YvVBbCZXr4EioCYBZdugpv4VR daz+6jniG60WfTDsezuCdcf6K11N5UtbQmha3Ceu7K3eQeI79E4yIK1KtGwYnyA6bft2Ki imcgG5/6Qb2ip6q27976GvuC0OEfnP4= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0A5E916001B X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=YuWlIy73; spf=pass (imf08.hostedemail.com: domain of imbrenda@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=imbrenda@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Stat-Signature: fyo7njqqe3dd9canibwidbbcu1o7rt4s X-HE-Tag: 1664448169-370199 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: On Thu, 29 Sep 2022 02:52:06 +0000 xu.xin.sc@gmail.com wrote: > 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's because those pages are not shared between different processes. > 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). why? do you need to know how many untouched zero pages a process has? does it make a difference if the zero page is really untouched or if it was touched in the past but it is now zero? > > 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(-) >