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 D5D16C05027 for ; Fri, 27 Jan 2023 00:08:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 536E38E0001; Thu, 26 Jan 2023 19:08:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C0BB6B0072; Thu, 26 Jan 2023 19:08:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 339AE8E0001; Thu, 26 Jan 2023 19:08:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 21DD26B0071 for ; Thu, 26 Jan 2023 19:08:49 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E7ED3AB248 for ; Fri, 27 Jan 2023 00:08:48 +0000 (UTC) X-FDA: 80398643136.09.3A23CD7 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf13.hostedemail.com (Postfix) with ESMTP id 0403520011 for ; Fri, 27 Jan 2023 00:08:46 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ICXGjelC; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf13.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674778127; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tYasTB2m4TEatMoCQBPHuxDKatey6WCBsn2n2geZIeM=; b=SmeMCmX6BMI/g1gsqqtXGlRvBxzKAxZRjz54rk0Etz7e2zntvZRITzsOKnc6cWJsMFQ+Vr 7JldE2LGfsysQo36rylPMmdZQa/QZTO+qYAISDuw+Hj6wRt9tXh/YsyFPROfpnuqyQMpR/ nVT/YJjEBNLUHb+glaYwKVuJTiCoiBA= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ICXGjelC; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf13.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674778127; a=rsa-sha256; cv=none; b=D9YJ7/Rrljf6c8egkO2e+15sLFCEGUtvJGcxmhuCSX42se6E30G3a6Y+EdstzroMNqzTbv 4KO9DXTJoMSYnHxuaLNkMd5uP6lEQlQiLHBrgb55oYSIbhw8XnV+QQpEnU2Noo4aOjhey8 iu4wOZV/9OyY2CFp+NIa7hGJ3KWFmHg= Received: by mail-pj1-f46.google.com with SMTP id nm12-20020a17090b19cc00b0022c2155cc0bso3322464pjb.4 for ; Thu, 26 Jan 2023 16:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=tYasTB2m4TEatMoCQBPHuxDKatey6WCBsn2n2geZIeM=; b=ICXGjelCoQX3DlTPd5YxJGGN4wvxmLuWXue7Y3WPN6UaMWwFG1kvLdxeUH9fV14mNc 8Q73FUtUItzw+C1lppAOrpp8jfD93nvCvjsiNyiwD9aoks7SE9d1mqdRWHFHD6d/54iN +MlhcEwfpxqakO6mAZfOcfbxtEG6JOjlkDrfWfzsq+tj/5raaA5Les+oNZ5nQWl+zq+b QjzNAM7jqj0j1/lx3G22WFp91X+2TZg7ll35CbyCAXXsiqGubadvjLjmhrZnlhjphlq8 Bh1fRdhNK+9nr1NJrUat/p6j5FQd3hbRIFPg8/5RmgWUiM0m223jobtKgUEd8h0RdIq4 fltw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tYasTB2m4TEatMoCQBPHuxDKatey6WCBsn2n2geZIeM=; b=3A9Ce93y6OuFZU/yklDgtTxiHeFLqJLUvBzqn5Lm+rIGTutmFYBevvhnfu/puoleda xb46SBeuC6ODHxidofglfyuxeQifPjf8tPp9aZZC6gZhs+lHNbcXIXSEB1AQmOGJUdZd dUEcqgF+aFGXkmIkMCdXGj2zJMfvkmNSyqk7SsWoceeJQXMOPGimedNByfme6TKjFBTf tysyOODKfPgs9g85egiVyBdU6F5ft4gWe2HzsgObvq2TJv2gZYk88vJwi0dB2j5SZDvC RDPfst7vZVLBsx9WJs8DqVrAgWQes48lXizd1oqcNu3WxX7cA2MqD5wlfRIOZq3eXYNY 9hyQ== X-Gm-Message-State: AFqh2krHTPXNuvubBY9ijl2VI/MvWLmzK3MtW8a3U0B48dknq2XdSo+B krF62/gKH99RvjtF8GuH5pw= X-Google-Smtp-Source: AMrXdXs5favszU6a2xnNWHR8t+LYt+QAJSjm58Nw1cMIzt0kh0ZMT3sYHmmhpfsek7efohuNx3o7YA== X-Received: by 2002:a17:902:bf0c:b0:192:c36c:f115 with SMTP id bi12-20020a170902bf0c00b00192c36cf115mr35366957plb.66.1674778125579; Thu, 26 Jan 2023 16:08:45 -0800 (PST) Received: from google.com ([2620:15c:211:201:9ca6:45a6:69fe:a468]) by smtp.gmail.com with ESMTPSA id w30-20020aa79a1e000000b0058215708d57sm1431239pfj.141.2023.01.26.16.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 16:08:45 -0800 (PST) Date: Thu, 26 Jan 2023 16:08:43 -0800 From: Minchan Kim To: Michal Hocko Cc: Andrew Morton , Suren Baghdasaryan , Matthew Wilcox , linux-mm , LKML Subject: Re: [PATCH v2] mm/madvise: add vmstat statistics for madvise_[cold|pageout] Message-ID: References: <20230125005457.4139289-1-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 0403520011 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: rb9tjscrkbspbtghou9om7e8cf17m15w X-HE-Tag: 1674778126-717555 X-HE-Meta: U2FsdGVkX1+OZxs4P1T+yxuFUhjKxT/6jPrunCrubbb3b58RlaJ/ahOySRf7P6CZ+kaxOo6lcXd59EEiE8oIPVGFA/tIWSHG2Y6OKVyTY8DdcM9IuiDhjofzBkLWQqhYBpIZWLUhDTIE8EHAMojSW39myYohH5pdBvj9doYHozUpLqGuY9xQp/fKcn1KUBk7u7tXk+7l7+Kn80NQkiolCtKuDZgB6CXsVOA2BJ09y1TJbgiySBPc5t5hxjMIGgqVY9wfLPpOFdUvzSsx+cRh102+NCiAxWFruGBVuIlOLkC5caWDsp0YgOPgXao+NT9xEqu7p5O6z9xPDPl5yaDC1OrARw7ptE0HOX1jpszkfeDZA6GRUHuI0BP7czYale4m4ARJozTEX9+k/ac5tUv625kTTlYVzqKNtfsHpx2QgzIEHGi+kXyuciiFTkTMwJTps+iHDSgr7I2nGF+dRbuTUXsBNhvDek5jERUsBnCtmv0XBSAvsQVyiwyemxFvOpEd0AiVw9Nl5LUHrRzISo6J+B4fRJJIrEka+kW8GXysZLnmC7yIpftiNuYHPm60VByH9k5jQvXkxTd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edence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 26, 2023 at 08:58:57PM +0100, Michal Hocko wrote: > On Thu 26-01-23 09:10:46, Minchan Kim wrote: > > On Thu, Jan 26, 2023 at 09:50:37AM +0100, Michal Hocko wrote: > [...] > > > I suspect you try to mimic pgscan/pgsteal effectivness metric on the > > > address space but that is a fundamentally different thing. > > > > I don't see anything different, fundamentally. > > OK, this really explains our disconnect here. Your metric reports > nr_page_tables (nr_scanned) and number of aged and potentially reclaimed > pages. You do not know whether that reclaim was successful. So you > effectively learn how many pages have already been unmapped before your > call. Can this be sometimes useful? Probably yes. Does it say anything > about the reclaim efficiency? I do not think so. You could have hit > pinned pages or countless other conditions why those pages couldn't have > been reclaimed and they have stayed mapped after madvise call. > > pgsteal tells you how many pages from those scanned have been reclaimed. > See the difference? That's why my previous version kept counting exact number of reclaimed/ deactivated pages but I changed mind since I observed majority of failure happened from already-paged-out ranges and shared pages rather than minor countless other conditions in real practice. Without finding present pages, the mavise hints couldn't do anything from the beginning and that's the major cost we are facing. Saing again, I don't think the global stat could cover all the minor you are insisting and I agree tracepoint could do better jobs to pinpoint root causes but the global stat still have a role to provides basic ground to sense abnormal and guides us moving next steps with easier interface/ efficient way. > > Also I do not find information about how many non-present ptes have > been scann super interesting. Sure that is a burnt time as well but to > me it would be much more valuable information to see how many of those > resident could have been actually reclaimed. Because that tells whether > your reclaim target was a good choice and IMHO that is a valuable > information for user space memory reclaim agent. That's exactly what I had in previous version. If you believe it's right direction, I am okay. > > Again consider a large sparsely mapped memory but mostly inactive memory > and a condensed active one with the same rss. The reclaim could have > been successful for the former while not on the latter. Your matric > would give a rather misleading numbers, don't you think? > -- > Michal Hocko > SUSE Labs