Re: [BUGFIX][PATCH] memcg: fix oom killer kills a task in other cgroup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Feb 2010 09:32:46 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> On Sat, 6 Feb 2010 01:30:49 +0900
> Minchan Kim <minchan.kim@xxxxxxxxx> wrote:

> > I am not sure how many usecase is also dependent of other locks.
> > If it is not as is, we can't make sure in future.
> > 
> > So How about try_task_in_mem_cgroup?
> > If we can't hold task_lock, let's continue next child.
> > 
> It's recommended not to use trylock in unclear case.
> 
> Then, I think possible replacement will be not-to-use any lock in
> task_in_mem_cgroup. In my short consideration, I don't think task_lock
> is necessary if we can add some tricks and memory barrier.
> 
> Please let this patch to go as it is because this is an obvious bug fix
> and give me time.
> 
I'll try some today. please wait. 
(but I wonder the patch will be not good for stable tree.)

Thanks,
-Kame

> Now, I think of following.
> This makes use of the fact mm->owner is changed only at _exit() of the owner.
> If there is a race with _exit() and mm->owner is racy, the oom selection
> itself was racy and bad.
> ==
> int task_in_mem_cgroup_oom(struct task_struct *tsk, struct mem_cgroup *mem)
> {
> 	struct mm_struct *mm;
> 	struct task_struct *tsk;
> 	int ret = 0;
> 
> 	mm = tsk->mm;
> 	if (!mm)
> 		return ret;
> 	/*
> 	 * we are not interested in tasks other than owner. mm->owner is
> 	 * updated when the owner task exits. If the owner is exiting now
> 	 * (and race with us), we may miss.
> 	 */
> 	if (rcu_dereference(mm->owner) != tsk)
> 		return ret;
> 	rcu_read_lock();
> 	/* while this task is alive, this task is the owner */
> 	if (mem == mem_cgroup_from_task(tsk))
> 		ret = 1;
> 	rcu_read_unlock();
> 	return ret;
> }
> ==
> Hmm, it seems no memory barrier is necessary.
> 
> Does anyone has another idea ?
> 
> Thanks,
> -Kame
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]