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 1089BC61DA3 for ; Thu, 26 Jan 2023 19:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FEC86B0072; Thu, 26 Jan 2023 14:59:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AF996B0073; Thu, 26 Jan 2023 14:59:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 776708E0001; Thu, 26 Jan 2023 14:59:03 -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 67BE46B0072 for ; Thu, 26 Jan 2023 14:59:03 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CE41680DE0 for ; Thu, 26 Jan 2023 19:59:02 +0000 (UTC) X-FDA: 80398013724.16.1F9CF68 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf09.hostedemail.com (Postfix) with ESMTP id 13119140017 for ; Thu, 26 Jan 2023 19:58:59 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=FuGqEXvc; spf=pass (imf09.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674763140; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Rl/hw552+8svihkogaE9maykA/H/DKtQPsTNVH2CGCA=; b=bAMRUbO/oUhFn04Jit4hPDDtSjeCWSZzotCjIMsHq3mFnRRQ2lq6gQNu/smu7rpjGS5NZ+ sb8Lb+vY51xvhMvoTjjrBShbivJyPHcCT5gMyiJzrf/Xvv2BNoZwJC/gPUNBcPiye/rF2L blPuTzkbTeRy2bzW1OcKFBeQ9/GHACg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=FuGqEXvc; spf=pass (imf09.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674763140; a=rsa-sha256; cv=none; b=PSoofyCNSD/RflSMYyAvAp0u7AoO6PUqz1bMUGvnMBqKfUCxpiGZJknpCexpgGrOf6McY7 x1Y9iuQj0KwQyiljCmX0fMXEnPemwNd9qWkh7F5ZIjWHgYQuCkDYgsCQqwCO/xq4DD511B JYX1Uq7OnQyTUCHjKJwZPAcTxaLx6ss= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8D18C21F27; Thu, 26 Jan 2023 19:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1674763138; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Rl/hw552+8svihkogaE9maykA/H/DKtQPsTNVH2CGCA=; b=FuGqEXvcZobAesX4+RcKzhqrBFTZ2UN7p/Z7ReOejmAaiNElJHoAhxmY/v5k7zHaonXiA6 8HAXi7MaMSuZ4KiMf0/aQOMcMOWz1fO3ZxGAuNm8TXfQnEitpccuQi7BpupZUPNWzfgCWC ONk7gI7PBX3d09E2HUBA7EGGE51dJX8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5687A139B3; Thu, 26 Jan 2023 19:58:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Owc7FILb0mMTLQAAMHmgww (envelope-from ); Thu, 26 Jan 2023 19:58:58 +0000 Date: Thu, 26 Jan 2023 20:58:57 +0100 From: Michal Hocko To: Minchan Kim 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: 13119140017 X-Stat-Signature: 111shwcrrmp16go516qfxrphitnq44z8 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1674763139-988524 X-HE-Meta: U2FsdGVkX1/NRoUOkXdyAFs2iaIUAfvKEv+lPsSPNLymVF6iExE7/VaxeKAp8gL4e9Vp1dpeGH1wQBg7ml8rs/vM0Ay2pOtRlLsgXjppPkAKgxu8x2VzyCVnuj2eyouUWDC7nP8IznDBUaVg2TS0/5XSoyUuBWK4szjeHp7TR2FYDE8mu1ikJ3hQNLPjLcPftyppTu1HpzngpAijoKYtGIoNl8kBoMTczbvtvFUdn6m/V2XHwYFAv0H8PeGEHjlGKm2SYKBnwZiREPxrTdHRMco3JJBS90EP1NiCckigAEHvYF9R4+lONhfKEYVyuGt3GqA7eQz8g5+6Sti+ZdeImwAkpeAXbXxzu2jd7MTJrvYBK64UA2HV0zP/A/YJqY7Gpm8AcXYcUZp9UunHSyvLH/gidgR9ExE0FPg5PPU8dWjYceIFyWgGgGcu3886QEAWH8iu+alo7jUGAF3jXmp9fZm92b0p7p56ZFUtRzLs46l4R5gBFCnPzTSzpOBjSNQ9/5gZwDmzTeerokjSolSWQbSyj3IuUHC+I85aJCC0RIVyU8MTJXX+Ty3KnDV4yYCBWkW3lF3i0ubtYMaMbX1m+U6HC3MB+O/tXYDpdvTySEjJP349LgbMrVX4M3hzHwPkxPAI/WpqCI8VC43/drqgTF1f575SSVHkUHKO/pYPfBuia03gx3xPiBAMvykvpt7egK2lMCUT1Ib7y2/4KY8C0vjPz61upI6KI+0V99mdOyp4ZLJfG4hnc66IJxSzKRpcxQ8eNBjDmKVMFnUWVE+3OLVqAbePXsJOsnLurN+93cEk5zsSijFBFtsSWXRZKt8uCfo9W+T6mhRYaI1BUWOSdiVIKYPQJEEYqEkeYNMZ0OvPW2iq3MTlIMlujXWGsY9JTF07CwkkxIgBpVeu6iSPftsJIHUZCScOk9hEuzi4MecGzMP3Y0s9Z5ElVR2jbbGx0O0rixPo0uzMMfWHyh6 uoyTpJBC FRjvq4gttLisO3ERfq6+M4fJZ4zr389L95OK1fLep/mKWCHPWgASV889srSwF79KR8sIRyNvTKPnUAUu3rEUwp754oKiXIEBGz7TDL0b6WUSGk6Y+bCMHvSDA0PUzhxVv3w3jm/9XebB3mKBVlyiRDa6xGqMcegN2Navo+g0a2Lo9qg0A1RpHWzp2+fGBipsAfSkKMZCluvI6knAeD1KBT16fLQ== 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 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? 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. 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