[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131109151639.GB14249@redhat.com>
Date: Sat, 9 Nov 2013 16:16:39 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Sameer Nanda <snanda@...omium.org>
Cc: akpm@...ux-foundation.org, mhocko@...e.cz, rientjes@...gle.com,
hannes@...xchg.org, rusty@...tcorp.com.au, semenzato@...gle.com,
murzin.v@...il.com, dserrg@...il.com, msb@...omium.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] mm, oom: Fix race when selecting process to kill
On 11/08, Sameer Nanda wrote:
>
> @@ -413,12 +413,20 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
> DEFAULT_RATELIMIT_BURST);
> @@ -456,10 +463,18 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
> }
> }
> } while_each_thread(p, t);
> - read_unlock(&tasklist_lock);
>
> rcu_read_lock();
> +
> p = find_lock_task_mm(victim);
> +
> + /*
> + * Since while_each_thread is currently not RCU safe, this unlock of
> + * tasklist_lock may need to be moved further down if any additional
> + * while_each_thread loops get added to this function.
> + */
> + read_unlock(&tasklist_lock);
Well, ack... but with this change find_lock_task_mm() relies on tasklist,
so it makes sense to move rcu_read_lock() down before for_each_process().
Otherwise this looks confusing, but I won't insist.
Oleg.
--
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