History

Merge branch 'for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup updates from Tejun Heo: "Nothing interesting. Just two minor patches" * 'for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cpuset: fix typos in comments cgroup: cgroup.{procs,threads} factor out common parts

Linus Torvalds committed 5 years ago

Commit 4b3bd222 parents b12b472 415de5f2 files · +17 −44Browse files

Unified · Split

2 files
  1. kernel/cgroup/cgroup.c +14 −41
  2. kernel/cgroup/cpuset.c +3 −3
kernel/cgroup/cgroup.c+14−41
@@ -4728,8 +4728,8 @@ static int cgroup_attach_permissions(struct cgroup *src_cgrp, · 4727 unmodified lines
4728 return ret;4728 return ret;
4729}4729}
4730 4730
4731static ssize_t cgroup_procs_write(struct kernfs_open_file *of,4731static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
4732 char *buf, size_t nbytes, loff_t off)4732 bool threadgroup)
4733{4733{
4734 struct cgroup *src_cgrp, *dst_cgrp;4734 struct cgroup *src_cgrp, *dst_cgrp;
4735 struct task_struct *task;4735 struct task_struct *task;
@@ -4740,7 +4740,7 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, · 4 unmodified lines
4740 if (!dst_cgrp)4740 if (!dst_cgrp)
4741 return -ENODEV;4741 return -ENODEV;
4742 4742
4743 task = cgroup_procs_write_start(buf, true, &locked);4743 task = cgroup_procs_write_start(buf, threadgroup, &locked);
4744 ret = PTR_ERR_OR_ZERO(task);4744 ret = PTR_ERR_OR_ZERO(task);
4745 if (ret)4745 if (ret)
4746 goto out_unlock;4746 goto out_unlock;
@@ -4750,19 +4750,26 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, · 3 unmodified lines
4750 src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);4750 src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);
4751 spin_unlock_irq(&css_set_lock);4751 spin_unlock_irq(&css_set_lock);
4752 4752
4753 /* process and thread migrations follow same delegation rule */
4753 ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,4754 ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,
4754 of->file->f_path.dentry->d_sb, true);4755 of->file->f_path.dentry->d_sb, threadgroup);
4755 if (ret)4756 if (ret)
4756 goto out_finish;4757 goto out_finish;
4757 4758
4758 ret = cgroup_attach_task(dst_cgrp, task, true);4759 ret = cgroup_attach_task(dst_cgrp, task, threadgroup);
4759 4760
4760out_finish:4761out_finish:
4761 cgroup_procs_write_finish(task, locked);4762 cgroup_procs_write_finish(task, locked);
4762out_unlock:4763out_unlock:
4763 cgroup_kn_unlock(of->kn);4764 cgroup_kn_unlock(of->kn);
4764 4765
4765 return ret ?: nbytes;4766 return ret;
4767}
4768
4769static ssize_t cgroup_procs_write(struct kernfs_open_file *of,
4770 char *buf, size_t nbytes, loff_t off)
4771{
4772 return __cgroup_procs_write(of, buf, true) ?: nbytes;
4766}4773}
4767 4774
4768static void *cgroup_threads_start(struct seq_file *s, loff_t *pos)4775static void *cgroup_threads_start(struct seq_file *s, loff_t *pos)
@@ -4773,41 +4780,7 @@ static void *cgroup_threads_start(struct seq_file *s, loff_t *pos) · 4 unmodified lines
4773static ssize_t cgroup_threads_write(struct kernfs_open_file *of,4780static ssize_t cgroup_threads_write(struct kernfs_open_file *of,
4774 char *buf, size_t nbytes, loff_t off)4781 char *buf, size_t nbytes, loff_t off)
4775{4782{
4776 struct cgroup *src_cgrp, *dst_cgrp;4783 return __cgroup_procs_write(of, buf, false) ?: nbytes;
4777 struct task_struct *task;
4778 ssize_t ret;
4779 bool locked;
4780
4781 buf = strstrip(buf);
4782
4783 dst_cgrp = cgroup_kn_lock_live(of->kn, false);
4784 if (!dst_cgrp)
4785 return -ENODEV;
4786
4787 task = cgroup_procs_write_start(buf, false, &locked);
4788 ret = PTR_ERR_OR_ZERO(task);
4789 if (ret)
4790 goto out_unlock;
4791
4792 /* find the source cgroup */
4793 spin_lock_irq(&css_set_lock);
4794 src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);
4795 spin_unlock_irq(&css_set_lock);
4796
4797 /* thread migrations follow the cgroup.procs delegation rule */
4798 ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,
4799 of->file->f_path.dentry->d_sb, false);
4800 if (ret)
4801 goto out_finish;
4802
4803 ret = cgroup_attach_task(dst_cgrp, task, false);
4804
4805out_finish:
4806 cgroup_procs_write_finish(task, locked);
4807out_unlock:
4808 cgroup_kn_unlock(of->kn);
4809
4810 return ret ?: nbytes;
4811}4784}
4812 4785
4813/* cgroup core interface files for the default hierarchy */4786/* cgroup core interface files for the default hierarchy */
kernel/cgroup/cpuset.c+3−3
@@ -98,7 +98,7 @@ struct cpuset { · 97 unmodified lines
98 * and if it ends up empty, it will inherit the parent's mask.98 * and if it ends up empty, it will inherit the parent's mask.
99 *99 *
100 *100 *
101 * On legacy hierachy:101 * On legacy hierarchy:
102 *102 *
103 * The user-configured masks are always the same with effective masks.103 * The user-configured masks are always the same with effective masks.
104 */104 */
@@ -1309,10 +1309,10 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, · 1204 unmodified lines
1309 * @cs: the cpuset to consider1309 * @cs: the cpuset to consider
1310 * @tmp: temp variables for calculating effective_cpus & partition setup1310 * @tmp: temp variables for calculating effective_cpus & partition setup
1311 *1311 *
1312 * When congifured cpumask is changed, the effective cpumasks of this cpuset1312 * When configured cpumask is changed, the effective cpumasks of this cpuset
1313 * and all its descendants need to be updated.1313 * and all its descendants need to be updated.
1314 *1314 *
1315 * On legacy hierachy, effective_cpus will be the same with cpu_allowed.1315 * On legacy hierarchy, effective_cpus will be the same with cpu_allowed.
1316 *1316 *
1317 * Called with cpuset_mutex held1317 * Called with cpuset_mutex held
1318 */1318 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t