Lines Matching defs:task

28 #include <linux/sched/task.h>
77 * oom_cpuset_eligible() - check task eligiblity for kill
78 * @start: task struct of which task to consider
81 * Task eligibility is determined by whether or not a candidate task, @tsk,
163 /* return true if the task is not adequate as candidate victim task. */
193 * oom_badness - heuristic function to determine which candidate task to kill
194 * @p: task struct of which task we should calculate
197 * The heuristic for determining which task to kill is made to be as simple and
199 * task consuming the most memory to avoid subsequent oom failures.
228 * task's rss, pagetable and swap space use.
274 * to kill current.We have to random task kill in this case.
308 static int oom_evaluate_task(struct task_struct *task, void *arg)
313 if (oom_unkillable_task(task))
317 if (!is_memcg_oom(oc) && !oom_cpuset_eligible(task, oc))
321 * This task already has access to memory reserves and is being killed.
322 * Don't allow any other task to have access to the reserves unless
323 * the task has MMF_OOM_SKIP because chances that it would release
326 if (!is_sysrq_oom(oc) && tsk_is_oom_victim(task)) {
327 if (test_bit(MMF_OOM_SKIP, &task->signal->oom_mm->flags))
333 * If task is allocating a lot of memory and has been marked to be
336 if (oom_task_origin(task)) {
341 points = oom_badness(task, oc->totalpages);
348 get_task_struct(task);
349 oc->chosen = task;
384 struct task_struct *task;
393 task = find_lock_task_mm(p);
394 if (!task) {
404 task->pid, from_kuid(&init_user_ns, task_uid(task)),
405 task->tgid, task->mm->total_vm, get_mm_rss(task->mm),
406 mm_pgtables_bytes(task->mm),
407 get_mm_counter(task->mm, MM_SWAPENTS),
408 task->signal->oom_score_adj, task->comm);
409 task_unlock(task);
421 * State information includes task's pid, uid, tgid, vm size, rss,
449 pr_cont(",task=%s,pid=%d,uid=%d\n", victim->comm, victim->pid,
486 * task->mm can be NULL if the task is the exited group leader. So to
487 * determine whether the task is using a particular mm, we examine all the
488 * task's threads: if one of those is using this mm then this task was also
563 * Reaps the address space of the give task.
715 * mark_oom_victim - mark the given task as OOM victim
716 * @tsk: task to mark
740 * Make sure that the task is woken up from uninterruptible sleep
809 static inline bool __task_will_free_mem(struct task_struct *task)
811 struct signal_struct *sig = task->signal;
824 if (thread_group_empty(task) && (task->flags & PF_EXITING))
831 * Checks whether the given task is dying or exiting and likely to
834 * Caller has to make sure that task->mm is stable (hold task_lock or
837 static bool task_will_free_mem(struct task_struct *task)
839 struct mm_struct *mm = task->mm;
851 if (!__task_will_free_mem(task))
855 * This task has already been drained by the oom reaper so there are
867 * b) the task is also reapable by the oom reaper.
873 if (same_thread_group(task, p))
892 pr_info("%s: OOM victim %d (%s) is already exiting. Skip killing the task\n",
906 /* Raise event before sending signal: task reaper must see this */
968 * Kill provided task unless it's secured by setting
971 static int oom_kill_memcg_member(struct task_struct *task, void *message)
973 if (task->signal->oom_score_adj != OOM_SCORE_ADJ_MIN &&
974 !is_global_init(task)) {
975 get_task_struct(task);
976 __oom_kill_process(task, message);
989 * If the task is already exiting, don't alarm the sysadmin or kill
1009 * Check this out before killing the victim task.
1069 * killing a random task (bad), letting the system crash (worse)