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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5E6BC433F5 for ; Thu, 23 Dec 2021 17:44:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1897B6B0072; Thu, 23 Dec 2021 12:44:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 139D56B0073; Thu, 23 Dec 2021 12:44:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 000616B0074; Thu, 23 Dec 2021 12:44:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id E04A16B0072 for ; Thu, 23 Dec 2021 12:44:40 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A05888249980 for ; Thu, 23 Dec 2021 17:44:40 +0000 (UTC) X-FDA: 78949783920.18.EBDD00B Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf15.hostedemail.com (Postfix) with ESMTP id 36743A003E for ; Thu, 23 Dec 2021 17:44:32 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id bu9so13912900lfb.7 for ; Thu, 23 Dec 2021 09:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kCoqrpzyBTBAFkNQrSL2lVl577ZYSazg2YApIhci1P8=; b=aioqg8kANp4+1uEKiPqYO+5fpB6qLkCWQE0myDscDMWPzrYaWPb3VcyvoNkHLs8w4O 8UdnMsOLsUZOZ5qMWk1T9tKCPyh/JiIGsOfPNvARKvuJN29Z/loSRdlHOW2T5F3Yu5mU 37qnWrsJzPSQiI6zrZlH9FyjNWKG+MkTqP5/8pgnSb5HlEduDtzE5bmDU3lX6qfCLzwm fcthTEfWb18Hsk6xt/4uIjgCktjTT7Afh/OV3l81d8ewNE5FnaGjg3NIB/BbGWqMW702 2ch7M8Y77CnA9ITiNWeoAl3vVnZfLN9DfyIYR3+Jow67d9JtXMXBR8o+d5y1yDszkWBx wY/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kCoqrpzyBTBAFkNQrSL2lVl577ZYSazg2YApIhci1P8=; b=XoEFiXEFbyZ9/7EOvBZkPseFOXrM5UewBcjAeUcpNVgkdOmrj0QBuO67qrlZJl4o8Y faFKP+F5ymHrzhQWKKgij9AWIMvu1t1n3AAN43EzCj4EN9DmMh37L0pk2J9mmA2YeSXD kNM1gpPHUrnlU3BM8i5vCnh8zjEDekF49rY32lSw3G4xc2ocAGZ1L0vg/EtlnRAzdBpp YhoYsszpWPi60qWhBK37DtjYM0jE85eJ4s30BRK+3liIR+2dcRQljQVts154pWk0VnHn aWJLYleYj2dvEL2zhoByvMJ0RUNRju7LhuWA6EKkbQnw4j0aXfWmbOjEVOvbVyiahabL a2gA== X-Gm-Message-State: AOAM5313ofmkxq2/lGWEhyZYHCKblI6eclbe8QYZL71CnTqIco732+Vz Wi608e1HBc1QjaIktlLLP+sj8Hc94jhBoCKT10S8Ng== X-Google-Smtp-Source: ABdhPJy25Zli9adXeJWapHOtWu1NDXAb0yFFA4Ygsp2oTCsoL5rExYDN/IoG7gZUh26uFgieRbiFcwrOJbwzhY3YL+Q= X-Received: by 2002:a05:6512:3d9e:: with SMTP id k30mr2478976lfv.184.1640281478363; Thu, 23 Dec 2021 09:44:38 -0800 (PST) MIME-Version: 1.0 References: <20211222052457.1960701-1-shakeelb@google.com> In-Reply-To: From: Shakeel Butt Date: Thu, 23 Dec 2021 09:44:26 -0800 Message-ID: Subject: Re: [PATCH v2] memcg: add per-memcg vmalloc stat To: Roman Gushchin Cc: Johannes Weiner , Michal Hocko , Muchun Song , Andrew Morton , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aioqg8kA; spf=pass (imf15.hostedemail.com: domain of shakeelb@google.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Queue-Id: 36743A003E X-Stat-Signature: ytccaes89ozgebphfxu4gomtsht8g8f9 X-Rspamd-Server: rspam04 X-HE-Tag: 1640281472-285614 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, Dec 22, 2021 at 6:03 PM Roman Gushchin wrote: > > On Tue, Dec 21, 2021 at 09:24:57PM -0800, Shakeel Butt wrote: > > The kvmalloc* allocation functions can fallback to vmalloc allocations > > and more often on long running machines. In addition the kernel does > > have __GFP_ACCOUNT kvmalloc* calls. So, often on long running machines, > > the memory.stat does not tell the complete picture which type of memory > > is charged to the memcg. So add a per-memcg vmalloc stat. > > > > Signed-off-by: Shakeel Butt > > > > --- > > Changelog since v1: > > - page_memcg() within rcu lock as suggested by Muchun. > > > > Documentation/admin-guide/cgroup-v2.rst | 3 +++ > > include/linux/memcontrol.h | 21 +++++++++++++++++++++ > > mm/memcontrol.c | 1 + > > mm/vmalloc.c | 5 +++++ > > 4 files changed, 30 insertions(+) > > > > diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst > > index 82c8dc91b2be..5aa368d165da 100644 > > --- a/Documentation/admin-guide/cgroup-v2.rst > > +++ b/Documentation/admin-guide/cgroup-v2.rst > > @@ -1314,6 +1314,9 @@ PAGE_SIZE multiple when read back. > > sock (npn) > > Amount of memory used in network transmission buffers > > > > + vmalloc (npn) > > + Amount of memory used for vmap backed memory. > > + > > It's a bid sad that this counter will partially intersect with others > (e.g. percpu and stack), but I don't see how it can be easily fixed. I checked those again. For vmap based stack we do vmalloc() without __GFP_ACCOUNT and charge the stack page afterwards with memcg_kmem_charge_page() interface. I think we do the same for percpu as well i.e. not use GFP_ACCOUNT for underlying memory but later use objcg infrastructure to charge at finer grain. So, I think at least percpu and stack should not intersect with vmalloc per-memcg stat. > > But I agree that the counter is useful and worth adding. > > Acked-by: Roman Gushchin Thanks.