Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2726153lqt; Mon, 22 Apr 2024 22:19:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3v9TRYwVMX8duWWXGJDapQUy2vsbZqz1onko+r3xdX1lKFH9TV93Q1C7xn/grhBlUxXIhjiR1SL8AYDcloZvl9ZM5xnN+hYUqjrFcbQ== X-Google-Smtp-Source: AGHT+IEEto6+CekdLsojW9YSEvNVgk741aC8gTfHdHYJeucMqQ0sKOSlQeXkf0R6vAREVgYLWpBz X-Received: by 2002:a17:907:9450:b0:a55:77fa:80d7 with SMTP id dl16-20020a170907945000b00a5577fa80d7mr1984452ejc.8.1713849545304; Mon, 22 Apr 2024 22:19:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713849545; cv=pass; d=google.com; s=arc-20160816; b=li7V9mV/ilXnbkPxUg7Y3Ho6bat0vJ+DtsezH1GaJGxgrfXwgDlhe/0LoZDKJVDf1G 97Fo76bgYFOatG7iLivXKWTXdbK6f5kuMNNzuPTzGDy8YQAMe6QXcyvOrTvgi2T9Bf6L lnEOTeIycEFsEfCKcwgz+ni2OAgJAtyRJ/j90K3k0qQwJhg6rlD1Kne+Qzl334NCyUWZ DgkNnkgFw3P0wuZx8pHZNRAOc4N1DTICsbKbBAK2QcglhtdJRB3SBuG4ztiqmcUHKbrM /GjZD9X/L7O37aPPyPHoDNcfGJG8+Zg+q7n8sHuNQHLpTSe8za1WRpQMgNDYZ5A3Z54F IZmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=u+Gs6LB363taYfjAOAQVCNufxH8UGDdaQui3/WUq4mQ=; fh=RT6qUd/cFk7mA1daRZyPKZ73SkJUv705B/3NiEK9oSU=; b=pV/5zgvE8+IbaqFXzFBEZ+1y/PfWlUi1+wKPF0ZQTXaeVq42YgdUFsCkczhYyEpYjy ThLCguPwt9QEFO/XfjYrFg85p8cuuP2yHqkYHq9lTmbOYzQN3OIYt/u7k0gVgAo1fIFB KVY008myYR1azy6y6WEOjUY1wpEMbe3JQVih18XjIBYTJW9eZTN54h/O5KlD9kt5VOv2 /8vZsrr+hkBzyk32/c5I7dN0MPXzzSI8KdNqQpbJKDJnDGVBTV8gK0eLsxTOLpmOMvn+ XVRae/+gwSXOFuL+DKj6jlFcRG1tTQkhPYNtHhOjUI8iocLZJ1clvN2stYSP6XNqnmlp Cvmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bBLq3m27; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-154520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hp15-20020a1709073e0f00b00a55b38ce6f0si2440850ejc.639.2024.04.22.22.19.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 22:19:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bBLq3m27; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-154520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C65891F22283 for ; Tue, 23 Apr 2024 05:19:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 153C5208A8; Tue, 23 Apr 2024 05:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bBLq3m27" Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E8C91B966 for ; Tue, 23 Apr 2024 05:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713849537; cv=none; b=ZXKy92O+FdNh7ynmz/1z0965outbwlB/ewMrjb1v4vFlAriyEHmWpRjsg/2bZMzEEwASzsClGgqhS9ua23EZ/zTvkbxIZa34Alkalh8tZxJc96KgQmsr7I+4Vxi3VyhOZtRrYyC/bhQAqrH3+RoekI5P88nsCV2ZGtPFsI/tImY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713849537; c=relaxed/simple; bh=6djTsqkTarzrhTV+cox9vcQYxKM+8sUQh6gW5TSFx9Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bae1hQEG1fptfd2DEIfBWL2qZA7DKdJJoegmVM/VOO7lIInDza08hVB4DumspUD2BgYVELcsdVqmXxPIaCsOWZ55t+UOa2N7WiSPnwTyBgn8X2of0mk9dpiX7+3clQe9acLfZxm/iczDRR6bgvU3PT3qE/zzj7rbPe9kUOaxVMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=bBLq3m27; arc=none smtp.client-ip=91.218.175.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713849532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=u+Gs6LB363taYfjAOAQVCNufxH8UGDdaQui3/WUq4mQ=; b=bBLq3m27Tn/gftsxnQ+b/3UOGu62ExpEaLl5AhSr/FXbLt9NTj4ccNhUHecUwNpOh6XBQl n0H2Hl4cbxfmZ7MnrEY9xq9LIdVxqQUzUOpOVSCjtO78dntHP4vMKox+oIqGghAnd8OgbE bj27r8Gr7uZCwrCrhcxfB7T8O9c903A= From: Shakeel Butt To: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] memcg: reduce memory consumption by memcg stats Date: Mon, 22 Apr 2024 22:18:22 -0700 Message-ID: <20240423051826.791934-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Most of the memory overhead of a memcg object is due to memcg stats maintained by the kernel. Since stats updates happen in performance critical codepaths, the stats are maintained per-cpu and numa specific stats are maintained per-node * per-cpu. This drastically increase the overhead on large machines i.e. large of CPUs and multiple numa nodes. This patch series tries to reduce the overhead by at least not allocating the memory for stats which are not memcg specific. Shakeel Butt (4): mm: rearrange node_stat_item to put memcg stats at start memcg: reduce memory for the lruvec and memcg stats memcg: use proper type for mod_memcg_state memcg: restrict __mod_memcg_lruvec_state to memcg stats include/linux/memcontrol.h | 25 +++++++++++++------------ include/linux/mmzone.h | 29 +++++++++++++++++------------ mm/memcontrol.c | 12 +++++++----- mm/vmstat.c | 24 ++++++++++++------------ 4 files changed, 49 insertions(+), 41 deletions(-) -- 2.43.0