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 EE659C38147 for ; Wed, 18 Jan 2023 21:47:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AC406B0071; Wed, 18 Jan 2023 16:47:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75B8B6B0073; Wed, 18 Jan 2023 16:47:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 623666B0078; Wed, 18 Jan 2023 16:47:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 52CDE6B0071 for ; Wed, 18 Jan 2023 16:47:30 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1B55080CB4 for ; Wed, 18 Jan 2023 21:47:30 +0000 (UTC) X-FDA: 80369256660.22.61AD871 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf21.hostedemail.com (Postfix) with ESMTP id 6BAB31C0006 for ; Wed, 18 Jan 2023 21:47:28 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Wvx839aS; spf=pass (imf21.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674078448; 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=ffnkh4zmysw3vaXwpundCOoVmU47s9oaVyFRyCfZsPw=; b=oZiu3KZAC1BZEGSv0pFv2+/VgnX9DV8ya2zzBx3J2tt36URUtI4A0MH/uII3woW5lx88vO luioYtBvSIkfykmce+uzGtr1Nlhx/6tV/106WTX4IGfv+iMKguBKAEugZfgi8+yWk0+yCC oV488y1TUUFtJgffBFB+Lu50/ZPXkOs= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Wvx839aS; spf=pass (imf21.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674078448; a=rsa-sha256; cv=none; b=Bd5V8Id9J3nMJEb8BZVyDfp1wHfyCDFtvBxq+juHUu/vLNCyZ8LlSvIislxsRFbP7FxnsC RKvcyzM05iX91qwyyfnA26Fi1Bia7vVba83G02VqcIWGtQTpuY6JSqLpmLIHAdYNaImUZW RhqBdA+DyiKuh99G2dicR9xx/KLwU3s= Received: by mail-pj1-f42.google.com with SMTP id dw9so416496pjb.5 for ; Wed, 18 Jan 2023 13:47:28 -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=ffnkh4zmysw3vaXwpundCOoVmU47s9oaVyFRyCfZsPw=; b=Wvx839aSwuI8Akay3jFqTCUbMYQXrzZ0twFxcZq5OZMmj9QiJAOPRVAVOMjWKKm35l kYQwsTUdFRiyHa34M5GGH8p2Es5sWJkSb/YJ+zFs2d9xhPOw70ad6rhDPgA/0x27fJAy prg4jDTGDVpXsve/C416mYRvkZ0CBdgiy7BVkhTpXCWiCR2dd3sBCQCxpYIBEiClc6Ro lCic12AY4qkwZPcdfnJjJGfsjsF51eLXjp3OdIqGYC1ytCXM7G+ol4z2jDQI1SNCKGyn i3axNccfjuqK7hg9EC/kswxTbaW8WSiXY9Qa6MSmb4zCj0mmVWY0tN8SM4hl8/C5cgCt Xbhg== 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=ffnkh4zmysw3vaXwpundCOoVmU47s9oaVyFRyCfZsPw=; b=w2tttO1BqjL9zplY8Zj0SZEOGcnvqax3aux4uoTBimzyBYQWVJRCDL6D4q6D++f9e9 9b76cDQYXsmvaS049BgLF5IOLKf323fX8UOugKstJ0KonZasT0v7ocHlOlb4LqonUjLB 0zEa4lsgSnbdKkca2xyfCd8XQbre/7NJIjSXsmU6jQF26LpMpLbjbAGoef8/OEn8FPy6 wcg+E/nEhu7vMfBOTAwCL9yjotER0KLCfV5MtE79U6mnYnX3m5eZ279M72DkwL7cCVFA CGRFrns9sqoqdOWS4xxgCO7fwGC1barwboZONLC/xtUy2TnCJMXkenXBb07BEapolnbr KxzA== X-Gm-Message-State: AFqh2krIiiydayyM6k3XGZtitl1UTXJExwG3lKtYzNNNcjx4bJlb+eDB QqoGgQSFYN+EkeBwgGredwM/nnFPWwk= X-Google-Smtp-Source: AMrXdXtbammpm8G0MvFB4bDBkTD3IA1R85bI8AL2fRbXYU1sqOZuJn++nf29G1qR78M/rvPU6SGtBA== X-Received: by 2002:a17:902:b091:b0:194:8261:8018 with SMTP id p17-20020a170902b09100b0019482618018mr8556580plr.64.1674078447265; Wed, 18 Jan 2023 13:47:27 -0800 (PST) Received: from google.com ([2620:15c:211:201:68ba:bd93:858:15d5]) by smtp.gmail.com with ESMTPSA id s19-20020a170902a51300b001949b92f8a8sm5626063plq.279.2023.01.18.13.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 13:47:26 -0800 (PST) Date: Wed, 18 Jan 2023 13:47:24 -0800 From: Minchan Kim To: Michal Hocko Cc: Andrew Morton , Suren Baghdasaryan , Matthew Wilcox , linux-mm , LKML , SeongJae Park Subject: Re: [PATCH 3/3] mm: add vmstat statistics for madvise_[cold|pageout] Message-ID: References: <20230117231632.2734737-1-minchan@kernel.org> <20230117231632.2734737-3-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6BAB31C0006 X-Rspam-User: X-Stat-Signature: 575d46db5gwn34mp3qhh4krc7q54zn5y X-HE-Tag: 1674078448-636564 X-HE-Meta: U2FsdGVkX1+vYQ6/8k/ZE5n0dpp54xnx47qQCba2cVhDjdOhkfkoOeDshLPL0J9VbayHtUwjebWasgGlFZpfO9JbAylz9CIEEJ/JBcr6iUNOAxSk6NiznBpleBJK7S16o7SYVZ3ahGOlUY+xb+hN+fzTMTEx8FTkcIhv8uEs+fv37Td2GogjSrzK86jfoiyQAuEU5kZDI/I80mvSm9lfVu4m2NwCek7FAbLdFkuinKp9gIeu1yKHdmyvSIuJmxp0pst6+Iwt0o4nQPYuCzTDp+CxKoyJyKXf0fIZwFgjys3i0xGXJTTGeZwg8qO/YTF/YAd3mSpIukLZ8ohYJKYI2h1JgzruyUHF/PbGz8GL4YSI09inWrjo2tuMme+3m5BhZRhaXuW2r5vy/+1Y+WXTivRwKfMheZhMTfDoahnft5IwFWPV2B3u75RDxZaAy/7LBGNSKuUBJfFdKDFl3B91wrebcT9o3OVqZOUn+Odeta9agJFQ+kQxt/U0zNH4OKgR3LNaUJY6k74vT2fbWnLLhqSxxgzIvjLD4mNrbNfuYKLiiHvktxU/U/9CgiizTHMmhHFevgLpsPMQa7WA2SJgaG+ajanC46RjY3luNW/XHL1tzU1krfKhOnM87fQSxTKa8VsEL0BLdQ4oo7GsAmuvMlXngGFAWWRJGXX7CfuQNSv74oC4XhNfaaReeDcqdn4V/7NARr24oAgQXS38WvzJMSutm1hBDaAZ/bPMaFhA1nCoct8vgpMSupBZiuLUvpxO3kCXfyBGevdjcpH2Oe8oYEWZGW/gDmPIXoYj3cZMBuPScetUijOc+eG0RmgCvv3P6pd5OfTb+p52GlxTz9M1zAgSvmJN58ZDeyVTgHJ8EMZ0IMCi/gh8uJYczhpwpSMh3eiT+H3SyLfuGZehQKByobDUo0WyMvIRxbWsl77OmKof/dqVWk8qwT7F0DNpHO0Ej9S6nysBeWtrZrWjeb5 dNUI2nsu wiGG91W8A4Xm0a4qRA9JYm2hN3ohu0pst7vriMY5Uva+JUDS9v8SgJWgKLJpchBAFyVykiy4AO7zOQ+vp49/VKSi7+xNYnndfTHTzvYAu2fW1q19k8Koj09/nMvFVSMffSO8yynTbDexAfUZmLy/fuAEv6cHzZyy1UGaywAqq3Jony/6zzOqrKGbP2ajEGwlpkEUgELrttlR9TayYLbXhalhKpHkHOil8mX8vBohIWmWsSBkhPfV7TDZu9VQ9crYEaq6hSqgGve8fhz6ewjb1U5b9au2PRpl1Wu9g+sux3F2h3s16+lvDO4sk1VqI2Fu9cZrOWZdgWLdaktqphaaxTDcrG7nDDFa6f/dX 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 Wed, Jan 18, 2023 at 10:13:38PM +0100, Michal Hocko wrote: > On Wed 18-01-23 09:55:38, Minchan Kim wrote: > > On Wed, Jan 18, 2023 at 06:27:02PM +0100, Michal Hocko wrote: > > > On Wed 18-01-23 09:15:34, Minchan Kim wrote: > > > > On Wed, Jan 18, 2023 at 10:11:46AM +0100, Michal Hocko wrote: > > > > > On Tue 17-01-23 15:16:32, Minchan Kim wrote: > > > > > > madvise LRU manipulation APIs need to scan address ranges to find > > > > > > present pages at page table and provides advice hints for them. > > > > > > > > > > > > Likewise pg[scan/steal] count on vmstat, madvise_pg[scanned/hinted] > > > > > > shows the proactive reclaim efficiency so this patch addes those > > > > > > two statistics in vmstat. > > > > > > > > > > Please describe the usecase for those new counters. > > > > > > > > I wanted to know the proactive reclaim efficieny using MADV_COLD/MDDV_PAGEOUT. > > > > Userspace has several policy which when/which vmas need to be hinted by the call > > > > and they are evolving. I needed to know how effectively their policy works since > > > > the vma ranges are huge(i.e., nr_hinted/nr_scanned). > > > > > > I can see how that can be an interesting information but is there > > > anything actionable about that beyond debugging purposes? In other words > > > isn't this something that could be done by tracing instead? > > > > That's the statictis for telemetry. With those stat, we are collecting > > various vmstat fields(i.e., pgsteal/pgscan) from real field devices > > and thought those two stats would be good fit along with other reclaim > > statistics in vmstat since we can know how much proactive madvise policy > > could make system healthier(e.g., less kswapd scan, less allocstall > > and so on). > > > > > > > > Also how are you going to identify specific madvise calls when they can > > > interleave arbitrarily? > > > > I guess you are talking about how we could separate MADV_PAGEOUT and > > MADV_COLD from vmstat. That's valid question. I thought for the start, > > adds just umbrella stat like this and if we want to break down, we need > > to introudce sysfs likewise slab. > > No, not really. MADV_COLD is about aging. There is no actual reclaim > going on so pgscan/steal metrics do not make any sense. I am asking > about potential different concurrent MADV_PAGEOUT happening. From what > you've said earlier (how effectively policy works) I have understood you > want to find out how a specific MADV_PAGEOUT effective is. But there No, it 's not a specific MADV_PAGEOUT but system global policy. Android has used the ActivityManagerService to control proactive memory compaction from apps since it could control life of apps. You can think it as userspace kswapd. > maybe different callers of this applied to all sorts of different memory > mappings and therefore the efficiency might be really different. As > there is no clear way to tell one from the other I am really questioning > whether this global stat is actually useful. The purpose is global stat.