cgroup: Remove prohibited white spaces
PATCH 1/6 cgroup: Remove prohibited white spaces
This patch fixes the checkpatch.pl error:
ERROR: space prohibited before open square bracket
--- kernel/cgroup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/cgroup.c +4 -4
@@ -131,14 +131,14 @@ static struct workqueue_struct *cgroup_destroy_wq;static struct workqueue_struct *cgroup_pidlist_destroy_wq;/* generate an array of cgroup subsystem pointers */ -#define SUBSYS (_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys, +#define SUBSYS (_x)[_x ## _cgrp_id] = &_x ## _cgrp_subsys, static struct cgroup_subsys *cgroup_subsys[] = {#include <linux/cgroup_subsys.h> };#undef SUBSYS/* array of cgroup subsystem names */ -#define SUBSYS (_x) [_x ## _cgrp_id] = #_x, +#define SUBSYS (_x)[_x ## _cgrp_id] = #_x,static const char *cgroup_subsys_name[] = { #include <linux/cgroup_subsys.h> };
@@ -153,13 +153,13 @@ static const char *cgroup_subsys_name[] = {#include <linux/cgroup_subsys.h> #undef SUBSYS -#define SUBSYS (_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys_enabled_key, +#define SUBSYS (_x)[_x ## _cgrp_id] = &_x ## _cgrp_subsys_enabled_key, static struct static_key_true *cgroup_subsys_enabled_key[] = {#include <linux/cgroup_subsys.h> };#undef SUBSYS -#define SUBSYS (_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys_on_dfl_key, +#define SUBSYS (_x)[_x ## _cgrp_id] = &_x ## _cgrp_subsys_on_dfl_key,static struct static_key_true *cgroup_subsys_on_dfl_key[] = { #include <linux/cgroup_subsys.h> };
Signature · 1 line
2.6.2
A message that is not in the archive (sent off-list or not yet received): 1450182045-27480-1-git-send-email-kuba.kunert-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/6 cgroup: Fix line length to 80 characters
Fix checkpatch.pl warnings with lines over 80 characters.
--- kernel/cgroup.c | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-)
kernel/cgroup.c +32 -19
@@ -144,11 +144,13 @@ static const char *cgroup_subsys_name[] = { };#undef SUBSYS -/* array of static_keys for cgroup_subsys_enabled() and cgroup_subsys_on_dfl() */ -#define SUBSYS (_x) \ - DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_enabled_key); \ - DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_on_dfl_key); \ - EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key); \ +/* +* array of static_keys for cgroup_subsys_enabled() and cgroup_subsys_on_dfl() +*/ +#define SUBSYS (_x) \ + DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_enabled_key); \ + DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_on_dfl_key); \ + EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key); \ EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_on_dfl_key);#include <linux/cgroup_subsys.h> #undef SUBSYS
@@ -682,7 +684,8 @@ static void css_set_update_populated(struct css_set *cset, bool populated)* @from_cset and @to_cset's reference counts. */ static void css_set_move_task (struct task_struct *task, -struct css_set *from_cset,struct css_set *to_cset, +struct css_set *from_cset, +struct css_set *to_cset,bool use_mg_tasks) {lockdep_assert_held (&css_set_lock);
@@ -723,8 +726,8 @@ static void css_set_move_task(struct task_struct *task,if (!css_set_populated (to_cset))css_set_update_populated (to_cset, true);rcu_assign_pointer (task->cgroups, to_cset); -list_add_tail (&task->cg_list, use_mg_tasks ? &to_cset->mg_tasks : - &to_cset->tasks); +list_add_tail (&task->cg_list, + use_mg_tasks ? &to_cset->mg_tasks : &to_cset->tasks); } }
@@ -2402,7 +2405,8 @@ static int cgroup_taskset_migrate(struct cgroup_taskset *tset,*/ spin_lock_bh (&css_set_lock);list_for_each_entry (cset, &tset->src_csets, mg_node) { -list_for_each_entry_safe (task, tmp_task, &cset->mg_tasks, cg_list) { +list_for_each_entry_safe (task, tmp_task, + &cset->mg_tasks, cg_list) {struct css_set *from_cset =task_css_set (task);struct css_set *to_cset = cset->mg_dst_cset;
@@ -2464,7 +2468,8 @@ static void cgroup_migrate_finish(struct list_head *preloaded_csets)lockdep_assert_held (&cgroup_mutex);spin_lock_bh (&css_set_lock); -list_for_each_entry_safe (cset, tmp_cset, preloaded_csets, mg_preload_node) { +list_for_each_entry_safe (cset, tmp_cset, preloaded_csets, + mg_preload_node) { cset->mg_src_cgrp =NULL ; cset->mg_dst_cset =NULL ;list_del_init (&cset->mg_preload_node);
@@ -2545,7 +2550,8 @@ static int cgroup_migrate_prepare_dst(struct cgroup *dst_cgrp,return -EBUSY ;/* look up the dst cset for each src cset and link it to src */ -list_for_each_entry_safe (src_cset, tmp_cset, preloaded_csets, mg_preload_node) { +list_for_each_entry_safe (src_cset, tmp_cset, preloaded_csets, + mg_preload_node) {struct css_set *dst_cset; dst_cset = find_css_set(src_cset,
@@ -3007,7 +3013,8 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,/* unavailable or not enabled on the parent? */ if (!(cgrp_dfl_root.subsys_mask & (1 << ssid)) || (cgroup_parent (cgrp) && - !(cgroup_parent (cgrp)->subtree_control & (1 << ssid)))) { + !(cgroup_parent (cgrp)->subtree_control & + (1 << ssid)))) { ret = -ENOENT ; goto out_unlock; }
@@ -3677,9 +3684,11 @@ struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,* races against release and the race window is very small. */ if (!pos) { - next = list_entry_rcu(parent->children.next, struct cgroup_subsys_state, sibling); + next =list_entry_rcu (parent->children.next, + struct cgroup_subsys_state, sibling); }else if (likely (!(pos->flags &CSS_RELEASED ))) { - next = list_entry_rcu(pos->sibling.next, struct cgroup_subsys_state, sibling); + next =list_entry_rcu (pos->sibling.next, + struct cgroup_subsys_state, sibling); }else {list_for_each_entry_rcu (next, &parent->children, sibling)if (next->serial_nr > pos->serial_nr)
@@ -4152,7 +4161,8 @@ static void cgroup_pidlist_destroy_all(struct cgroup *cgrp)mutex_lock (&cgrp->pidlist_mutex);list_for_each_entry_safe (l, tmp_l, &cgrp->pidlists, links) -mod_delayed_work (cgroup_pidlist_destroy_wq, &l->destroy_dwork,0 ); +mod_delayed_work (cgroup_pidlist_destroy_wq, + &l->destroy_dwork,0 );mutex_unlock (&cgrp->pidlist_mutex);flush_workqueue (cgroup_pidlist_destroy_wq);
@@ -4968,7 +4978,8 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, cgrp->self.serial_nr = css_serial_nr_next++;/* allocation complete, commit to creation */ -list_add_tail_rcu (&cgrp->self.sibling, &cgroup_parent (cgrp)->self.children); +list_add_tail_rcu (&cgrp->self.sibling, + &cgroup_parent (cgrp)->self.children);atomic_inc (&root->nr_cgrps);cgroup_get (parent);
@@ -5337,7 +5348,8 @@ int __init cgroup_init(void)WARN_ON (cgroup_add_cftypes (ss, ss->dfl_cftypes)); }else {WARN_ON (cgroup_add_dfl_cftypes (ss, ss->dfl_cftypes)); -WARN_ON (cgroup_add_legacy_cftypes (ss, ss->legacy_cftypes)); +WARN_ON (cgroup_add_legacy_cftypes (ss, + ss->legacy_cftypes)); }if (ss->bind)
@@ -5408,8 +5420,9 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,if (root != &cgrp_dfl_root)for_each_subsys (ss, ssid)if (root->subsys_mask & (1 << ssid)) -seq_printf (m,"%s%s" , count++ ?"," :"" , - ss->legacy_name); +seq_printf (m,"%s%s" , + count++ ?"," :"" , + ss->legacy_name);if (strlen (root->name))seq_printf (m,"%sname=%s" , count ?"," :"" , root->name);
Signature · 1 line
2.6.2
A message that is not in the archive (sent off-list or not yet received): 1450182045-27480-2-git-send-email-kuba.kunert-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/6] cgroup: Fix line length to 80 characters
Quoted 1 line · Jakub Kunert
Fix checkpatch.pl warnings with lines over 80 characters.
Again, checkpatch.pl isn't ten commandments. I'm gonna skip the rest of the patchset. If you think there are salvegeable changes in this series, please actually think about them and resend separately.
Signature · 1 line
tejun
PATCH 3/6 cgroup: Fix trailing */ in block comments.
In reply to a message not in the archiveFix checkpatch.pl warning:
WARNING: Block comments use a trailing */ on a separate line
--- kernel/cgroup.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
kernel/cgroup.c +16 -8
@@ -1015,8 +1015,10 @@ static struct css_set *find_css_set(struct css_set *old_cset,lockdep_assert_held (&cgroup_mutex); -/* First see if we already have a cgroup group that matches -* the desired set */ +/* +* First see if we already have a cgroup group that matches +* the desired set +*/ spin_lock_bh (&css_set_lock); cset =find_existing_css_set (old_cset, cgrp, template);if (cset)
@@ -1045,8 +1047,10 @@ static struct css_set *find_css_set(struct css_set *old_cset,INIT_LIST_HEAD (&cset->task_iters);INIT_HLIST_NODE (&cset->hlist); -/* Copy the set of subsystem state objects generated in -* find_existing_css_set() */ +/* +* Copy the set of subsystem state objects generated in +* find_existing_css_set() +*/ memcpy (cset->subsys, template,sizeof (cset->subsys));spin_lock_bh (&css_set_lock);
@@ -5227,10 +5231,12 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early)BUG_ON (css->id <0 ); } -/* Update the init_css_set to contain a subsys +/* +* Update the init_css_set to contain a subsys * pointer to this state - since the subsystem is * newly registered, all tasks and hence the -* init_css_set is in the subsystem's root cgroup. */ +* init_css_set is in the subsystem's root cgroup. +*/ init_css_set.subsys[ss->id] = css; have_fork_callback |= (bool )ss->fork << ss->id;
@@ -5238,9 +5244,11 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early) have_free_callback |= (bool )ss->free << ss->id; have_canfork_callback |= (bool )ss->can_fork << ss->id; -/* At system boot, before all subsystems have been +/* +* At system boot, before all subsystems have been * registered, no tasks have been forked, so we don't -* need to invoke fork callbacks here. */ +* need to invoke fork callbacks here. +*/ BUG_ON (!list_empty (&init_task.tasks));BUG_ON (online_css (css));
Signature · 1 line
2.6.2
PATCH 4/6 cgroup: Add blank lines after declarations.
In reply to a message not in the archiveFix checkpatch.pl warnings:
WARNING: Missing a blank line after declarations
--- kernel/cgroup.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/cgroup.c +5 -0
@@ -1688,6 +1688,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)/* Must match [\w.-]+ */ for (i =0 ; i <strlen (name); i++) {char c = name[i]; +if (isalnum (c))continue ;if ((c =='.' ) || (c =='-' ) || (c =='_' ))
@@ -3228,11 +3229,13 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,if (cft->write_u64) {unsigned long long v; + ret =kstrtoull (buf,0 , &v);if (!ret) ret = cft->write_u64 (css, cft, v); }else if (cft->write_s64) {long long v; + ret =kstrtoll (buf,0 , &v);if (!ret) ret = cft->write_s64 (css, cft, v);
@@ -4493,6 +4496,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos)while (index < end) {int mid = (index + end) /2 ; +if (cgroup_pid_fry (cgrp, l->list[mid]) == pid) { index = mid;break ;
@@ -5520,6 +5524,7 @@ static void **subsys_canfork_priv_p(void *ss_priv[CGROUP_CANFORK_COUNT], int i)static void *subsys_canfork_priv (void *ss_priv[CGROUP_CANFORK_COUNT ],int i) {void **private =subsys_canfork_priv_p (ss_priv, i); +return private ? *private :NULL ; }
Signature · 1 line
2.6.2
PATCH 5/6 cgroup: Replace printk(KERN_INFO) with pr_info().
In reply to a message not in the archiveFix checkpatch.pl warning.
Replace printk(KERN_INFO...) with pr_info().
--- kernel/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/cgroup.c +2 -2
@@ -5207,7 +5207,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early) {struct cgroup_subsys_state *css; -printk (KERN_INFO "Initializing cgroup subsys %s\n" , ss->name); +pr_info ("Initializing cgroup subsys %s\n" , ss->name);mutex_lock (&cgroup_mutex);
@@ -5346,7 +5346,7 @@ int __init cgroup_init(void)*/ if (cgroup_disable_mask & (1 << ssid)) {static_branch_disable (cgroup_subsys_enabled_key[ssid]); -printk (KERN_INFO "Disabling %s control group subsystem\n" , +pr_info ("Disabling %s control group subsystem\n" , ss->name);continue ; }
Signature · 1 line
2.6.2
PATCH 6/6 cgroup: Move constant to the right site of comparison.
In reply to a message not in the archiveFix checkpatch.pl warning.
--- kernel/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup.c +1 -1
@@ -5516,7 +5516,7 @@ static const struct file_operations proc_cgroupstats_operations = {static void **subsys_canfork_priv_p (void *ss_priv[CGROUP_CANFORK_COUNT ],int i) { -if (CGROUP_CANFORK_START <= i && i <CGROUP_CANFORK_END ) +if (i >=CGROUP_CANFORK_START && i <CGROUP_CANFORK_END )return &ss_priv[i -CGROUP_CANFORK_START ];return NULL ; }
Signature · 1 line
2.6.2
Hello, Jakub.
Quoted 5 lines · Jakub Kunert
This patch fixes the checkpatch.pl error:
ERROR: space prohibited before open square bracket
Signed-off-by Jakub Kunert <[email protected]>
...
kernel/cgroup.c static struct workqueue_struct *cgroup_destroy_wq; · line 134
Quoted 3 lines
/* generate an array of cgroup subsystem pointers */
kernel/cgroup.c +1
-1-#define SUBSYS (_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys, +#define SUBSYS (_x)[_x ## _cgrp_id] = &_x ## _cgrp_subsys,
Don't follow the checkpatch.pl output without thinking. No space before opening brackets rule clearly isn't for cases like above.
Signature · 1 line
tejun
Hi Jakub,
Quoted 4 lines · Jakub Kunert
This patch fixes the checkpatch.pl error:
ERROR: space prohibited before open square bracket
checkpatch.pl should be used to check patches that are going to be sent to the mailing list, and normally should not be used to check againt existing code.