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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95CB2C4361B for ; Tue, 8 Dec 2020 02:41:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 19C4623433 for ; Tue, 8 Dec 2020 02:41:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19C4623433 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 941D28D0005; Mon, 7 Dec 2020 21:41:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F05A8D0001; Mon, 7 Dec 2020 21:41:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82D698D0005; Mon, 7 Dec 2020 21:41:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6D4CE8D0001 for ; Mon, 7 Dec 2020 21:41:17 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 36AC83626 for ; Tue, 8 Dec 2020 02:41:17 +0000 (UTC) X-FDA: 77568563394.23.touch37_630dd7a273e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 18E0737604 for ; Tue, 8 Dec 2020 02:41:17 +0000 (UTC) X-HE-Tag: touch37_630dd7a273e3 X-Filterd-Recvd-Size: 6567 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 02:41:16 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id t18so6210785plo.0 for ; Mon, 07 Dec 2020 18:41:16 -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=rFKMN3Lenb+VaK77PoP0Px7plQtnVT6Nsw8KoPED3Ds=; b=GviSs/sA7OMEyX9L7NulKkRHF51iOhb+ZP4MiSlV1zDEy8K/VWZmn2GDoe/e707lyo Iy8K9sU893iw2hRgcNB3I9mrFRrravJar1qHdHTb+fwqrJ//DCb/i4CQxipeX20P2rL6 2mD8H3AsfNbkIwC/00SSaSb/mR1FTAW3UpQ6y2FtTC30CsX+Kx8125GqWvt6Wkpf7EI8 cLEr56nouqszr5E0aWMfnM5T/qdSd6XjO/WZI+/SQHHgiMsEvlmUolXN3YOIvDiXOMiO ApD3AX07skTKA+RyADmmrxjd019fpFTfGJEfUl6anx/E6qfFggm+FLko4uTWrFgG3eby mYfw== 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=rFKMN3Lenb+VaK77PoP0Px7plQtnVT6Nsw8KoPED3Ds=; b=mGoiuqp1i2kNQSH6BgCnVobWq48F88+ISbWG9PlNucpjMR4SByFrBMzZnasoSjCO9o rXg1FBlAuPVmrjLbKGxJ4zvSgpcjkRv6koigqZWko+nlIU77jGKtFqQH/UdCgGJuu9Vz x9Yj0OTiQZ4pkJs1oc8lN48Tpn73EFC0wZeCfJ75lARGpS95r60LjRHzySiqE3MRYcE6 I4LTfp6wTF5577FGnNYwYVTgchG5v+4SppMxwU1shod0Ak+ZzATc0h2Z7FsMKu4oMk8k 29VK10mT/Vqhql9Dc64CB9qoz1o0MFHb+aQN7n/OmLNii2HVKOIYOwdGmjr30jD34B+0 mpAA== X-Gm-Message-State: AOAM531EL2sBVRGRlyGXH6TtUBETL4Dhmdmc9ie6TPK53l8YN3RxyQBD ucsXEK3PicEwmh6hdE2IlgD89jBqKInFkIQb10tTUA== X-Google-Smtp-Source: ABdhPJyW0aZTSOOLlbmbXWbngFtXa+woAAz2hOOzBNhuINR6CavZVPHFEJJO+nQyckR2TB3E46z41lVptmbzsWTdXj8= X-Received: by 2002:a17:902:bb92:b029:d9:e9bf:b775 with SMTP id m18-20020a170902bb92b02900d9e9bfb775mr19295660pls.24.1607395275316; Mon, 07 Dec 2020 18:41:15 -0800 (PST) MIME-Version: 1.0 References: <20201206101451.14706-1-songmuchun@bytedance.com> <20201207130018.GJ25569@dhcp22.suse.cz> <20201207150254.GL25569@dhcp22.suse.cz> In-Reply-To: <20201207150254.GL25569@dhcp22.suse.cz> From: Muchun Song Date: Tue, 8 Dec 2020 10:40:39 +0800 Message-ID: Subject: Re: [External] Re: [RESEND PATCH v2 00/12] Convert all vmstat counters to pages or bytes To: Michal Hocko Cc: 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 , Randy Dunlap , Joonsoo Kim , LKML , linux-fsdevel , Linux Memory Management List , Cgroups Content-Type: text/plain; charset="UTF-8" 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 Mon, Dec 7, 2020 at 11:02 PM 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. OK, will delete the convert of KB to B. Thanks. > -- > Michal Hocko > SUSE Labs -- Yours, Muchun