Permalink
Browse files

linux: increase memcg ids to 32bit for x86_64

  • Loading branch information...
snajpa authored and aither64 committed Sep 24, 2018
1 parent 0c17fe3 commit 87cd90ab99b5f4d527d3b33adfda13550cb8413a
@@ -251,6 +251,7 @@ with lib;
EXPERT y
CHECKPOINT_RESTORE y
CFS_BANDWIDTH y
MEMCG_32BIT_IDS y
'';
};
@@ -19,6 +19,10 @@ in
name = "010-allow_mknod";
patch = ./patches + "/${name}.patch";
}
rec {
name = "020-cgroup_increase_max_css_id_to_32_bit_int";
patch = ./patches + "/${name}.patch";
}
# AppArmor patches
rec {
@@ -0,0 +1,41 @@
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6c6fb116e925..b5f02b156713 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -73,8 +73,13 @@ struct mem_cgroup_reclaim_cookie {
#ifdef CONFIG_MEMCG
+#if defined(__x86_64__) && defined(MEMCG_32BIT_IDS)
+#define MEM_CGROUP_ID_SHIFT 32
+#define MEM_CGROUP_ID_MAX INT_MAX
+#else
#define MEM_CGROUP_ID_SHIFT 16
#define MEM_CGROUP_ID_MAX USHRT_MAX
+#endif
struct mem_cgroup_id {
int id;
diff --git a/init/Kconfig b/init/Kconfig
index 041f3a022122..1e71f377a5a8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -678,6 +678,18 @@ config MEMCG_SWAP_ENABLED
select this option (if, for some reason, they need to disable it
then swapaccount=0 does the trick).
+config MEMCG_32BIT_IDS
+ bool "Use 32 bit IDs"
+ depends on MEMCG && X86_64
+ default n
+ help
+ Extends the default limit of max 65536 memory cgroups to
+ 2147483647. This may cause an increase of bucket_order in
+ mm/workingset.c, having TODO consequences.
+
+ See https://lore.kernel.org/patchwork/patch/690171/ for original
+ reasoning behind 16 bit limit.
+
config BLK_CGROUP
bool "IO controller"
depends on BLOCK

0 comments on commit 87cd90a

Please sign in to comment.