Skip to contentSkip to conversation

sched/core: Optimize sched_core_next()

PATCH In review Cruz Zhao 1 participant 2 messages Apr 24, 2022 – May 10, 2022 Scheduler

lore
Share & tools
lore

Cruz Zhao

author
#0 lore raw

PATCH 1/1 sched/core: Optimize sched_core_next()

As there is __node_2_sc() defined before, just use it instead of container_of() in function sched_core_next().

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index d50d4dd..d3e3d6e 100644
@@ -284,7 +284,7 @@ static struct task_struct *sched_core_next(struct task_struct *p, unsigned long
 	if (!node)
 		return NULL;
 
-	p = container_of(node, struct task_struct, core_node);
+	p = __node_2_sc(node);
 	if (p->core_cookie != cookie)
 		return NULL;
 
Signature · 1 line
1.8.3.1
author
#1 lore raw

ping... Is this patch necessary?

Quoted 21 lines · Cruz Zhao

As there is __node_2_sc() defined before, just use it instead of container_of() in function sched_core_next().

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index d50d4dd..d3e3d6e 100644
@@ -284,7 +284,7 @@ static struct task_struct *sched_core_next(struct task_struct *p, unsigned long
 	if (!node)
 		return NULL;
 
-	p = container_of(node, struct task_struct, core_node);
+	p = __node_2_sc(node);
 	if (p->core_cookie != cookie)
 		return NULL;