oom_unkillable_task() can be called from three different contexts i.e. global OOM, memcg OOM and oom_score procfs interface. At the moment oom_unkillable_task() does a task_in_mem_cgroup() check on the given process. Since there is no reason to perform task_in_mem_cgroup() check for global OOM and oom_score procfs interface, those contexts provide NULL memcg and skips the task_in_mem_cgroup() check. However for memcg OOM context, the oom_unkillable_task() is always called from mem_cgroup_scan_tasks() and thus task_in_mem_cgroup() check becomes redundant and effectively dead code. So, just remove the task_in_mem_cgroup() check altogether.
Showing the changes to include/linux (2 of 5 files). Show all
Unified · Split
| @@ -394,7 +394,6 @@ out: · 393 unmodified lines | ||
| 394 | 394 | |
| 395 | 395 | struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *); |
| 396 | 396 | |
| 397 | −bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg); | |
| 398 | 397 | struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); |
| 399 | 398 | |
| 400 | 399 | struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm); |
| @@ -875,12 +874,6 @@ static inline bool mm_match_cgroup(struct mm_struct *mm, · 474 unmodified lines | ||
| 875 | 874 | return true; |
| 876 | 875 | } |
| 877 | 876 | |
| 878 | −static inline bool task_in_mem_cgroup(struct task_struct *task, | |
| 879 | − const struct mem_cgroup *memcg) | |
| 880 | −{ | |
| 881 | − return true; | |
| 882 | −} | |
| 883 | − | |
| 884 | 877 | static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) |
| 885 | 878 | { |
| 886 | 879 | return NULL; |
| @@ -108,7 +108,7 @@ static inline vm_fault_t check_stable_address_space(struct mm_struct *mm) · 107 unmodified lines | ||
| 108 | 108 | bool __oom_reap_task_mm(struct mm_struct *mm); |
| 109 | 109 | |
| 110 | 110 | extern unsigned long oom_badness(struct task_struct *p, |
| 111 | − struct mem_cgroup *memcg, const nodemask_t *nodemask, | |
| 111 | + const nodemask_t *nodemask, | |
| 112 | 112 | unsigned long totalpages); |
| 113 | 113 | |
| 114 | 114 | extern bool out_of_memory(struct oom_control *oc); |