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

Pull cgroup updates from Tejun Heo:
"These three patches were scheduled for the merge window but I forgot
to send them out. Sorry about that.

None of them are significant and they fit well in a fix pull request
too - two are cosmetic and one fixes a memory leak in the mount option
parsing path"

* 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
cgroup: Fix memory leak when parsing multiple source parameters
cgroup/cgroup.c: replace 'of->kn->priv' with of_cft()
kernel: cgroup: Mundane spelling fixes throughout the file

+17 -15
+2
kernel/cgroup/cgroup-v1.c
··· 908 opt = fs_parse(fc, cgroup1_fs_parameters, param, &result); 909 if (opt == -ENOPARAM) { 910 if (strcmp(param->key, "source") == 0) { 911 fc->source = param->string; 912 param->string = NULL; 913 return 0;
··· 908 opt = fs_parse(fc, cgroup1_fs_parameters, param, &result); 909 if (opt == -ENOPARAM) { 910 if (strcmp(param->key, "source") == 0) { 911 + if (fc->source) 912 + return invalf(fc, "Multiple sources not supported"); 913 fc->source = param->string; 914 param->string = NULL; 915 return 0;
+15 -15
kernel/cgroup/cgroup.c
··· 244 * 245 * The default hierarchy is the v2 interface of cgroup and this function 246 * can be used to test whether a cgroup is on the default hierarchy for 247 - * cases where a subsystem should behave differnetly depending on the 248 * interface version. 249 * 250 * List of changed behaviors: ··· 262 * "cgroup.procs" instead. 263 * 264 * - "cgroup.procs" is not sorted. pids will be unique unless they got 265 - * recycled inbetween reads. 266 * 267 * - "release_agent" and "notify_on_release" are removed. Replacement 268 * notification mechanism will be implemented. ··· 342 return !cgroup_parent(cgrp); 343 } 344 345 - /* can @cgrp become a thread root? should always be true for a thread root */ 346 static bool cgroup_can_be_thread_root(struct cgroup *cgrp) 347 { 348 /* mixables don't care */ ··· 527 * the root css is returned, so this function always returns a valid css. 528 * 529 * The returned css is not guaranteed to be online, and therefore it is the 530 - * callers responsiblity to tryget a reference for it. 531 */ 532 struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp, 533 struct cgroup_subsys *ss) ··· 699 ; \ 700 else 701 702 - /* walk live descendants in preorder */ 703 #define cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) \ 704 css_for_each_descendant_pre((d_css), cgroup_css((cgrp), NULL)) \ 705 if (({ lockdep_assert_held(&cgroup_mutex); \ ··· 933 934 WARN_ON_ONCE(!list_empty(&cset->threaded_csets)); 935 936 - /* This css_set is dead. unlink it and release cgroup and css refs */ 937 for_each_subsys(ss, ssid) { 938 list_del(&cset->e_cset_node[ssid]); 939 css_put(cset->subsys[ssid]); ··· 1058 1059 /* 1060 * Build the set of subsystem state objects that we want to see in the 1061 - * new css_set. while subsystems can change globally, the entries here 1062 * won't change, so no need for locking. 1063 */ 1064 for_each_subsys(ss, i) { ··· 1148 1149 /* 1150 * Always add links to the tail of the lists so that the lists are 1151 - * in choronological order. 1152 */ 1153 list_move_tail(&link->cset_link, &cgrp->cset_links); 1154 list_add_tail(&link->cgrp_link, &cset->cgrp_links); ··· 3654 3655 static int cgroup_file_open(struct kernfs_open_file *of) 3656 { 3657 - struct cftype *cft = of->kn->priv; 3658 3659 if (cft->open) 3660 return cft->open(of); ··· 3663 3664 static void cgroup_file_release(struct kernfs_open_file *of) 3665 { 3666 - struct cftype *cft = of->kn->priv; 3667 3668 if (cft->release) 3669 cft->release(of); ··· 3674 { 3675 struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; 3676 struct cgroup *cgrp = of->kn->parent->priv; 3677 - struct cftype *cft = of->kn->priv; 3678 struct cgroup_subsys_state *css; 3679 int ret; 3680 ··· 3724 3725 static __poll_t cgroup_file_poll(struct kernfs_open_file *of, poll_table *pt) 3726 { 3727 - struct cftype *cft = of->kn->priv; 3728 3729 if (cft->poll) 3730 return cft->poll(of, pt); ··· 4134 * implies that if we observe !CSS_RELEASED on @pos in this RCU 4135 * critical section, the one pointed to by its next pointer is 4136 * guaranteed to not have finished its RCU grace period even if we 4137 - * have dropped rcu_read_lock() inbetween iterations. 4138 * 4139 * If @pos has CSS_RELEASED set, its next pointer can't be 4140 * dereferenced; however, as each css is given a monotonically ··· 4382 } 4383 4384 /** 4385 - * css_task_iter_advance_css_set - advance a task itererator to the next css_set 4386 * @it: the iterator to advance 4387 * 4388 * Advance @it to the next css_set to walk. ··· 6308 * 6309 * Find the cgroup at @path on the default hierarchy, increment its 6310 * reference count and return it. Returns pointer to the found cgroup on 6311 - * success, ERR_PTR(-ENOENT) if @path doens't exist and ERR_PTR(-ENOTDIR) 6312 * if @path points to a non-directory. 6313 */ 6314 struct cgroup *cgroup_get_from_path(const char *path)
··· 244 * 245 * The default hierarchy is the v2 interface of cgroup and this function 246 * can be used to test whether a cgroup is on the default hierarchy for 247 + * cases where a subsystem should behave differently depending on the 248 * interface version. 249 * 250 * List of changed behaviors: ··· 262 * "cgroup.procs" instead. 263 * 264 * - "cgroup.procs" is not sorted. pids will be unique unless they got 265 + * recycled in-between reads. 266 * 267 * - "release_agent" and "notify_on_release" are removed. Replacement 268 * notification mechanism will be implemented. ··· 342 return !cgroup_parent(cgrp); 343 } 344 345 + /* can @cgrp become a thread root? Should always be true for a thread root */ 346 static bool cgroup_can_be_thread_root(struct cgroup *cgrp) 347 { 348 /* mixables don't care */ ··· 527 * the root css is returned, so this function always returns a valid css. 528 * 529 * The returned css is not guaranteed to be online, and therefore it is the 530 + * callers responsibility to try get a reference for it. 531 */ 532 struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp, 533 struct cgroup_subsys *ss) ··· 699 ; \ 700 else 701 702 + /* walk live descendants in pre order */ 703 #define cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) \ 704 css_for_each_descendant_pre((d_css), cgroup_css((cgrp), NULL)) \ 705 if (({ lockdep_assert_held(&cgroup_mutex); \ ··· 933 934 WARN_ON_ONCE(!list_empty(&cset->threaded_csets)); 935 936 + /* This css_set is dead. Unlink it and release cgroup and css refs */ 937 for_each_subsys(ss, ssid) { 938 list_del(&cset->e_cset_node[ssid]); 939 css_put(cset->subsys[ssid]); ··· 1058 1059 /* 1060 * Build the set of subsystem state objects that we want to see in the 1061 + * new css_set. While subsystems can change globally, the entries here 1062 * won't change, so no need for locking. 1063 */ 1064 for_each_subsys(ss, i) { ··· 1148 1149 /* 1150 * Always add links to the tail of the lists so that the lists are 1151 + * in chronological order. 1152 */ 1153 list_move_tail(&link->cset_link, &cgrp->cset_links); 1154 list_add_tail(&link->cgrp_link, &cset->cgrp_links); ··· 3654 3655 static int cgroup_file_open(struct kernfs_open_file *of) 3656 { 3657 + struct cftype *cft = of_cft(of); 3658 3659 if (cft->open) 3660 return cft->open(of); ··· 3663 3664 static void cgroup_file_release(struct kernfs_open_file *of) 3665 { 3666 + struct cftype *cft = of_cft(of); 3667 3668 if (cft->release) 3669 cft->release(of); ··· 3674 { 3675 struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; 3676 struct cgroup *cgrp = of->kn->parent->priv; 3677 + struct cftype *cft = of_cft(of); 3678 struct cgroup_subsys_state *css; 3679 int ret; 3680 ··· 3724 3725 static __poll_t cgroup_file_poll(struct kernfs_open_file *of, poll_table *pt) 3726 { 3727 + struct cftype *cft = of_cft(of); 3728 3729 if (cft->poll) 3730 return cft->poll(of, pt); ··· 4134 * implies that if we observe !CSS_RELEASED on @pos in this RCU 4135 * critical section, the one pointed to by its next pointer is 4136 * guaranteed to not have finished its RCU grace period even if we 4137 + * have dropped rcu_read_lock() in-between iterations. 4138 * 4139 * If @pos has CSS_RELEASED set, its next pointer can't be 4140 * dereferenced; however, as each css is given a monotonically ··· 4382 } 4383 4384 /** 4385 + * css_task_iter_advance_css_set - advance a task iterator to the next css_set 4386 * @it: the iterator to advance 4387 * 4388 * Advance @it to the next css_set to walk. ··· 6308 * 6309 * Find the cgroup at @path on the default hierarchy, increment its 6310 * reference count and return it. Returns pointer to the found cgroup on 6311 + * success, ERR_PTR(-ENOENT) if @path doesn't exist and ERR_PTR(-ENOTDIR) 6312 * if @path points to a non-directory. 6313 */ 6314 struct cgroup *cgroup_get_from_path(const char *path)