Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1050437ybj; Thu, 7 May 2020 13:39:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJW7tzWLxnOjhTpb0Bch66BV+dI8R7kBWGCLJ3/BHYMMP1XvWeNyeI5b56Xn5WDO20LwbMC X-Received: by 2002:a50:b412:: with SMTP id b18mr13408365edh.42.1588883952160; Thu, 07 May 2020 13:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588883952; cv=none; d=google.com; s=arc-20160816; b=DBvBmv62H0nJ3EnNkFI9eMOd4dp29mS8JJxRH8bR1J2gmYVCbda1KJUwIzdwqv8b+7 JBy6ue4qtXlRvtZjp/jMvHdHK/K01fzVo4SmDcifC/1ClDw1mQzGFdzIEh5JhK64Orun 5WIdy8faLogKDx+JmFakaVlQIKWz02MTVmvJZA0ZcjWIFiWG5gEBeQJKYiWkgz+Yev0Q 9hb+a014hErLNXIK/G+XSpj5eQWbUtrp5ZMCo6jPBbjjT5ySUDzHmR0vC81nm/o4O89o U/+2XqWOrM9AnDh6xT8aVyjHEuriKfDanZ5iKT+qRKo7PpVajX1oaOY/I7Xp/xJjNGKM C6ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RSDWBO3KlSH7VUaml385yztVrt94O/2spKycJW0cj/0=; b=GvFWnwqAoQSkmHqHT9QuUWaOXnWCPv/T5v/8MJ2gbAcK/CUpLBZNqQ6RHxeN0ZDPU8 hPjsQe92FybMAyb986H4nlcQm7Sp6o4/R8q0nhhvTMiJnQY4+rJKLS+rAFgriu1Pt4wy qXYCaJCt6ZnVrWpBoqiBFaTHv1mjHmavKReD56cQ6e74N2eu3OP3Y4Z98BQnebcB1pyQ N+O9x7bqQleIjtigBXqKQhEZb7dZFilRcuvMPJG9LwCoYk0jT9NZ66raYDxUesR0Svzt QguOsG3EsssJkIPNLdmC9AbMZl+Y8MUsVuAhjG/s+NgT50H1GyZE5KceEdI3UjtlyEDV F3nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=r54QaoLh; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si3732310ejc.416.2020.05.07.13.38.49; Thu, 07 May 2020 13:39:12 -0700 (PDT) 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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=r54QaoLh; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726565AbgEGUfF (ORCPT + 99 others); Thu, 7 May 2020 16:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726218AbgEGUfE (ORCPT ); Thu, 7 May 2020 16:35:04 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0500EC05BD43 for ; Thu, 7 May 2020 13:35:06 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id b188so7623056qkd.9 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=FWv91soS55DtavNT3imYFGCc+crqSmTd3p+UolmJ/PmfkstqwChXRHbD+0CInVVcYr 0StpwgbGu8itgIe5JgPTiQyn7mQ05qTiboMgu8QzXIO/R84hMLPrDc0qWFlm+zKbaMLK Ec82vfywuHQpiXy3ecek+STvUhOOI5bO9jBWgvtoXlncHURxyEZ1V6BWp3gA75frT7F2 avL7czDzeP7/PzGB/8K8BL+GrTcU2ED058upx6OXx2tNLMnzy1SzbpcrOflmvnIKhy2t 9t46d+w2reXqgMbr3EiIx0RK1Ymw8K1iJG7yIx8k1VpCJ2rIuKzPbPR7NOeYjA8zPeIy I4ig== X-Gm-Message-State: AGi0PuZaY3EkaNhfausflsN/yXMNY9YXJvZ4/6f/v+j6R3+JJY+1YYIa 91GP/XLO7I81HFd2CxPcFu7G0Q== 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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