Re: [PATCH -v2 5/5] OOM, PM: make OOM detection in the freezer path raceless

From: Michal Hocko
Date: Thu Jan 08 2015 - 06:51:33 EST


On Fri 05-12-14 17:41:47, Michal Hocko wrote:
[...]
> +bool oom_killer_disable(void)
> +{
> + /*
> + * Make sure to not race with an ongoing OOM killer
> + * and that the current is not the victim.
> + */
> + down_write(&oom_sem);
> + if (test_thread_flag(TIF_MEMDIE)) {
> + up_write(&oom_sem);
> + return false;
> + }
> +
> + oom_killer_disabled = true;
> + up_write(&oom_sem);
> +
> + wait_event(oom_victims_wait, atomic_read(&oom_victims));

Ups brainfart... Should be !atomic_read(&oom_victims). Condition says
for what we are waiting not when we are waiting.

> +
> + 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/