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

Showing the changes to kernel (2 of 2 files). Show all

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
47284728 return ret;
47294729 }
47304730
4731−static ssize_t cgroup_procs_write(struct kernfs_open_file *of,
4732− char *buf, size_t nbytes, loff_t off)
4731+static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
4732+ bool threadgroup)
47334733 {
47344734 struct cgroup *src_cgrp, *dst_cgrp;
47354735 struct task_struct *task;
@@ -4740,7 +4740,7 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, · 4 unmodified lines
47404740 if (!dst_cgrp)
47414741 return -ENODEV;
47424742
4743− task = cgroup_procs_write_start(buf, true, &locked);
4743+ task = cgroup_procs_write_start(buf, threadgroup, &locked);
47444744 ret = PTR_ERR_OR_ZERO(task);
47454745 if (ret)
47464746 goto out_unlock;
@@ -4750,19 +4750,26 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, · 3 unmodified lines
47504750 src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);
47514751 spin_unlock_irq(&css_set_lock);
47524752
4753+ /* process and thread migrations follow same delegation rule */
47534754 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);
47554756 if (ret)
47564757 goto out_finish;
47574758
4758− ret = cgroup_attach_task(dst_cgrp, task, true);
4759+ ret = cgroup_attach_task(dst_cgrp, task, threadgroup);
47594760
47604761 out_finish:
47614762 cgroup_procs_write_finish(task, locked);
47624763 out_unlock:
47634764 cgroup_kn_unlock(of->kn);
47644765
4765− return ret ?: nbytes;
4766+ return ret;
4767+}
4768+
4769+static 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;
47664773 }
47674774
47684775 static 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
47734780 static ssize_t cgroup_threads_write(struct kernfs_open_file *of,
47744781 char *buf, size_t nbytes, loff_t off)
47754782 {
4776− struct cgroup *src_cgrp, *dst_cgrp;
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−
4805−out_finish:
4806− cgroup_procs_write_finish(task, locked);
4807−out_unlock:
4808− cgroup_kn_unlock(of->kn);
4809−
4810− return ret ?: nbytes;
4783+ return __cgroup_procs_write(of, buf, false) ?: nbytes;
48114784 }
48124785
48134786 /* cgroup core interface files for the default hierarchy */
kernel/cgroup/cpuset.c+3−3
@@ -98,7 +98,7 @@ struct cpuset { · 97 unmodified lines
9898 * and if it ends up empty, it will inherit the parent's mask.
9999 *
100100 *
101− * On legacy hierachy:
101+ * On legacy hierarchy:
102102 *
103103 * The user-configured masks are always the same with effective masks.
104104 */
@@ -1309,10 +1309,10 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, · 1204 unmodified lines
13091309 * @cs: the cpuset to consider
13101310 * @tmp: temp variables for calculating effective_cpus & partition setup
13111311 *
1312− * When congifured cpumask is changed, the effective cpumasks of this cpuset
1312+ * When configured cpumask is changed, the effective cpumasks of this cpuset
13131313 * and all its descendants need to be updated.
13141314 *
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.
13161316 *
13171317 * Called with cpuset_mutex held
13181318 */

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