diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index eee88ebbcf35b77a5224e43e214190b3bf056f7f..34ef2ad0ad1e8889aacca074ccd5519d59be6f9b 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -455,7 +455,7 @@ struct mm_struct { spinlock_t ioctx_lock; struct kioctx_table __rcu *ioctx_table; #endif -#ifdef CONFIG_MEMCG +#ifdef CONFIG_MM_OWNER /* * "owner" points to a task that is regarded as the canonical * user/owner of this mm. All of the following must be true in diff --git a/init/Kconfig b/init/Kconfig index 7334599eef536d84ba95b00159ed98f422cf240a..c05347a29ca4d27bd2f50d8a3f89840d8dd36295 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -704,6 +704,7 @@ config MEMCG bool "Memory controller" select PAGE_COUNTER select EVENTFD + select MM_OWNER help Provides control over the memory footprint of tasks in a cgroup. diff --git a/kernel/exit.c b/kernel/exit.c index c739d83cba98829de1ad4eb933efb4a9b33e68dd..2a32d32bdc03d3d88c04917082f5c2d63f07b816 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -330,7 +330,7 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) } } -#ifdef CONFIG_MEMCG +#ifdef CONFIG_MM_OWNER /* * A task is exiting. If it owned this mm, find a new owner for the mm. */ @@ -416,7 +416,7 @@ void mm_update_next_owner(struct mm_struct *mm) task_unlock(c); put_task_struct(c); } -#endif /* CONFIG_MEMCG */ +#endif /* CONFIG_MM_OWNER */ /* * Turn us into a lazy TLB process if we diff --git a/kernel/fork.c b/kernel/fork.c index e17aaa526c593a0af11df10f84aa7df2a021e60a..be67a4aa10631bf6936c53e4b52cf059d7576875 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -962,7 +962,7 @@ static void mm_init_aio(struct mm_struct *mm) static __always_inline void mm_clear_owner(struct mm_struct *mm, struct task_struct *p) { -#ifdef CONFIG_MEMCG +#ifdef CONFIG_MM_OWNER if (mm->owner == p) WRITE_ONCE(mm->owner, NULL); #endif @@ -970,7 +970,7 @@ static __always_inline void mm_clear_owner(struct mm_struct *mm, static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) { -#ifdef CONFIG_MEMCG +#ifdef CONFIG_MM_OWNER mm->owner = p; #endif } diff --git a/mm/Kconfig b/mm/Kconfig index 0434aef47b44c1452f29917decdc1809cd26a1e7..253fb184c8f8d9a281aa2288a65370bb6558529e 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -299,6 +299,10 @@ config VIRT_TO_BUS deprecated interface virt_to_bus(). All new architectures should probably not select this. +config MM_OWNER + bool "Enable the ownership the mm owner" + help + This option enables mm_struct's to have an owner. config MMU_NOTIFIER bool diff --git a/mm/debug.c b/mm/debug.c index 362ce581671e7551c32b6bc1d93e06bebcf41ec5..2da184b16bce0f088cef07c02b0ce640c8cc9c7d 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -129,7 +129,7 @@ void dump_mm(const struct mm_struct *mm) #ifdef CONFIG_AIO "ioctx_table %px\n" #endif -#ifdef CONFIG_MEMCG +#ifdef CONFIG_MM_OWNER "owner %px " #endif "exe_file %px\n"