Revert "android/lowmemorykiller: Ignore tasks with freed mm"

This reverts commit 05d5ad4d0a.

Change-Id: Ib5770b5b38f123116322507646ae9bce6c3c186a
This commit is contained in:
Thierry Strudel 2015-12-22 10:13:14 -08:00 committed by syphyr
parent 44ba2354e3
commit 6f6c955aa5
5 changed files with 6 additions and 19 deletions

View file

@ -161,7 +161,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
#define TIF_RESTORE_SIGMASK 20
#define TIF_MM_RELEASED 23 /* task MM has been released */
#define TIF_SWITCH_MM 22 /* deferred switch_mm */
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)

View file

@ -151,10 +151,6 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
if (tsk->flags & PF_KTHREAD)
continue;
/* if task no longer has any memory ignore it */
if (test_task_flag(tsk, TIF_MM_RELEASED))
continue;
if (time_before_eq(jiffies, lowmem_deathpending_timeout)) {
if (test_task_flag(tsk, TIF_MEMDIE)) {
rcu_read_unlock();
@ -212,14 +208,12 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
set_tsk_thread_flag(selected, TIF_MEMDIE);
send_sig(SIGKILL, selected, 0);
rem -= selected_tasksize;
rcu_read_unlock();
/* give the system time to free up the memory */
msleep_interruptible(20);
} else
rcu_read_unlock();
}
lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n",
nr_to_scan, sc->gfp_mask, rem);
rcu_read_unlock();
mutex_unlock(&scan_mutex);
return rem;
}

View file

@ -2411,7 +2411,7 @@ static inline void mmdrop(struct mm_struct * mm)
}
/* mmput gets rid of the mappings and all user-space */
extern int mmput(struct mm_struct *);
extern void mmput(struct mm_struct *);
/* Grab a reference to a task's mm, if it is not already going away */
extern struct mm_struct *get_task_mm(struct task_struct *task);
/*

View file

@ -409,7 +409,6 @@ static void exit_mm(struct task_struct * tsk)
{
struct mm_struct *mm = tsk->mm;
struct core_state *core_state;
int mm_released;
mm_release(tsk, mm);
if (!mm)
@ -455,10 +454,7 @@ static void exit_mm(struct task_struct * tsk)
enter_lazy_tlb(mm, current);
task_unlock(tsk);
mm_update_next_owner(mm);
mm_released = mmput(mm);
if (mm_released)
set_tsk_thread_flag(tsk, TIF_MM_RELEASED);
mmput(mm);
}
/*

View file

@ -630,9 +630,8 @@ EXPORT_SYMBOL_GPL(__mmdrop);
/*
* Decrement the use count and release all resources for an mm.
*/
int mmput(struct mm_struct *mm)
void mmput(struct mm_struct *mm)
{
int mm_freed = 0;
might_sleep();
if (atomic_dec_and_test(&mm->mm_users)) {
@ -650,9 +649,7 @@ int mmput(struct mm_struct *mm)
if (mm->binfmt)
module_put(mm->binfmt->module);
mmdrop(mm);
mm_freed = 1;
}
return mm_freed;
}
EXPORT_SYMBOL_GPL(mmput);