From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mandeep Singh Baines Subject: Re: [PATCH 2/5] cgroup: remove redundant get/put of task struct Date: Tue, 20 Dec 2011 16:04:18 -0800 Message-ID: <20111221000418.GY13529@google.com> References: <1324422873-31001-1-git-send-email-msb@chromium.org> <1324422873-31001-3-git-send-email-msb@chromium.org> <20111220232326.GL10752@google.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-operating-system :user-agent; bh=LOgGkFTAyGjghM1rzCYynl4paFn+I5fmEH4YRYsSel0=; b=wXLGSEHG55ceu16OvoBHC2Ac1p5bPVH0CfRrWKpZXf4K0omkbKmNWtCWftLpu/L0hy XD/4y4QBjEEjOIdw3/xg== Content-Disposition: inline In-Reply-To: <20111220232326.GL10752-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tejun Heo Cc: Mandeep Singh Baines , Li Zefan , LKML , Frederic Weisbecker , containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, KAMEZAWA Hiroyuki , Oleg Nesterov , Andrew Morton , Paul Menage Tejun Heo (tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org) wrote: > Hello, > > On Tue, Dec 20, 2011 at 03:14:30PM -0800, Mandeep Singh Baines wrote: > > @@ -2287,14 +2280,12 @@ static int attach_task_by_pid(struct cgroup *cgrp, u64 pid, bool threadgroup) > > cgroup_unlock(); > > return -EACCES; > > } > > - get_task_struct(tsk); > > rcu_read_unlock(); > > This is before threadgroup is locked. What guarantees @tsk doesn't go > away once rcu is unlocked? > Nothing. D'oh. I'll remove the changes to attach_task_by_id and leave the others. > Thanks. > > -- > tejun