History

mm, oom: remove redundant task_in_mem_cgroup() check

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.

Shakeel Butt committed 7 years ago

Commit 6ba749e1 parent 5eee7e15 files · +9 −47Browse files

Showing the changes to include/linux (2 of 5 files). Show all

Unified · Split

2 files
  1. include/linux/memcontrol.h +0 −7
  2. include/linux/oom.h +1 −1
include/linux/memcontrol.h+0−7
@@ -394,7 +394,6 @@ out: · 393 unmodified lines
394 394
395struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *);395struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *);
396 396
397bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg);
398struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);397struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
399 398
400struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm);399struct 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 return true;874 return true;
876}875}
877 876
878static inline bool task_in_mem_cgroup(struct task_struct *task,
879 const struct mem_cgroup *memcg)
880{
881 return true;
882}
883
884static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)877static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
885{878{
886 return NULL;879 return NULL;
include/linux/oom.h+1−1
@@ -108,7 +108,7 @@ static inline vm_fault_t check_stable_address_space(struct mm_struct *mm) · 107 unmodified lines
108bool __oom_reap_task_mm(struct mm_struct *mm);108bool __oom_reap_task_mm(struct mm_struct *mm);
109 109
110extern unsigned long oom_badness(struct task_struct *p,110extern unsigned long oom_badness(struct task_struct *p,
111 struct mem_cgroup *memcg, const nodemask_t *nodemask,111 const nodemask_t *nodemask,
112 unsigned long totalpages);112 unsigned long totalpages);
113 113
114extern bool out_of_memory(struct oom_control *oc);114extern bool out_of_memory(struct oom_control *oc);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t