[PATCH] fold me "mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj"

From: Michal Hocko
Date: Tue May 31 2016 - 01:16:12 EST


- skip over same thread group
- skip over kernel threads and global init

Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
---
fs/proc/base.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index f4fcd2954f42..164fe38022d2 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1104,8 +1104,11 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)

rcu_read_lock();
for_each_process(p) {
- /* do not touch kernel threads */
- if (p->flags & PF_KTHREAD)
+ if (same_thread_group(task,p))
+ continue;
+
+ /* do not touch kernel threads or the global init */
+ if (p->flags & PF_KTHREAD || is_global_init(p))
continue;

task_lock(p);
--
2.8.1

--
Michal Hocko
SUSE Labs