Skip to content

Commit

Permalink
cgroups: remove redundant get/put of css_set from css_set_check_fetch…
Browse files Browse the repository at this point in the history
…ed()

We already have a reference to all elements in newcg_list.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: containers@lists.linux-foundation.org
Cc: cgroups@vger.kernel.org
Cc: Paul Menage <paul@paulmenage.org>
  • Loading branch information
Mandeep Singh Baines authored and Tejun Heo committed Dec 19, 2011
1 parent 52dcf8a commit 29e2136
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,23 +2025,17 @@ static bool css_set_check_fetched(struct cgroup *cgrp,

read_lock(&css_set_lock);
newcg = find_existing_css_set(cg, cgrp, template);
if (newcg)
get_css_set(newcg);
read_unlock(&css_set_lock);

/* doesn't exist at all? */
if (!newcg)
return false;
/* see if it's already in the list */
list_for_each_entry(cg_entry, newcg_list, links) {
if (cg_entry->cg == newcg) {
put_css_set(newcg);
list_for_each_entry(cg_entry, newcg_list, links)
if (cg_entry->cg == newcg)
return true;
}
}

/* not found */
put_css_set(newcg);
return false;
}

Expand Down

0 comments on commit 29e2136

Please sign in to comment.