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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 1F3F7C433E0 for ; Wed, 23 Dec 2020 22:08:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E563B22202 for ; Wed, 23 Dec 2020 22:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726958AbgLWWIy (ORCPT ); Wed, 23 Dec 2020 17:08:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725270AbgLWWIx (ORCPT ); Wed, 23 Dec 2020 17:08:53 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA79C061794 for ; Wed, 23 Dec 2020 14:08:13 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id y19so670457lfa.13 for ; Wed, 23 Dec 2020 14:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PoQlpaNI1/l22p0KY/MaQ96Dou9p/HLpoR9DVa4LJh8=; b=giGTxA/mxQx+XNfe8QbMHFkMxauB+o9JgajRnbIVQvV2WUIsFUTtYQiZimQfDBK4Si AueOX8SxNXBi/ULV8E5WHBMbPVvm4KL2Xf3G7gUH2RlljAPls4Gg7nODbKM1xcqER6cX a0MgrXFP51furYSyTt8rCXnmWC0s2wGW7AiJRcPYcknhrh70u2WQRz9FRotvdlwfOsae 463WoX6OLSTIdNM88A2GE2UO76k+JjJ5+1vj/d6qYCbfpkc3l+eEkk4eSx1yyx0YMPKV 6f2J8wtixvO9Pg5Xmn0vpCr09CuRdNN2E9buWaf55xaky+TKUJAzS7ERK2fdHzdYU4p8 sC8g== 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=PoQlpaNI1/l22p0KY/MaQ96Dou9p/HLpoR9DVa4LJh8=; b=AJeHdOIB65VMwXe05qSS2UyXp+ckFtgCCTlkB1sPCtFe0X2/CZisnhSuIN1LqnzE3r 4+M/+AmVRwsZUREN1sO8Ey2jOHkvjoo9iFJr/WJAZ/M2kINOmTli/noKpcebrq3wpvzT 0A56egJkvqHeHIZnjE2Gonr3drtIdy8UnpnqcwGjO+1vV7ta6SWxmSI+MigG9Itoq6rq 7ubQ0i59WnIXJxwHClfb7iB2w5ysEePZJnkZzcKL89YFgtSyM2Fi2gavx8ZwYCD13faC yhEjlhp354/LaqPWkL4efg4/TIwPvOayphoMiy9TyqpawSjAYgDvOR3x7DO62c4hrmOx IqsQ== X-Gm-Message-State: AOAM531suQ2ZiPHOimGnIFmO2SKUdKdjb24YlEn1k17tqVJ0nm+lb9M+ XufNzczvQgChR0KQwXJ2fGfbForblF8Rz/FaOurazw== X-Google-Smtp-Source: ABdhPJwItxbkVp5l3S4sVv5L5p6m6OcrDlyJ9HNCuUjJgAORrTajFEr+f7dOofD6bYEpqh2xngBMcGIYlMA35D31J2c= X-Received: by 2002:ac2:46d4:: with SMTP id p20mr11022767lfo.299.1608761291314; Wed, 23 Dec 2020 14:08:11 -0800 (PST) MIME-Version: 1.0 References: <20201217034356.4708-1-songmuchun@bytedance.com> <20201217034356.4708-3-songmuchun@bytedance.com> In-Reply-To: <20201217034356.4708-3-songmuchun@bytedance.com> From: Shakeel Butt Date: Wed, 23 Dec 2020 14:08:00 -0800 Message-ID: Subject: Re: [PATCH v5 2/7] mm: memcontrol: convert NR_ANON_THPS account to pages To: Muchun Song Cc: Greg Kroah-Hartman , rafael@kernel.org, Alexey Dobriyan , Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , Hugh Dickins , Roman Gushchin , Sami Tolvanen , Feng Tang , Neil Brown , Joonsoo Kim , Randy Dunlap , LKML , linux-fsdevel , Linux MM , Cgroups Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 16, 2020 at 7:45 PM Muchun Song wrote: > > Currently we use struct per_cpu_nodestat to cache the vmstat > counters, which leads to inaccurate statistics expecially THP *especially > vmstat counters. In the systems with hundreads of processors *hundreds > it can be GBs of memory. For example, for a 96 CPUs system, > the threshold is the maximum number of 125. And the per cpu > counters can cache 23.4375 GB in total. > > The THP page is already a form of batched addition (it will > add 512 worth of memory in one go) so skipping the batching > seems like sensible. Although every THP stats update overflows > the per-cpu counter, resorting to atomic global updates. But > it can make the statistics more accuracy for the THP vmstat > counters. > > So we convert the NR_ANON_THPS account to pages. This patch > is consistent with 8f182270dfec ("mm/swap.c: flush lru pvecs > on compound page arrival"). Doing this also can make the unit > of vmstat counters more unified. Finally, the unit of the vmstat > counters are pages, kB and bytes. The B/KB suffix can tell us > that the unit is bytes or kB. The rest which is without suffix > are pages. > > Signed-off-by: Muchun Song I agree with the motivation behind this patch but I would like to see some performance numbers in the commit message. We might agree to pay the price but at least we will know what exactly that cost is. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shakeel Butt Subject: Re: [PATCH v5 2/7] mm: memcontrol: convert NR_ANON_THPS account to pages Date: Wed, 23 Dec 2020 14:08:00 -0800 Message-ID: References: <20201217034356.4708-1-songmuchun@bytedance.com> <20201217034356.4708-3-songmuchun@bytedance.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PoQlpaNI1/l22p0KY/MaQ96Dou9p/HLpoR9DVa4LJh8=; b=giGTxA/mxQx+XNfe8QbMHFkMxauB+o9JgajRnbIVQvV2WUIsFUTtYQiZimQfDBK4Si AueOX8SxNXBi/ULV8E5WHBMbPVvm4KL2Xf3G7gUH2RlljAPls4Gg7nODbKM1xcqER6cX a0MgrXFP51furYSyTt8rCXnmWC0s2wGW7AiJRcPYcknhrh70u2WQRz9FRotvdlwfOsae 463WoX6OLSTIdNM88A2GE2UO76k+JjJ5+1vj/d6qYCbfpkc3l+eEkk4eSx1yyx0YMPKV 6f2J8wtixvO9Pg5Xmn0vpCr09CuRdNN2E9buWaf55xaky+TKUJAzS7ERK2fdHzdYU4p8 sC8g== In-Reply-To: <20201217034356.4708-3-songmuchun@bytedance.com> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Muchun Song Cc: Greg Kroah-Hartman , rafael@kernel.org, Alexey Dobriyan , Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , Hugh Dickins , Roman Gushchin , Sami Tolvanen , Feng Tang , Neil Brown , Joonsoo Kim , Randy Dunlap , LKML , linux-fsdevel , Linux MM , Cgroups On Wed, Dec 16, 2020 at 7:45 PM Muchun Song wrote: > > Currently we use struct per_cpu_nodestat to cache the vmstat > counters, which leads to inaccurate statistics expecially THP *especially > vmstat counters. In the systems with hundreads of processors *hundreds > it can be GBs of memory. For example, for a 96 CPUs system, > the threshold is the maximum number of 125. And the per cpu > counters can cache 23.4375 GB in total. > > The THP page is already a form of batched addition (it will > add 512 worth of memory in one go) so skipping the batching > seems like sensible. Although every THP stats update overflows > the per-cpu counter, resorting to atomic global updates. But > it can make the statistics more accuracy for the THP vmstat > counters. > > So we convert the NR_ANON_THPS account to pages. This patch > is consistent with 8f182270dfec ("mm/swap.c: flush lru pvecs > on compound page arrival"). Doing this also can make the unit > of vmstat counters more unified. Finally, the unit of the vmstat > counters are pages, kB and bytes. The B/KB suffix can tell us > that the unit is bytes or kB. The rest which is without suffix > are pages. > > Signed-off-by: Muchun Song I agree with the motivation behind this patch but I would like to see some performance numbers in the commit message. We might agree to pay the price but at least we will know what exactly that cost is.