Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1941821rdb; Tue, 3 Oct 2023 06:03:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF0DcDAh57QCPqrb2dzCs9gNkkWIrEwU6lzj+JlwO7p16uBrEb5wbQVRg7evAEGYd5Flu0 X-Received: by 2002:a17:90a:b28b:b0:273:ed60:ad52 with SMTP id c11-20020a17090ab28b00b00273ed60ad52mr12019605pjr.37.1696338223691; Tue, 03 Oct 2023 06:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696338223; cv=none; d=google.com; s=arc-20160816; b=aSUozivXjZULIimydz+tUWQnLXxCldMXubzhgRR3zOgGqLmEeIZWlHmnLzvIuwIuvA UxiXzn5dLcx1949yDjpjlN7Q2/umZRZJ0bxPPLZENOZUih04b1FW6FLowNXlwdoZ0179 UzzGr5B9ndQFknUfwEGuWzFVjccocEyOGUJvTxtwNVsA1n1i2vbMcGB8+Uixeb0cee9V DgHQGGPiDeJr3FwgJ1DVgs2LYopegZcEC5lKbg5aWEuXte+c6rcQkMRC5D5fyNUS2geM PYU7wC+ExElB084qM9ocxmYzSAT4/vqWmvSRK7aBkFFlC0M0ofplYlG1uUwsAO1r5Qgh OFUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MCw89XvWZCHmndxFc4KWV08Rgyb0HbAqrU0uJncC/sk=; fh=fR83rYRmjowPahbmlebO6i5TQfUmrUE/1oFylNncLoQ=; b=KyZmnuCNlLrElDc1IHCMMwWZ5XtHTx/r4f9y3+JquResGty4lSQ1M3qusSa/yGkpNZ XgDD+dMxSniyhAi4lflFLUQYNAK79+5RSiYNZHminw+0jlwmWXKcAxCNKSOTvrdyzX/N Q8TC2Np20C4UiVg7uiC44m0mvyhVvkH0SKtEW9DTs5F8YssioGwIZ9MrMH0zMhH2Z+op RlfCKXiHNhODF7E1xxVO1zNJ3cKJus8axWSaJ0/UyZ1UNEkq1E5mZHM3n06nBUGLC3US dz24gQPFRNqFwi+54twBfkvwpdwrtaYrHj2oA4Ov7+71+wRFpV2YgE65mV4C78CoetE5 iHmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=R3x3+1WO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id mh6-20020a17090b4ac600b002736ff3cc79si11137291pjb.23.2023.10.03.06.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 06:03:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=R3x3+1WO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1C4E580DB9E2; Tue, 3 Oct 2023 06:03:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbjJCNDb (ORCPT + 99 others); Tue, 3 Oct 2023 09:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbjJCNDa (ORCPT ); Tue, 3 Oct 2023 09:03:30 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA36A1 for ; Tue, 3 Oct 2023 06:03:26 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-419b628e990so346361cf.0 for ; Tue, 03 Oct 2023 06:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1696338205; x=1696943005; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MCw89XvWZCHmndxFc4KWV08Rgyb0HbAqrU0uJncC/sk=; b=R3x3+1WOmaDwvO4JrHthVh4weHZSUqzDl0TSs7IdTMvdcrMY2l/F5vc2jbRGYNtBDE olUg2/H6b0x8/0Hzbpz3w0x6mznhxP2cpdDUK5loKE9er3KGsR/T10K1mUVtztBdJEpN tq4q1m0T5GdPIRjgnEb1to/4AnJMaMyxvBN7rMbEG81c5b4Pn6HxLLDTLmEzIVifhu0l x8eNyRWQNiICtcFjY/UkHxskFqKOe9BpuQbr3ayg0EeKcW1vjXVFU/gYa4kBdgT5uBW1 DrMHjfRZ1IWov8fzjIu1+nVGDCq21r/9lNmRLsPwIS1ztHEZCcMu8MOmPVnqjc3TCNbf jQkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696338205; x=1696943005; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MCw89XvWZCHmndxFc4KWV08Rgyb0HbAqrU0uJncC/sk=; b=nfienPnNcGb1/0FgqpCoYbhq9XXtnMlBsBd1H4P8/T5Es+WoxIbY9IFxFgFpStrux3 VZD56N3+mEGmd+X7eCqH5ulDMnK4/mPX4ce11XJBSW7xNikvbLLApZNUCfsRXqk3Yoxw cPGQl6GSNzi/rxikgmZKlzFTuLrP+enijhGDV9HEYwEnw1hSddwDMxFNQ5itnve2McEZ UDRsnhZYeAcEguuU/oiz/o8gDmpE64beqTjTQuNMwxu7cuTpx6dEFrXfKjQ34qzrHxA0 SAqgdwuu7ROnSsOR9BM3UQ8F5XDlu48dxn5dOl+37F0RFEwtn45asS0gkIBol6AWDGTx VAWg== X-Gm-Message-State: AOJu0Yyzi99QAKXNCxFzi2wYJ1ggebFGnLagduv9c4f0meUCLFganwDa 0ue5cEg0L1Fsee4aUuhtOswvuQ== X-Received: by 2002:ac8:7d44:0:b0:419:4c9d:8738 with SMTP id h4-20020ac87d44000000b004194c9d8738mr20418260qtb.46.1696338205642; Tue, 03 Oct 2023 06:03:25 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-3012-16a2-6bc2-2937.res6.spectrum.com. [2603:7000:c01:2716:3012:16a2:6bc2:2937]) by smtp.gmail.com with ESMTPSA id z5-20020ac87105000000b004197a3872f9sm416244qto.86.2023.10.03.06.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 06:03:25 -0700 (PDT) Date: Tue, 3 Oct 2023 09:03:24 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Andrew Morton , Shakeel Butt , Michal Hocko , Roman Gushchin , Muchun Song , Michal =?iso-8859-1?Q?Koutn=FD?= , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm: memcg: refactor page state unit helpers Message-ID: <20231003130324.GC17012@cmpxchg.org> References: <20230922175741.635002-1-yosryahmed@google.com> <20230922175741.635002-2-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922175741.635002-2-yosryahmed@google.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 03 Oct 2023 06:03:41 -0700 (PDT) On Fri, Sep 22, 2023 at 05:57:39PM +0000, Yosry Ahmed wrote: > memcg_page_state_unit() is currently used to identify the unit of a > memcg state item so that all stats in memory.stat are in bytes. However, > it lies about the units of WORKINGSET_* stats. These stats actually > represent pages, but we present them to userspace as a scalar number of > events. In retrospect, maybe those stats should have been memcg "events" > rather than memcg "state". > > In preparation for using memcg_page_state_unit() for other purposes that > need to know the truthful units of different stat items, break it down > into two helpers: > - memcg_page_state_unit() retuns the actual unit of the item. > - memcg_page_state_output_unit() returns the unit used for output. > > Use the latter instead of the former in memcg_page_state_output() and > lruvec_page_state_output(). While we are at it, let's show cgroup v1 > some love and add memcg_page_state_local_output() for consistency. > > No functional change intended. > > Signed-off-by: Yosry Ahmed That's a nice cleanup in itself. Acked-by: Johannes Weiner