提交 16313919 编写于 作者: D Ding Tianhong 提交者: Yang Yingliang

ascend: mm: add an owner for mm_struct

ascend inclusion
category: feature
bugzilla: NA
CVE: NA

-------------------------------------------------

The mm->owner is only used for MEMCG currently, but the ascend share
pool features will use it later, so make it to a general features and
select it for CONFIG_MEMCG.
Signed-off-by: NTang Yizhou <tangyizhou@huawei.com>
Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 e7d1be06
...@@ -453,7 +453,7 @@ struct mm_struct { ...@@ -453,7 +453,7 @@ struct mm_struct {
spinlock_t ioctx_lock; spinlock_t ioctx_lock;
struct kioctx_table __rcu *ioctx_table; struct kioctx_table __rcu *ioctx_table;
#endif #endif
#ifdef CONFIG_MEMCG #ifdef CONFIG_MM_OWNER
/* /*
* "owner" points to a task that is regarded as the canonical * "owner" points to a task that is regarded as the canonical
* user/owner of this mm. All of the following must be true in * user/owner of this mm. All of the following must be true in
......
...@@ -705,6 +705,7 @@ config MEMCG ...@@ -705,6 +705,7 @@ config MEMCG
bool "Memory controller" bool "Memory controller"
select PAGE_COUNTER select PAGE_COUNTER
select EVENTFD select EVENTFD
select MM_OWNER
help help
Provides control over the memory footprint of tasks in a cgroup. Provides control over the memory footprint of tasks in a cgroup.
......
...@@ -392,7 +392,7 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) ...@@ -392,7 +392,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. * A task is exiting. If it owned this mm, find a new owner for the mm.
*/ */
...@@ -478,7 +478,7 @@ void mm_update_next_owner(struct mm_struct *mm) ...@@ -478,7 +478,7 @@ void mm_update_next_owner(struct mm_struct *mm)
task_unlock(c); task_unlock(c);
put_task_struct(c); put_task_struct(c);
} }
#endif /* CONFIG_MEMCG */ #endif /* CONFIG_MM_OWNER */
/* /*
* Turn us into a lazy TLB process if we * Turn us into a lazy TLB process if we
......
...@@ -958,7 +958,7 @@ static void mm_init_aio(struct mm_struct *mm) ...@@ -958,7 +958,7 @@ static void mm_init_aio(struct mm_struct *mm)
static __always_inline void mm_clear_owner(struct mm_struct *mm, static __always_inline void mm_clear_owner(struct mm_struct *mm,
struct task_struct *p) struct task_struct *p)
{ {
#ifdef CONFIG_MEMCG #ifdef CONFIG_MM_OWNER
if (mm->owner == p) if (mm->owner == p)
WRITE_ONCE(mm->owner, NULL); WRITE_ONCE(mm->owner, NULL);
#endif #endif
...@@ -966,7 +966,7 @@ static __always_inline void mm_clear_owner(struct mm_struct *mm, ...@@ -966,7 +966,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) static void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
{ {
#ifdef CONFIG_MEMCG #ifdef CONFIG_MM_OWNER
mm->owner = p; mm->owner = p;
#endif #endif
} }
......
...@@ -299,6 +299,10 @@ config VIRT_TO_BUS ...@@ -299,6 +299,10 @@ config VIRT_TO_BUS
deprecated interface virt_to_bus(). All new architectures deprecated interface virt_to_bus(). All new architectures
should probably not select this. 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 config MMU_NOTIFIER
bool bool
......
...@@ -129,7 +129,7 @@ void dump_mm(const struct mm_struct *mm) ...@@ -129,7 +129,7 @@ void dump_mm(const struct mm_struct *mm)
#ifdef CONFIG_AIO #ifdef CONFIG_AIO
"ioctx_table %px\n" "ioctx_table %px\n"
#endif #endif
#ifdef CONFIG_MEMCG #ifdef CONFIG_MM_OWNER
"owner %px " "owner %px "
#endif #endif
"exe_file %px\n" "exe_file %px\n"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册