Commit 20f4757f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'cgroup-for-6.6-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup fixes from Tejun Heo:

 - In cgroup1, the `tasks` file could have duplicate pids which can
   trigger a warning in seq_file. Fix it by removing duplicate items
   after sorting

 - Comment update

* tag 'cgroup-for-6.6-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cgroup: Fix incorrect css_set_rwsem reference in comment
  cgroup: Remove duplicates in cgroup v1 tasks file
parents e5e11703 13cc9ee8
...@@ -238,7 +238,7 @@ struct css_set { ...@@ -238,7 +238,7 @@ struct css_set {
* Lists running through all tasks using this cgroup group. * Lists running through all tasks using this cgroup group.
* mg_tasks lists tasks which belong to this cset but are in the * mg_tasks lists tasks which belong to this cset but are in the
* process of being migrated out or in. Protected by * process of being migrated out or in. Protected by
* css_set_rwsem, but, during migration, once tasks are moved to * css_set_lock, but, during migration, once tasks are moved to
* mg_tasks, it can be read safely while holding cgroup_mutex. * mg_tasks, it can be read safely while holding cgroup_mutex.
*/ */
struct list_head tasks; struct list_head tasks;
......
...@@ -360,10 +360,9 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, ...@@ -360,10 +360,9 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
} }
css_task_iter_end(&it); css_task_iter_end(&it);
length = n; length = n;
/* now sort & (if procs) strip out duplicates */ /* now sort & strip out duplicates (tgids or recycled thread PIDs) */
sort(array, length, sizeof(pid_t), cmppid, NULL); sort(array, length, sizeof(pid_t), cmppid, NULL);
if (type == CGROUP_FILE_PROCS) length = pidlist_uniq(array, length);
length = pidlist_uniq(array, length);
l = cgroup_pidlist_find_create(cgrp, type); l = cgroup_pidlist_find_create(cgrp, type);
if (!l) { if (!l) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment