[PATCH] sched_ext: Fix coding style and macro parenthesization in ext and cid

rahadbhuiya posted 1 patch 6 days, 8 hours ago
kernel/sched/ext/cid.c |  6 +++---
kernel/sched/ext/ext.c | 20 +++++++++++---------
2 files changed, 14 insertions(+), 12 deletions(-)
[PATCH] sched_ext: Fix coding style and macro parenthesization in ext and cid
Posted by rahadbhuiya 6 days, 8 hours ago
Fix several checkpatch issues in kernel/sched/ext/:

- Convert SPDX comment to C++ style in ext.c and cid.c per
  Documentation/process/license-rules.rst.
- Parenthesize SCX_CID_TOPO_NEG and scx_enabling_sub_sched macro
  definitions to avoid precedence side effects.
- Put struct initialization opening brace on the same line in
  scx_tg_online().
- Remove prohibited space before semicolon in scx_bypass().
- Add blank line after local variable declaration in
  scx_alloc_and_add_sched().

Signed-off-by: rahadbhuiya <rahadbhuiya2021@gmail.com>
---
 kernel/sched/ext/cid.c |  6 +++---
 kernel/sched/ext/ext.c | 20 +++++++++++---------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/kernel/sched/ext/cid.c b/kernel/sched/ext/cid.c
index bc4eee5bb4cb..ef0a29a88cd1 100644
--- a/kernel/sched/ext/cid.c
+++ b/kernel/sched/ext/cid.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /*
  * BPF extensible scheduler class: Documentation/scheduler/sched-ext.rst
  *
@@ -28,10 +28,10 @@ struct scx_cid_topo __rcu *scx_cid_topo;
 
 static struct scx_cid_tables *scx_cid_tables;	/* used only during alloc/free */
 
-#define SCX_CID_TOPO_NEG	(struct scx_cid_topo) {				\
+#define SCX_CID_TOPO_NEG	((struct scx_cid_topo) {			\
 	.core_cid = -1, .core_idx = -1, .llc_cid = -1, .llc_idx = -1,		\
 	.node_cid = -1, .node_idx = -1, .shard_cid = -1, .shard_idx = -1,	\
-}
+})
 
 /*
  * Return @cpu's LLC shared_cpu_map. If cacheinfo isn't populated (offline or
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 3219f0da0fe4..a807754ff1f0 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /*
  * BPF extensible scheduler class: Documentation/scheduler/sched-ext.rst
  *
@@ -129,7 +129,7 @@ static atomic64_t scx_sched_id_cursor = ATOMIC64_INIT(0);
  */
 struct scx_sched *scx_enabling_sub_sched;
 #else
-#define scx_enabling_sub_sched	(struct scx_sched *)NULL
+#define scx_enabling_sub_sched	((struct scx_sched *)NULL)
 #endif	/* CONFIG_EXT_SUB_SCHED */
 
 /*
@@ -4779,12 +4779,13 @@ int scx_tg_online(struct task_group *tg)
 			sch = scx_tg_sched(&root_task_group);
 
 		if (SCX_HAS_OP(sch, cgroup_init)) {
-			struct scx_cgroup_init_args args =
-				{ .weight = tg->scx.weight,
-				  .bw_period_us = tg->scx.bw_period_us,
-				  .bw_quota_us = tg->scx.bw_quota_us,
-				  .bw_burst_us = tg->scx.bw_burst_us,
-				  .sched_idle = tg->scx.idle };
+			struct scx_cgroup_init_args args = {
+				.weight = tg->scx.weight,
+				.bw_period_us = tg->scx.bw_period_us,
+				.bw_quota_us = tg->scx.bw_quota_us,
+				.bw_burst_us = tg->scx.bw_burst_us,
+				.sched_idle = tg->scx.idle,
+			};
 
 			ret = SCX_CALL_OP_RET(sch, cgroup_init,
 					      NULL, tg->css.cgroup, &args);
@@ -6200,7 +6201,7 @@ void scx_bypass(struct scx_sched *sch, bool bypass)
 
 			/* cycling deq/enq is enough, see the function comment */
 			scoped_guard (sched_change, p, DEQUEUE_SAVE | DEQUEUE_MOVE) {
-				/* nothing */ ;
+				/* nothing */;
 			}
 		}
 
@@ -7288,6 +7289,7 @@ struct scx_sched *scx_alloc_and_add_sched(struct scx_enable_cmd *cmd,
 
 #ifdef CONFIG_EXT_SUB_SCHED
 	char *buf = kzalloc(PATH_MAX, GFP_KERNEL);
+
 	if (!buf) {
 		ret = -ENOMEM;
 		goto err_free_lb_resched;
-- 
2.54.0.windows.1