Skip to content

Commit

Permalink
cgroup: increase max memory cgroup id for x86_64
Browse files Browse the repository at this point in the history
On a shared many-core machine with a lot of memory and long uptimes, it is
common to hit the USHRT_MAX id limit for pinned memory cgroup states.
  • Loading branch information
snajpa committed Sep 23, 2018
1 parent 96158f3 commit 6bbe934
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/linux/memcontrol.h
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions init/Kconfig
Expand Up @@ -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
Expand Down

0 comments on commit 6bbe934

Please sign in to comment.