From f866f471337e3249e0946764f09841baf73d6c9d Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Tue, 22 Jun 2021 10:26:11 +0200 Subject: bthread: add debug print for scheduler context switches When debugging around bthreads, it's often useful to log context switches. Make this easier by adding a ready-to-use pr_debug at the correct location. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20210622082617.18011-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- common/bthread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/bthread.c b/common/bthread.c index c811797130..80651344da 100644 --- a/common/bthread.c +++ b/common/bthread.c @@ -163,7 +163,10 @@ void bthread_info(void) void bthread_reschedule(void) { - bthread_schedule(list_next_entry(current, list)); + struct bthread *next = list_next_entry(current, list); + if (current != next) + pr_debug("switch %s -> %s\n", current->name, next->name); + bthread_schedule(next); } void bthread_schedule(struct bthread *to) -- cgit v1.2.3