From: Yafang Shao <laoar.shao@gmail.com>
To: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com,
akpm@linux-foundation.org, viro@zeniv.linux.org.uk
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Yafang Shao <laoar.shao@gmail.com>, Aaron Lu <aaron.lu@intel.com>
Subject: [PATCH 1/4] mm, memcg: reduce size of struct mem_cgroup by using bit field
Date: Tue, 17 Dec 2019 06:29:16 -0500 [thread overview]
Message-ID: <1576582159-5198-2-git-send-email-laoar.shao@gmail.com> (raw)
In-Reply-To: <1576582159-5198-1-git-send-email-laoar.shao@gmail.com>
There are some members in struct mem_group can be either 0(false) or
1(true), so we can define them using bit field to reduce size. With this
patch, the size of struct mem_cgroup can be reduced by 64 bytes in theory,
but as there're some MEMCG_PADDING()s, the real number may be different,
which is relate with the cacheline size. Anyway, this patch could reduce
the size of struct mem_cgroup more or less.
Cc: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
include/linux/memcontrol.h | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index a7a0a1a5..612a457 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -229,20 +229,26 @@ struct mem_cgroup {
/*
* Should the accounting and control be hierarchical, per subtree?
*/
- bool use_hierarchy;
+ unsigned int use_hierarchy : 1;
/*
* Should the OOM killer kill all belonging tasks, had it kill one?
*/
- bool oom_group;
+ unsigned int oom_group : 1;
/* protected by memcg_oom_lock */
- bool oom_lock;
- int under_oom;
+ unsigned int oom_lock : 1;
- int swappiness;
/* OOM-Killer disable */
- int oom_kill_disable;
+ unsigned int oom_kill_disable : 1;
+
+ /* Legacy tcp memory accounting */
+ unsigned int tcpmem_active : 1;
+ unsigned int tcpmem_pressure : 1;
+
+ int under_oom;
+
+ int swappiness;
/* memory.events and memory.events.local */
struct cgroup_file events_file;
@@ -297,9 +303,6 @@ struct mem_cgroup {
unsigned long socket_pressure;
- /* Legacy tcp memory accounting */
- bool tcpmem_active;
- int tcpmem_pressure;
#ifdef CONFIG_MEMCG_KMEM
/* Index in the kmem_cache->memcg_params.memcg_caches array */
--
1.8.3.1
next prev parent reply other threads:[~2019-12-17 11:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 11:29 [PATCH 0/4] memcg, inode: protect page cache from freeing inode Yafang Shao
2019-12-17 11:29 ` Yafang Shao [this message]
2019-12-17 11:29 ` [PATCH 2/4] mm, memcg: introduce MEMCG_PROT_SKIP for memcg zero usage case Yafang Shao
2019-12-17 11:29 ` [PATCH 3/4] mm, memcg: reset memcg's memory.{min, low} for reclaiming itself Yafang Shao
2019-12-17 14:20 ` Chris Down
2019-12-18 1:13 ` Yafang Shao
2019-12-17 11:29 ` [PATCH 4/4] memcg, inode: protect page cache from freeing inode Yafang Shao
2019-12-18 2:21 ` Dave Chinner
2019-12-18 2:33 ` Yafang Shao
2019-12-18 17:53 ` Roman Gushchin
2019-12-19 1:45 ` Yafang Shao
2019-12-17 11:56 ` [PATCH 0/4] " Michal Hocko
2019-12-17 12:19 ` Yafang Shao
2019-12-17 16:54 ` Johannes Weiner
2019-12-18 1:17 ` Yafang Shao
2019-12-18 1:37 ` Andrew Morton
2019-12-18 1:51 ` Dave Chinner
2019-12-18 4:37 ` Johannes Weiner
2019-12-18 10:16 ` Dave Chinner
2019-12-18 21:38 ` Johannes Weiner
2019-12-19 2:04 ` Yafang Shao
2020-01-10 2:08 ` Dave Chinner
2019-12-18 17:27 ` Roman Gushchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1576582159-5198-2-git-send-email-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=aaron.lu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vdavydov.dev@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).