Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754925AbbK3PQP (ORCPT ); Mon, 30 Nov 2015 10:16:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42355 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754532AbbK3PQM (ORCPT ); Mon, 30 Nov 2015 10:16:12 -0500 Date: Mon, 30 Nov 2015 16:16:47 +0100 From: Oleg Nesterov To: Zefan Li Cc: Aleksa Sarai , Johannes Weiner , Tejun Heo , linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] cgroup: fix race between cgroup_post_fork() and cgroup_migrate() Message-ID: <20151130151630.GA28046@redhat.com> References: <20151127185705.GA14669@redhat.com> <56591AED.7050808@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56591AED.7050808@huawei.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1517 Lines: 44 On 11/28, Zefan Li wrote: > > On 2015/11/28 2:57, Oleg Nesterov wrote: >> On 11/26, Oleg Nesterov wrote: >>> >>> OK. I do not know what exactly do you mean, perhaps if you fix this problem >>> the race between fork and attach goes away and in this case the fix I sent >>> is not needed? >> >> Otherwise please consider this series. >> >> Slightly tested, seems to work; please review. >> > > Allowing tasks migrating between cgroups while forking is problematic. I'm more > than glad to see those changes. Yes, I think this way we can probably do other cleanups/fixes in the generic code too. For example, cgroup_enable_task_cg_lists() looks racy, spin_lock_irq(siglock) can't ensure we can't miss PF_EXITING, exit_signals() doesn't take this lock in the single-threaded case. We can change it to use cgroup_threadgroup_rwsem and avoid tasklist_lock afaics. And I forgot to mention, if we apply this series, we need to rename threadgroup_change_begin/end and remove the "task_struct *tsk" argument, plus provide the helpers for write_lock/unlock. Then we can remove uprobe_start_dup_mmap() and change register_for_each_vma() to use the same lock. But I failed to invent the good names for the new helpers ;) > Acked-by: Zefan Li Thanks! Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/