Skip to content

RFC Coscheduling for Linux

Jan H. Schönherr lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest0 of 60 patches 1 replyIn review

Patches in v1 No applies recorded yet

None of the 60 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 00/60] Coscheduling for Linux
Quoted 6 lines · Jan H. Schönherr

That said, I see a hang, too. It seems to happen, when there is a cpu.scheduled!=0 group that is not a direct child of the root task group. You seem to have "/sys/fs/cgroup/cpu/machine" as an intermediate group. (The case ==0 within !=0 within the root task group works for me.)

I'm going to dive into the code.

With the patch below (which technically changes patch 55/60), the hang I experienced is gone.

Please let me know, if it works for you as well.

Regards
Jan

kernel/sched/fair.c +10 -7
index 8da2033596ff..2d8b3f9a275f 100644
@@ -7189,23 +7189,26 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
 		while (!(cfs_rq = is_same_group(se, pse))) {
 			int se_depth = se->depth;
 			int pse_depth = pse->depth;
+			bool work = false;
 
-			if (se_depth <= pse_depth && leader_of(pse) == cpu) {
+			if (se_depth <= pse_depth && __leader_of(pse) == cpu) {
 				put_prev_entity(cfs_rq_of(pse), pse);
 				pse = parent_entity(pse);
+				work = true;
 			}
-			if (se_depth >= pse_depth && leader_of(se) == cpu) {
+			if (se_depth >= pse_depth && __leader_of(se) == cpu) {
 				set_next_entity(cfs_rq_of(se), se);
 				se = parent_entity(se);
+				work = true;
 			}
-			if (leader_of(pse) != cpu && leader_of(se) != cpu)
+			if (!work)
 				break;
 		}
 
-		if (leader_of(pse) == cpu)
-			put_prev_entity(cfs_rq, pse);
-		if (leader_of(se) == cpu)
-			set_next_entity(cfs_rq, se);
+		if (__leader_of(pse) == cpu)
+			put_prev_entity(cfs_rq_of(pse), pse);
+		if (__leader_of(se) == cpu)
+			set_next_entity(cfs_rq_of(se), se);
 	}
 
 	goto done;