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 C150DC433FE for ; Fri, 30 Sep 2022 09:41:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 544838D0002; Fri, 30 Sep 2022 05:41:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F43E8D0001; Fri, 30 Sep 2022 05:41:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 394BA8D0002; Fri, 30 Sep 2022 05:41:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2A1CC8D0001 for ; Fri, 30 Sep 2022 05:41:21 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DE037A8670 for ; Fri, 30 Sep 2022 09:41:20 +0000 (UTC) X-FDA: 79968258720.23.F0EF5B7 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf09.hostedemail.com (Postfix) with ESMTP id 6B37114000A for ; Fri, 30 Sep 2022 09:41:20 +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 28U9eROW003704; Fri, 30 Sep 2022 09:41:19 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=c+rxLl79olbMnk9FiSEwd3pXvFcUqtfxTaBr1RL/CDc=; b=P154u7hq20mp/Hve3QxBH4GiBzrnV8fTDLfDfX91+5boSa75t3dqng0WS5S0Xa1SJHLh CRFEVb+TXrQMUhWamoFF+oXVx23NrhBwy4POIVE4OdGYWfYQdRBiFNq5FakhFnlFfbjE XfMY7jwl02nvYU6IKdY/KMybh4dztT0TRUXpUWFRZvw8sqFZ4DlHWTBviOdwQkHkWKft 3L14ILzQb/otHKzhmkcHI62Zi0N8CCYght+Fl3FhByT7SbXL7jfmSUJD2xvFicYSy7i/ avbZ3Ak1iTtokeX07AANVqDU1OCCL7oNxLF1Hw9t6jpYS1DRcw1l8ZKcjxM8rz5ejrun bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jwwn2gj5j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Sep 2022 09:41:19 +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 28U9fIBP006097; Fri, 30 Sep 2022 09:41:19 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jwwn2gj4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Sep 2022 09:41:18 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28U9ZqD8030335; Fri, 30 Sep 2022 09:41:17 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 3juapunj9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Sep 2022 09:41:16 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28U9fEIq1835636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Sep 2022 09:41:14 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E9054C044; Fri, 30 Sep 2022 09:41:14 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59CFF4C040; Fri, 30 Sep 2022 09:41:14 +0000 (GMT) Received: from p-imbrenda (unknown [9.152.224.242]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 30 Sep 2022 09:41:14 +0000 (GMT) Date: Fri, 30 Sep 2022 11:41:12 +0200 From: Claudio Imbrenda To: xu xin Cc: david@redhat.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, xu.xin16@zte.com.cn Subject: Re: Reply:[PATCH 0/3] ksm: fix incorrect count of merged pages when enabling use_zero_pages Message-ID: <20220930114112.4d212bfe@p-imbrenda> In-Reply-To: <20220930020032.286941-1-xu.xin16@zte.com.cn> References: <20220929135100.5efe6229@p-imbrenda> <20220930020032.286941-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-GUID: FjnHmKm1op7LxIeT82-60QYR8VYH52YJ X-Proofpoint-ORIG-GUID: _vhx5UHejbyYD4VdZ9k-Ib2f5o7LWWed 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-30_04,2022-09-29_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 impostorscore=0 spamscore=0 mlxlogscore=756 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209300059 ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=P154u7hq; spf=pass (imf09.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=1664530880; a=rsa-sha256; cv=none; b=ruK1LtezHvDI2aZEnkliDTUP8Eyn0wkk7jqodB6axAyvD81AQR2Bf0gonbZ0dQQ3iVSics U2+tge2oWQWOr3zzkgcuMz1ZEy6B+ZNyoGJKNvY0BNKr9/3jfcKp6WnlIcraOWPrrLJ8AU egSAVRY5yVmJ1JYu0LxWaZ4cEQQTgLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664530880; 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=c+rxLl79olbMnk9FiSEwd3pXvFcUqtfxTaBr1RL/CDc=; b=aiXGV+gtfxEN8n2tppeEodQyOuiHUz5XhXb6pVcETGunI1Bs5JE/3WrfYmdqwmW7baUxw3 zCAV+iwS9JMm7w1axuaaaKvWdDLoN34W+lw24QTAj604gQzlh/+YkA0FhwPc1UxMBpygHW Spadr5XkjSXhcEMt3xrA6ktmXaXqxjI= Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=P154u7hq; spf=pass (imf09.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: kco3fdzzxu7hp53x3c4o3r7y3pgqd9jp X-Rspamd-Queue-Id: 6B37114000A X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1664530880-484443 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 Fri, 30 Sep 2022 02:00:32 +0000 xu xin wrote: > >> On 29.09.22 12:42, Claudio Imbrenda wrote: > >> > 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. > >> > >> They are probably the most shared pages between processes in the kernel. > > > >shared from the kernel, though, not from other processes (that's what I > >meant) > > > >> They are simply not KSM pages, that's what makes accounting tricky here. > > > >exactly. and those pages get shared all the time even without KSM, so > >why care about those now? > > > >does it make a difference why a page is a zero page? > > WI's necessary to show these sharing zeros pages. Because: > > 1) Turning on/off use_zero_pages shouldn't make it so not transparent with the > sharing zero pages. When administrators enable KSM and turn on use_zero_pages, > if much memory increases due to zero pages sharing but they don't know the > reasons compared to turning off use_zero_pages, isn't it confusing? I'm not sure I understand what you mean here > > 2) If no need to let users know how many full-zero-filled pages are merged by KSM > due to use_zero_pages, then also no need to show pages_sharing and pages_shared that's not true. showing pages_sharing and pages_shared helps understand how much memory would be needed for unsharing everything. when pages filled with zeroes are replaced with zero-pages, those will not get unshared. there is no way to know if those were actual zero-pages from the beginning, or if they were pages full of zeroes that have been replaced by KSM. > to users. Besides, the description of pages_sharing in Documentation is wrong and > MISLEADING when enabling use_zero_pages. I guess I can fix the documentation > > 3) As David supposes, it also help for estimating memory demands when each and every > shared page could get unshared. the current statistics show exactly how much memory would be needed if everything would get unshared. zero-pages would not get unshared. > > > >> > >> > > >> >> 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? > >> > >> I'd also like to understand the rationale. Is it about estimating memory > >> demands when each and every shared page could get unshared? > >> > >