diff options
author | Arve Hjønnevåg <arve@android.com> | 2010-11-23 18:20:28 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2012-02-14 11:30:36 -0800 |
commit | f1724765f84dffeaa3bbb09115f55efa79382f17 (patch) | |
tree | a1e5bb540875e1590feb89e99fca05de08328ce3 | |
parent | 84a7bd81bc301b7a25151dac04a7c39048df33be (diff) |
staging: android: lowmemorykiller: Don't wait more than one second for a process to die
If a process forked and the child process was killed by the
lowmemorykiller, the lowmemory killer would be disabled until
the parent process reaped the child or it died itself.
Change-Id: I709b1a4e1b1a1970e51d26a39fcbee57977bbc7f
Signed-off-by: Arve Hjønnevåg <arve@android.com>
-rw-r--r-- | drivers/staging/android/lowmemorykiller.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 0111497550d..95ff01b4bc1 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -53,6 +53,7 @@ static size_t lowmem_minfree[6] = { static int lowmem_minfree_size = 4; static struct task_struct *lowmem_deathpending; +static unsigned long lowmem_deathpending_timeout; #define lowmem_print(level, x...) \ do { \ @@ -100,7 +101,8 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) * this pass. * */ - if (lowmem_deathpending) + if (lowmem_deathpending && + time_before_eq(jiffies, lowmem_deathpending_timeout)) return 0; if (lowmem_adj_size < array_size) @@ -169,6 +171,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) selected->pid, selected->comm, selected_oom_adj, selected_tasksize); lowmem_deathpending = selected; + lowmem_deathpending_timeout = jiffies + HZ; force_sig(SIGKILL, selected); rem -= selected_tasksize; } |