Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2856556pxu; Mon, 7 Dec 2020 18:35:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNlrPD6pGQFHF6BwCirtiqEoxC6F1ip0H8/naDQKzNo5hn4fxGgkMYTDyBD64ec+Yonv6s X-Received: by 2002:a50:ee1a:: with SMTP id g26mr22978373eds.68.1607394941730; Mon, 07 Dec 2020 18:35:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607394941; cv=none; d=google.com; s=arc-20160816; b=wQFDfBe+qxdxXTicaQUwKuy6oKvgRZHt87wroYvCTP4Ha2WqHzX0+wJ8hm7TSaPych +bvdsASu7Dmjl2YdLTpBcBxKmO6r8WvR/G/NV1BqAXzH5lFjhKg4uFwd5JZhF5jlmiEv ntUl2FUgcQH7g9vY+Bpu4F/WRXF95hh06AZWrqSazHvpIB883ARL1PilrC6Z36rJbuUp XOQpf2uAB8sQF3duUKGX9jML4CC6B1+OfJayUpGh/WvpJhJWYesd5zgb8ZeQqWJSrtB9 1AaHJM4fngJbqUlQCyyo7jD1IJ+TiEvUQlUQiHoT/yfxrU4yMBcKBvt/XZd68ZfUq9+U sqjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=CH7xlBpG5Zzki/I0pNBCcovPXjgp215OcunjJaNzVcc=; b=diut+thi3Si7i4h9bbTnVPsXbtZXRBvZoLipky/xfCsj695a0lN+QMyXkIS8pDC+XC oPVgjt/taiM2DqT/SI6dM7NtWBAFsWutHu/+fu/rchUPoGPinvt19mKva+kFRY3bJdfC lwyHANuZ9XajHbfC5pMyGwWc9S8zwurM2NF2cs54npGgMSG5tKxaNBu+FwgHwXKyu6ms qmiO+s2YOLMtdXVc3i/XjxVPM4ree7goYrGZcvYWcjsjY3a9qS3tnNS4xP4nW6ho3ZtU dhVothWT5tGuslugLRxsLntsGhvx/KsqiJW8If32FMeICexUrsIpLibboDq7j1LvqMlA 5cGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=V7atJSCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy24si7627663ejb.348.2020.12.07.18.35.18; Mon, 07 Dec 2020 18:35:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=V7atJSCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727912AbgLHCaq (ORCPT + 99 others); Mon, 7 Dec 2020 21:30:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbgLHCap (ORCPT ); Mon, 7 Dec 2020 21:30:45 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F24DFC061793 for ; Mon, 7 Dec 2020 18:29:59 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id w6so12412390pfu.1 for ; Mon, 07 Dec 2020 18:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CH7xlBpG5Zzki/I0pNBCcovPXjgp215OcunjJaNzVcc=; b=V7atJSCte4bFOWHk0qsCWTfnLuJ+UxQ/uwlkqIATLHBwZoo+PiUsnBOD/Eh8d5fLjb fic9D7J2wW7Kfc/uN96HMHD1VaNDk6m8UIHLD5y9sGrwLWk2uvmxbvLOc+pMpAIHp9en UZkOvNmBlt7mPlN/HxiVH1/FDjn6Kcjq5ueHMQVzwHAK6DH730S3sPzUFDeOku8m4POh 4uT1KDIT9Icxs9Cg6+xXE/3D1v/iNGPP7OUKux/LT6sanoaCOsbpxYx6Rv7dr0u+mHcY O0g3F8kKAW6PnnhlrhwoPeTuyUEGrPHdo3RTKoNBx+FOfTcMKLNHoU9LrgpGakM5r8hI FTRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CH7xlBpG5Zzki/I0pNBCcovPXjgp215OcunjJaNzVcc=; b=FjSoS7ccAptrxwlpxPWr4V4o3D+TzwoYVS5QRXdd4yAU9GSVKXjn5eqpYJ52IUi4eE qQ9rMWfUF2rW0K7+df85nGIvrcJ3qdEJvKus689/bK164JNNgQPIGgfmXA9MlI3eTXB7 UHF9bdoiyJV7qqbkbLPfwyDrmnKQJ8/bY8QU8WyKtSo7lAvCS+1hU4cMrlL3/rqipfmp J6RK5MvVyffJ2PZE8+466cgVHUdrwA3eLapUl9x3nbtwjy7TUIu4PYs/XWNc28+ddmNa kZX3qvVBur88or/UhZTbCFS+Mhb4N0jLGO+sld3NE8GtnFbxdycXbezFUe0xnS7O/fbz 7u4Q== X-Gm-Message-State: AOAM532OlTvzGugg4AkPVlWYqs6Lr+n+DAFTkDBwdyCmXXJo7aKkapXF KtIizYE+kjIN86oA+IY5QpXryNv+EwE7Dfudj1Uvnw== X-Received: by 2002:a17:90a:ba88:: with SMTP id t8mr1807265pjr.229.1607394599426; Mon, 07 Dec 2020 18:29:59 -0800 (PST) MIME-Version: 1.0 References: <20201206101451.14706-1-songmuchun@bytedance.com> <20201207130018.GJ25569@dhcp22.suse.cz> <20201207150254.GL25569@dhcp22.suse.cz> <30ebae81-86e8-80db-feb6-d7c47dbaccb2@infradead.org> In-Reply-To: <30ebae81-86e8-80db-feb6-d7c47dbaccb2@infradead.org> From: Muchun Song Date: Tue, 8 Dec 2020 10:29:23 +0800 Message-ID: Subject: Re: [External] Re: [RESEND PATCH v2 00/12] Convert all vmstat counters to pages or bytes To: Randy Dunlap Cc: Michal Hocko , Greg KH , rafael@kernel.org, Alexey Dobriyan , Andrew Morton , Johannes Weiner , Vladimir Davydov , Hugh Dickins , Will Deacon , Roman Gushchin , Mike Rapoport , Thomas Gleixner , esyr@redhat.com, peterx@redhat.com, krisman@collabora.com, Suren Baghdasaryan , avagin@openvz.org, Marco Elver , Joonsoo Kim , LKML , linux-fsdevel , Linux Memory Management List , Cgroups Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 8, 2020 at 2:51 AM Randy Dunlap wrote: > > On 12/7/20 7:02 AM, Michal Hocko wrote: > > On Mon 07-12-20 22:52:30, Muchun Song wrote: > >> On Mon, Dec 7, 2020 at 9:00 PM Michal Hocko wrote: > >>> > >>> On Sun 06-12-20 18:14:39, Muchun Song wrote: > >>>> Hi, > >>>> > >>>> This patch series is aimed to convert all THP vmstat counters to pages > >>>> and some KiB vmstat counters to bytes. > >>>> > >>>> The unit of some vmstat counters are pages, some are bytes, some are > >>>> HPAGE_PMD_NR, and some are KiB. When we want to expose these vmstat > >>>> counters to the userspace, we have to know the unit of the vmstat counters > >>>> is which one. It makes the code complex. Because there are too many choices, > >>>> the probability of making a mistake will be greater. > >>>> > >>>> For example, the below is some bug fix: > >>>> - 7de2e9f195b9 ("mm: memcontrol: correct the NR_ANON_THPS counter of hierarchical memcg") > >>>> - not committed(it is the first commit in this series) ("mm: memcontrol: fix NR_ANON_THPS account") > >>>> > >>>> This patch series can make the code simple (161 insertions(+), 187 deletions(-)). > >>>> And make the unit of the vmstat counters are either pages or bytes. Fewer choices > >>>> means lower probability of making mistakes :). > >>>> > >>>> This was inspired by Johannes and Roman. Thanks to them. > >>> > >>> It would be really great if you could summarize the current and after > >>> the patch state so that exceptions are clear and easier to review. The > >> > >> Agree. Will do in the next version. Thanks. > >> > >> > >>> existing situation is rather convoluted but we have at least units part > >>> of the name so it is not too hard to notice that. Reducing exeptions > >>> sounds nice but I am not really sure it is such an improvement it is > >>> worth a lot of code churn. Especially when it comes to KB vs B. Counting > >> > >> There are two vmstat counters (NR_KERNEL_STACK_KB and > >> NR_KERNEL_SCS_KB) whose units are KB. If we do this, all > >> vmstat counter units are either pages or bytes in the end. When > >> we expose those counters to userspace, it can be easy. You can > >> reference to: > >> > >> [RESEND PATCH v2 11/12] mm: memcontrol: make the slab calculation consistent > >> > >> From this point of view, I think that it is worth doing this. Right? > > > > Well, unless I am missing something, we have two counters in bytes, two > > in kB, both clearly distinguishable by the B/KB suffix. Changing KB to B > > will certainly reduce the different classes of units, no question about > > that, but I am not really sure this is worth all the code churn. Maybe > > others will think otherwise. > > > > As I've said the THP accounting change makes more sense to me because it > > allows future changes which are already undergoing so there is more > > merit in those. > > > > Hi, > > Are there any documentation changes that go with these patches? > Or are none needed? > > If the patches change the output in /proc/* or /sys/* then I expect > there would need to be some doc changes. Oh, we do not change the output. It is transparent to userspace. Thanks. > > And is there any chance of confusing userspace s/w (binary or scripts) > with these changes? > > thanks. > -- > ~Randy > -- Yours, Muchun