From patchwork Wed Sep 7 04:35:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12968429 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 95706ECAAD3 for ; Wed, 7 Sep 2022 04:35:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0E678D0002; Wed, 7 Sep 2022 00:35:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBDD36B0073; Wed, 7 Sep 2022 00:35:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D852C8D0002; Wed, 7 Sep 2022 00:35:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C767D6B0072 for ; Wed, 7 Sep 2022 00:35:57 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 98504AAB3D for ; Wed, 7 Sep 2022 04:35:57 +0000 (UTC) X-FDA: 79884026754.03.0845D15 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf31.hostedemail.com (Postfix) with ESMTP id 525A92008C for ; Wed, 7 Sep 2022 04:35:57 +0000 (UTC) Received: by mail-pj1-f74.google.com with SMTP id o14-20020a17090ab88e00b0020034a4415dso5937552pjr.6 for ; Tue, 06 Sep 2022 21:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date; bh=ARY6z7c/YNSdIuDysr3yMfPrF2u31pVSHbSH5GcWfeE=; b=q9iz05jUj6H8xeR7Sm+d7zjR+v2lZM1+/kobuusBNoE0JoCXsnK5bvzGtwyNvIi+8U GH0rPOO/xKYtM5rIULeimIKEZZVJeN/gEjimKq/+hEkeS7sgv9BRF1RCpPU7KRJNQYSM /IzUDL95+VcFL2q0Hl1EA+8A4hiMO8I4UOYJkfJk31lHrFMFpY3kU6ZhV5p0RvFXs2Fc UlZLfi/vZLQbZVH2VXXNbSO7/GoY43Xu+6nJQn00xcfl2xayw4LodDd3F6zHSD8U1xOT jmaT8lo9ciYyboax/cu4Uy4QhBL7yP5SMSve8KtYnM2oG0G9+Ws+S3Z7uRssba6RB5BT 8dcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date; bh=ARY6z7c/YNSdIuDysr3yMfPrF2u31pVSHbSH5GcWfeE=; b=HAQGy633DTuGVVEE+iOV7MmOeSoTFILFsqB9LnegQQb38a7KjlLCHpm4OqM1MYTnO6 ttWmd+wsDsTBOEuh0KkuX6yNh41X5Ndy6vuMtf1w9GsIm+LW5tPBSXDfIbkDdlt+ITKs /05C8ftiC3arnb5KdqjIEUsPePJTK2Vx16rKHIBfmVp1DXRl1AXSY0K+Bh0ZSoNgzLt3 qUzWu77daLd70QzhHfm3xUEoRx5EWlqdIaG4N3vGbVJlTp9WhYJsLoSGR4Zu2ZiROyy7 Xu/EKivQUhY23CNm1tWK/VpQaNzKhx1TwaKIElC+V1rCXpdY8qb928YxsGafgdYzZ/Cj op+g== X-Gm-Message-State: ACgBeo09gEEsDxhmRZgs7YihVR0fQHjFP6kWbznJItP4ocCvaAVeny1Q xLXNNDGyLYQScHe7+fULZz75xDHbS4mYew== X-Google-Smtp-Source: AA6agR4RN/+AWtypu7tKu3vEW1cNt2tGz6dzgwmT/rIEWRZ6fGu1/x0neVk1AwsgO1V3Ikni4DvzdVJzEwX3Vg== X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:262e]) (user=shakeelb job=sendgmr) by 2002:a63:525a:0:b0:42b:28a9:8a34 with SMTP id s26-20020a63525a000000b0042b28a98a34mr1724012pgl.269.1662525356139; Tue, 06 Sep 2022 21:35:56 -0700 (PDT) Date: Wed, 7 Sep 2022 04:35:34 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907043537.3457014-1-shakeelb@google.com> Subject: [PATCH 0/3] memcg: reduce memory overhead of memory cgroups From: Shakeel Butt To: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song Cc: Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662525357; a=rsa-sha256; cv=none; b=d80MipRJgwQSlwQxCI4FMP9UFMp86Owq8Gdxv2in2zHX+wJYqeRW83YYo5Ux8smza0bJSR RAPQkoAdUgePkBQpi+VMPNapU/XYHNr+XVsCYfsd8lEtD0HAyuGzJDoyfcZ5S2goqxtR4E 3aAK/L5tVULwiWrnhRZJy6iC6x3ot8g= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=q9iz05jU; spf=pass (imf31.hostedemail.com: domain of 3rB8YYwgKCGsbQJTNNUKPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--shakeelb.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3rB8YYwgKCGsbQJTNNUKPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662525357; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=ARY6z7c/YNSdIuDysr3yMfPrF2u31pVSHbSH5GcWfeE=; b=DkMODHq3meO11FuVQFzf7XAhhmqdFj0YA+tZdt5XH7TqFUCN8E+U478XtulA+tpeY3Y30u KjugIbxJwePzhaGaM1/Lvza+I8o8o+shEqHzdsiBxmli/VG3Y5kL4xXF2ZjoGvj5FuhTnH 3Dips013YfiLxqM0yPSsWC/tlz9g74Y= X-Stat-Signature: 1nwnzkt6gqxo7e6fpcpqxthyzfyqjpku X-Rspamd-Queue-Id: 525A92008C Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=q9iz05jU; spf=pass (imf31.hostedemail.com: domain of 3rB8YYwgKCGsbQJTNNUKPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--shakeelb.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3rB8YYwgKCGsbQJTNNUKPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1662525357-547491 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: Currently a lot of memory is wasted to maintain the vmevents for memory cgroups as we have multiple arrays of size NR_VM_EVENT_ITEMS which can be as large as 110. However memcg code uses small portion of those entries. This patch series eliminate this overhead by removing the unneeded vmevent entries from memory cgroup data structures. Shakeel Butt (3): memcg: extract memcg_vmstats from struct mem_cgroup memcg: rearrange code memcg: reduce size of memcg vmstats structures include/linux/memcontrol.h | 37 +--------- mm/memcontrol.c | 145 ++++++++++++++++++++++++++++--------- 2 files changed, 113 insertions(+), 69 deletions(-)