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.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 75E70C38A2A for ; Thu, 7 May 2020 20:35:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 329BE208CA for ; Thu, 7 May 2020 20:35:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="r54QaoLh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 329BE208CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D001B900004; Thu, 7 May 2020 16:35:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB0FB900002; Thu, 7 May 2020 16:35:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEDF4900004; Thu, 7 May 2020 16:35:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id A8D7F900002 for ; Thu, 7 May 2020 16:35:06 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6D2474995E6 for ; Thu, 7 May 2020 20:35:06 +0000 (UTC) X-FDA: 76791077412.12.shape62_66bf9e198d235 X-HE-Tag: shape62_66bf9e198d235 X-Filterd-Recvd-Size: 4578 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 May 2020 20:35:05 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id 23so7687152qkf.0 for ; Thu, 07 May 2020 13:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RSDWBO3KlSH7VUaml385yztVrt94O/2spKycJW0cj/0=; b=r54QaoLh54AUaLYcMXfF56LEl3r+ooemYCoqO7ird14qYPBgk+62dOPtF7vzatUcbV TI3dAf4vwvc6fqdSnpT5VVVntfLPsbm7TOVZwgePR0+8l471+2W99dDqiUxzazExetKX 2D04O4ZoLBnVFXEgZRHkSXONB2MPOpGWxoxumdV8WAdHwDr1mA7o051gdl5p4kl9iJ0K aRNRtGRMR6m3YiPGHP6X4eXqSXxiJDR3uImh+palqnnsrf1bwQuO/N0Ob+junxtbcIxB eyX0IXQP/lqCC0vmcAy9nERkERqWEpc0q4jOmLMsWsFillX71G0FWZTWqr+V5p9eNMZN PSNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RSDWBO3KlSH7VUaml385yztVrt94O/2spKycJW0cj/0=; b=QYq9kYkmu0vvRaNxWMvzrihGbUQp9wImf4pOwTUIY2KFyKEb3Hg0yxDpl8R4GF9Yfu ZeJcDwCT9j4mY6/ztleq12Ozf7MEZiHu4B5ltRb60dy3C3O1bsguMvcsdzZD2wOfQiYE +jFCVcCX0sFv5tNh1YS1HUf9TVzV2Sj0PPr0uhqDaoScGp+GcYuybHOVZ8sKJFR4nLm7 jbxSmHtoB0ACNVVoKcEL/guey2qyhDaAjK2uFTJi0wVoO/2CUoG0pwaxDOSu5cYQSPIv 1iuYodiJUeKpjcQQyJLLLSRJZ2ahDr0H8StwIfdn87HAm/bxj+3W7dNBORDv7tkERvwO Pk4A== X-Gm-Message-State: AGi0PuZSjrZYFo6tl8Jikl6anOIccqaZmdW3SM2zgVW417t6wcCRcLd4 uLjnlywrvgXrzMqr531SE39vPw== X-Google-Smtp-Source: APiQypJnQGp+W8vdB4wl6qofgeQ17bUrjsLYFEjiibo3uV4je5mhYeTV9b+raRIejY0clyGjHc0k7A== X-Received: by 2002:a37:82c1:: with SMTP id e184mr17283899qkd.186.1588883705299; Thu, 07 May 2020 13:35:05 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id 124sm5220016qkn.73.2020.05.07.13.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 13:35:04 -0700 (PDT) Date: Thu, 7 May 2020 16:34:49 -0400 From: Johannes Weiner To: Roman Gushchin Cc: Andrew Morton , Michal Hocko , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 02/19] mm: memcg: prepare for byte-sized vmstat items Message-ID: <20200507203449.GB161043@cmpxchg.org> References: <20200422204708.2176080-1-guro@fb.com> <20200422204708.2176080-3-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422204708.2176080-3-guro@fb.com> 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, Apr 22, 2020 at 01:46:51PM -0700, Roman Gushchin wrote: > To implement per-object slab memory accounting, we need to > convert slab vmstat counters to bytes. Actually, out of > 4 levels of counters: global, per-node, per-memcg and per-lruvec > only two last levels will require byte-sized counters. > It's because global and per-node counters will be counting the > number of slab pages, and per-memcg and per-lruvec will be > counting the amount of memory taken by charged slab objects. > > Converting all vmstat counters to bytes or even all slab > counters to bytes would introduce an additional overhead. > So instead let's store global and per-node counters > in pages, and memcg and lruvec counters in bytes. > > To make the API clean all access helpers (both on the read > and write sides) are dealing with bytes. > > To avoid back-and-forth conversions a new flavor of helpers > is introduced, which always returns values in pages: > node_page_state_pages() and global_node_page_state_pages(). > > Actually new helpers are just reading raw values. Old helpers are > simple wrappers, which perform a conversion if the vmstat items are > in bytes. Because at the moment no one actually need bytes, > there are WARN_ON_ONCE() macroses inside to warn about inappropriate > use cases. > > Thanks to Johannes Weiner for the idea of having the byte-sized API > on top of the page-sized internal storage. > > Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner