lkml.org 
[lkml]   [2013]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] mm, memcg: add oom killer delay
On Sat 01-06-13 02:11:51, Johannes Weiner wrote:
> @@ -2076,6 +2077,7 @@ static void memcg_wakeup_oom(struct mem_cgroup *memcg)
> {
> /* for filtering, pass "memcg" as argument. */
> __wake_up(&memcg_oom_waitq, TASK_NORMAL, 0, memcg);
> + atomic_inc(&memcg->oom_wakeups);
> }
>
> static void memcg_oom_recover(struct mem_cgroup *memcg)
[...]
> + prepare_to_wait(&memcg_oom_waitq, &owait.wait, TASK_KILLABLE);
> + /* Only sleep if we didn't miss any wakeups since OOM */
> + if (atomic_read(&memcg->oom_wakeups) == current->memcg_oom.wakeups)
> + schedule();

On the way home it occured to me that the ordering might be wrong here.
The wake up can be lost here.
__wake_up(memcg_oom_waitq)
<preempted>
prepare_to_wait
atomic_read(&memcg->oom_wakeups)
atomic_inc(oom_wakeups)

I guess we want atomic_inc before __wake_up, right?
--
Michal Hocko
SUSE Labs


\
 
 \ /
  Last update: 2013-06-03 19:23    [W:0.117 / U:1.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site