Message ID | 20230112155326.26902-2-laoar.shao@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 DD26EC61DB3 for <linux-mm@archiver.kernel.org>; Thu, 12 Jan 2023 15:53:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 685F68E0003; Thu, 12 Jan 2023 10:53:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 524F28E0001; Thu, 12 Jan 2023 10:53:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39E408E0003; Thu, 12 Jan 2023 10:53:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2289B8E0001 for <linux-mm@kvack.org>; Thu, 12 Jan 2023 10:53:37 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EF6C4A094A for <linux-mm@kvack.org>; Thu, 12 Jan 2023 15:53:36 +0000 (UTC) X-FDA: 80346592032.03.69F5537 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 51CE84001B for <linux-mm@kvack.org>; Thu, 12 Jan 2023 15:53:35 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=S4nLopOs; spf=pass (imf27.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.160.172 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673538815; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OeqvHlFMdqUrdKwM3stpBCHG4LxLYAKLvc5cbQKfD2M=; b=jQa9clZunA8mgnGUIQOjN3I6NVejK67nQjjYQIUrmJrgYemoRslO79XSUgL4SGapOcDAM8 0NKiEepkH/CWxQNGzFzKw5jspcOIjpPUOCV/C8U07amuT6Vf8n/pRJF5nowT2C0DoyMjIa fB7UOm0fb7cGWwG5fW/75Exra+Vk1fA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=S4nLopOs; spf=pass (imf27.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.160.172 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673538815; a=rsa-sha256; cv=none; b=4QwkKBhueXc5O9SN6EOA0YGUVWOsES6T8S4CoRpiiD4VtCTMFSM+MNNHaFY0wJXpDHvxbG isW2K2uB/gg1myg0L+z+B6uXM7InZcj3GyUIFxsr4xH7J7acWhClqlNUVegXctL88OcZby tjQEm7LLRgfX6iWgCltVdhjvCEqCL/8= Received: by mail-qt1-f172.google.com with SMTP id jr10so9499939qtb.7 for <linux-mm@kvack.org>; Thu, 12 Jan 2023 07:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OeqvHlFMdqUrdKwM3stpBCHG4LxLYAKLvc5cbQKfD2M=; b=S4nLopOsJYZ3zGIfDTyNZtVttayMeAqM2OAGWJeYz+rJMZVqUtVZ0qeVdz0pGGdEYp RzXgIUgsGXuNW8ou5ahVgC9fDgvc/45xslOlfcZli/PwOeMzS+n1kz+fmj3tjM/kLFtc nb4GiTTMVuRQ1ZWPYviO0Uist+d648cnZJPgSW46ZSvXWmr8vzq9TZ6460qWupRfItmj QKGQLPzzCq/dWgpurqXSuDZFF9iwxaklOhCOG10RsQ45JSoQ++tBJCXDzXdGERYUaad8 OIIXmK+OLBSqpMmBhOFcKxnWNUTcRJNYwEm/1BdWY4tAKYsaLSIrvLhwbcTxUT0bgNvL vtiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OeqvHlFMdqUrdKwM3stpBCHG4LxLYAKLvc5cbQKfD2M=; b=kGSDMRG1sUv6+4UzJ/9N42pDyYICT/8b5fXYQ4xkaOqMEh0X7NSv1ZzbGfdT91RKg4 tI5r8UxXCh0pY3/A0Xl1T+S1rSa1X49GYsH+zFSMNuuOLESURaPTyBN06hsWvYH6x9Iy TIOU/aWeUnNH8gUiAA9A/zaD9UANCpMZyeJXof+zEl2KC72DQ7bvG/31+AWwpT5auAjK iy509amkI59HZaen4eq1DHW4sVyOCOdoaJWSGfDeBaNKFmXjAwqNqRSTQrDMHvFFT3+y FFyJ4qX9FibDASv1ZZXPtqpunqIEXnB+YdHs6rVmGbfYWaFzckGSQfl0dbeKcmaHk1o4 oFnQ== X-Gm-Message-State: AFqh2koIIn56zg3YIN5HabJfxspy0gpnlBUrqOhHZP5p+lvmHnnZpRPK 9xD9gTNms4PkOZOVbYH2nl0= X-Google-Smtp-Source: AMrXdXsWmJxHSdOEBgnVEWIwQ0w62GOgHxRERmvpZuOPy7H7cm6CcasScRmQoJH25sfjpEi+fxKE+Q== X-Received: by 2002:ac8:12ca:0:b0:3a8:2d6:521e with SMTP id b10-20020ac812ca000000b003a802d6521emr15089349qtj.37.1673538814596; Thu, 12 Jan 2023 07:53:34 -0800 (PST) Received: from vultr.guest ([173.199.122.241]) by smtp.gmail.com with ESMTPSA id l17-20020ac848d1000000b003ab43dabfb1sm9280836qtr.55.2023.01.12.07.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:53:33 -0800 (PST) From: Yafang Shao <laoar.shao@gmail.com> To: 42.hyeyoo@gmail.com, vbabka@suse.cz, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, tj@kernel.org, dennis@kernel.org, cl@linux.com, akpm@linux-foundation.org, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, roman.gushchin@linux.dev Cc: linux-mm@kvack.org, bpf@vger.kernel.org, Yafang Shao <laoar.shao@gmail.com>, Vasily Averin <vvs@openvz.org> Subject: [RFC PATCH bpf-next v2 01/11] mm: percpu: count memcg relevant memory only when kmemcg is enabled Date: Thu, 12 Jan 2023 15:53:16 +0000 Message-Id: <20230112155326.26902-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230112155326.26902-1-laoar.shao@gmail.com> References: <20230112155326.26902-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 5gpyj984o5wnnshi5rwk9z8basziigmg X-Rspamd-Queue-Id: 51CE84001B X-HE-Tag: 1673538815-560762 X-HE-Meta: U2FsdGVkX1+Lq1ThZJa/5leXkVRbzLoNYM4tetwuSr12IRHWKNSFx+HhZS6bSnS1yJ2bttbKZAxhQ8QeJnJ6iL0ElgxLbZcISwLX4F5wk4LePjcpNgN7ZKg867vi66OxaeF+2MUmwHBDGTXJzu7ZZVBPTdu+8xLtVH27WbZzFkjm1tUescpc4Pt27WzWfdpTYPP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linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
mm, bpf: Add BPF into /proc/meminfo
|
expand
|
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index 70b1ea2..2a95b1f 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -4,6 +4,7 @@ #include <linux/types.h> #include <linux/percpu.h> +#include <linux/memcontrol.h> /* * pcpu_block_md is the metadata block struct. @@ -125,7 +126,8 @@ static inline size_t pcpu_obj_full_size(size_t size) size_t extra_size = 0; #ifdef CONFIG_MEMCG_KMEM - extra_size += size / PCPU_MIN_ALLOC_SIZE * sizeof(struct obj_cgroup *); + if (!mem_cgroup_kmem_disabled()) + extra_size += size / PCPU_MIN_ALLOC_SIZE * sizeof(struct obj_cgroup *); #endif return size * num_possible_cpus() + extra_size;
The extra space which is used to store the obj_cgroup membership is only valid when kmemcg is enabled. The kmemcg can be disabled via the kernel parameter "cgroup.memory=nokmem" at runtime. This helper is also used in non-memcg code, for example the tracepoint, so we should fix it. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Vasily Averin <vvs@openvz.org> --- mm/percpu-internal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)