Skip to contentSkip to conversation

oom: create a resource limit for oom_adj

PATCH Figo.zhang 1 participant 1 message Nov 11, 2010

lore
Share & tools
lore

Figo.zhang

author
#0 lore raw
Quoted 4 lines
  	if (oom_adjust<  task->signal->oom_adj&&  !capable(CAP_SYS_RESOURCE)) {
(quoted diff) +0 -2
-		err = -EACCES;
-		goto err_sighand;

Review

Quoted 10 lines
(quoted diff) +9 -0
+		/* convert oom_adj [15,-17] to rlimit style value [1,33] */
+		long oom_rlim = OOM_ADJUST_MAX + 1 - oom_adjust;
+
+		if (oom_rlim>  task->signal->rlim[RLIMIT_OOMADJ].rlim_cur) {
+			unlock_task_sighand(task,&flags);
+			put_task_struct(task);
+			err = -EACCES;
+			goto err_sighand;
+		}
  	}

=> Label "err_sighand" have do that, why are you do that on here?

+ err = -EACCES;
+ goto err_sighand;
+ }
}