[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111220234722.GW13529@google.com>
Date: Tue, 20 Dec 2011 15:47:22 -0800
From: Mandeep Singh Baines <msb@...omium.org>
To: Tejun Heo <tj@...nel.org>
Cc: Mandeep Singh Baines <msb@...omium.org>,
Li Zefan <lizf@...fujitsu.com>,
LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
containers@...ts.linux-foundation.org, cgroups@...r.kernel.org,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Paul Menage <paul@...lmenage.org>
Subject: Re: [PATCH 4/5] cgroup: remove extra calls to find_existing_css_set
Tejun Heo (tj@...nel.org) wrote:
> Hello,
>
> On Tue, Dec 20, 2011 at 03:14:32PM -0800, Mandeep Singh Baines wrote:
> > @@ -1942,9 +1917,17 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
> > }
> > }
> >
> > - retval = cgroup_task_migrate(cgrp, oldcgrp, tsk, false);
> > - if (retval)
> > + task_lock(tsk);
> > + oldcg = tsk->cgroups;
> > + task_unlock(tsk);
>
> Probably this is patch order issue w/ Frederic's patch but we don't
> need task_lock here, right?
>
Yeah, avoided removing the locks because Frederic's patch already did that.
Once his changes get in, I'll rebase and resend.
> > @@ -2171,17 +2088,18 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> > * step 2: make sure css_sets exist for all threads to be migrated.
> > * we use find_css_set, which allocates a new one if necessary.
> > */
> > - INIT_LIST_HEAD(&newcg_list);
> > for (i = 0; i < group_size; i++) {
> > tc = flex_array_get(group, i);
> > /* get old css_set pointer */
> > task_lock(tc->task);
> > oldcg = tc->task->cgroups;
> > task_unlock(tc->task);
> > - /* if we don't already have it in the list get a new one */
> > - if (!css_set_fetched(cgrp, tc->task, oldcg, &newcg_list))
> > - if (retval = css_set_prefetch(cgrp, oldcg, &newcg_list))
> > - goto out_list_teardown;
> > + tc->cg = find_css_set(oldcg, cgrp);
> > + if (!tc->cg) {
> > + retval = -ENOMEM;
> > + css_set_refs = i + 1;
> > + goto out_list_teardown;
> > + }
>
> Nice cleanup, but can't the above be merged into the loop which builds
> the flex array?
>
Good idea. That would remove a for loop. Will fix in next version.
> Thanks.
>
> --
> tejun
--
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