[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141204171822.GE25001@dhcp22.suse.cz>
Date: Thu, 4 Dec 2014 18:18:22 +0100
From: Michal Hocko <mhocko@...e.cz>
To: Tejun Heo <tj@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org,
linux-pm@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
"\\\"Rafael J. Wysocki\\\"" <rjw@...ysocki.net>,
David Rientjes <rientjes@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
Cong Wang <xiyou.wangcong@...il.com>
Subject: Re: [RFC 2/2] OOM, PM: make OOM detection in the freezer path
raceless
On Thu 04-12-14 17:56:01, Michal Hocko wrote:
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 1d55ab12792f..032be9d2a239 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -408,7 +408,7 @@ static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order,
> * Number of OOM victims in flight
> */
> static atomic_t oom_victims = ATOMIC_INIT(0);
> -static DECLARE_COMPLETION(oom_victims_wait);
> +static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait);
>
> bool oom_killer_disabled __read_mostly;
> static DECLARE_RWSEM(oom_sem);
> @@ -435,7 +435,7 @@ void unmark_tsk_oom_victim(void)
> * is nobody who cares.
> */
> if (!atomic_dec_return(&oom_victims) && oom_killer_disabled)
> - complete_all(&oom_victims_wait);
> + wake_up_all(&oom_victims_wait);
> up_read(&oom_sem);
> }
>
> @@ -464,16 +464,11 @@ bool oom_killer_disable(void)
> return false;
> }
>
> - /* unmark_tsk_oom_victim is calling complete_all */
> - if (!oom_killer_disable)
> - reinit_completion(&oom_victims_wait);
> -
> oom_killer_disabled = true;
> - count = atomic_read(&oom_victims);
> up_write(&oom_sem);
>
> if (count)
whithout this count test obviously
> - wait_for_completion(&oom_victims_wait);
> + wait_event(oom_victims_wait, atomic_read(&oom_victims));
>
> return true;
> }
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists