[Devel] [PATCH rh7 4/5] oom: zap unused oom_scan_process_thread arguments
Vladimir Davydov
vdavydov at virtuozzo.com
Tue Apr 12 09:34:26 PDT 2016
totalpages hasn't been used for ages. force_kill doesn't make sense in
our case, because we skip TIF_MEMDIE tasks anyway.
Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
drivers/tty/sysrq.c | 2 +-
include/linux/oom.h | 5 ++---
mm/memcontrol.c | 3 +--
mm/oom_kill.c | 24 +++++++++---------------
mm/page_alloc.c | 2 +-
5 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index de29f8e25f65..e7d334ca1288 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -356,7 +356,7 @@ static struct sysrq_key_op sysrq_term_op = {
static void moom_callback(struct work_struct *ignored)
{
out_of_memory(node_zonelist(first_online_node, GFP_KERNEL), GFP_KERNEL,
- 0, NULL, true);
+ 0, NULL);
}
static DECLARE_WORK(moom_work, moom_callback);
diff --git a/include/linux/oom.h b/include/linux/oom.h
index acf58fc0ce55..5c2a7a4912da 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -99,11 +99,10 @@ extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
int order, const nodemask_t *nodemask);
extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
- unsigned long totalpages, const nodemask_t *nodemask,
- bool force_kill);
+ const nodemask_t *nodemask);
extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
- int order, nodemask_t *mask, bool force_kill);
+ int order, nodemask_t *mask);
extern void exit_oom_victim(void);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b2543e69ccf7..ac2cbd8d8494 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2035,8 +2035,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
cgroup_iter_start(cgroup, &it);
while ((task = cgroup_iter_next(cgroup, &it))) {
- switch (oom_scan_process_thread(task, totalpages, NULL,
- false)) {
+ switch (oom_scan_process_thread(task, NULL)) {
case OOM_SCAN_SELECT:
if (chosen)
put_task_struct(chosen);
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 8d1843fa86fe..5bc4ccfcf41f 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -317,8 +317,7 @@ static enum oom_constraint constrained_alloc(struct zonelist *zonelist,
#endif
enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
- unsigned long totalpages, const nodemask_t *nodemask,
- bool force_kill)
+ const nodemask_t *nodemask)
{
if (oom_unkillable_task(task, NULL, nodemask))
return OOM_SCAN_CONTINUE;
@@ -330,10 +329,9 @@ enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
* This can only happen if oom_trylock timeout-ed, which most probably
* means that the victim had dead-locked.
*/
- if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
- if (!force_kill)
- return OOM_SCAN_CONTINUE;
- }
+ if (test_tsk_thread_flag(task, TIF_MEMDIE))
+ return OOM_SCAN_CONTINUE;
+
if (!task->mm)
return OOM_SCAN_CONTINUE;
@@ -355,8 +353,7 @@ enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
*/
static struct task_struct *select_bad_process(unsigned long *ppoints,
unsigned long *poverdraft,
- unsigned long totalpages, const nodemask_t *nodemask,
- bool force_kill)
+ unsigned long totalpages, const nodemask_t *nodemask)
{
struct task_struct *g, *p;
struct task_struct *chosen = NULL;
@@ -368,8 +365,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
unsigned int points;
unsigned long overdraft;
- switch (oom_scan_process_thread(p, totalpages, nodemask,
- force_kill)) {
+ switch (oom_scan_process_thread(p, nodemask)) {
case OOM_SCAN_SELECT:
chosen = p;
chosen_points = ULONG_MAX;
@@ -954,7 +950,6 @@ EXPORT_SYMBOL_GPL(unregister_oom_notifier);
* @gfp_mask: memory allocation flags
* @order: amount of memory being requested as a power of 2
* @nodemask: nodemask passed to page allocator
- * @force_kill: true if a task must be killed, even if others are exiting
*
* If we run out of memory, we have the choice between either
* killing a random task (bad), letting the system crash (worse)
@@ -962,7 +957,7 @@ EXPORT_SYMBOL_GPL(unregister_oom_notifier);
* don't have to be perfect here, we just have to be good.
*/
void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
- int order, nodemask_t *nodemask, bool force_kill)
+ int order, nodemask_t *nodemask)
{
const nodemask_t *mpol_mask;
struct task_struct *p;
@@ -1010,8 +1005,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
return;
}
- p = select_bad_process(&points, &overdraft, totalpages, mpol_mask,
- force_kill);
+ p = select_bad_process(&points, &overdraft, totalpages, mpol_mask);
/* Found nothing?!?! Either we hang forever, or we panic. */
if (!p) {
dump_header(NULL, gfp_mask, order, NULL, mpol_mask);
@@ -1033,7 +1027,7 @@ void pagefault_out_of_memory(void)
return;
if (oom_trylock(NULL)) {
- out_of_memory(NULL, 0, 0, NULL, false);
+ out_of_memory(NULL, 0, 0, NULL);
oom_unlock(NULL);
}
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9ab61fe3f760..9a7ac88b66ef 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2211,7 +2211,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
goto out;
}
/* Exhausted what can be done so it's blamo time */
- out_of_memory(zonelist, gfp_mask, order, nodemask, false);
+ out_of_memory(zonelist, gfp_mask, order, nodemask);
out:
oom_unlock(NULL);
--
2.1.4
More information about the Devel
mailing list