Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933181Ab0FBVkI (ORCPT ); Wed, 2 Jun 2010 17:40:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2324 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933128Ab0FBVkG (ORCPT ); Wed, 2 Jun 2010 17:40:06 -0400 Date: Wed, 2 Jun 2010 23:38:33 +0200 From: Oleg Nesterov To: Paul Menage Cc: Ben Blum , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, akpm@linux-foundation.org, ebiederm@xmission.com, lizf@cn.fujitsu.com, matthltc@us.ibm.com Subject: Re: [RFC] [PATCH 2/2] cgroups: make procs file writable Message-ID: <20100602213832.GB31949@redhat.com> References: <20100530013303.GC762@ghc01.ghc.andrew.cmu.edu> <20100531175242.GA14691@redhat.com> <20100531180446.GA16249@redhat.com> <20100602140659.GA5324@redhat.com> <20100602202048.GB28663@redhat.com> <20100602205855.GA30039@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: 1824 Lines: 42 On 06/02, Paul Menage wrote: > > On Wed, Jun 2, 2010 at 1:58 PM, Oleg Nesterov wrote: > >> The "it" that you're proposing to remove is in fact the code that > >> handles those races. > > > > In that case I confused, and I thought we already agreed that > > the PF_EXITING check in attach_task_by_pid() is not strictly needed > > for correctness. > > Not quite - something is required for correctness, and the PF_EXITING > check provides that correctness, with a very small window (between > setting PF_EXITING and calling cgroup_exit) where we might arguably > have been able to move the thread but decline to do so because it's > simpler not to do so and no-one cares. That's the optimization that I > meant - the data structures are slightly simpler since there's no way > to tell when a task has passed cgroup_exit(), and instead we just see > if they've passed PF_EXITING. > > > > > Once again, the task can call do_exit() and set PF_EXITING right > > after the check. > > Yes, the important part is that they haven't set it *before* the check > in attach_task_by_pid(). If they have set it before that, then they > could be anywhere in the exit path after PF_EXITING, and we decline to > move them since it's possible that they've already passed > cgroup_exit(). If the exiting task has not yet set PF_EXITING, then it > can't possibly get into the critical section in cgroup_exit() since > attach_task_by_pid() holds task->alloc_lock. It doesn't ? At least in Linus's tree. cgroup_attach_task() does, and this time PF_EXITING is understandable. 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/