From e04202601d9d44abcb5bf719b422ff17226ed797 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 20 Sep 2023 08:54:46 +0200 Subject: [PATCH] client: simplify _do_resubmit() --- kernel/mars_client.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/kernel/mars_client.c b/kernel/mars_client.c index 9d3892bf..48c9d0e7 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -111,16 +111,12 @@ void _do_resubmit(struct client_channel *ch) mb(); mutex_lock(&output->mutex); - if (!list_empty(&ch->wait_list)) { + while (!list_empty(&ch->wait_list)) { struct list_head *first = READ_ONCE(ch->wait_list.next); - struct list_head *last = READ_ONCE(ch->wait_list.prev); - struct list_head *old_start = READ_ONCE(output->mref_list.next); -#define list_connect __list_del // the original routine has a misleading name: in reality it is more general - - list_connect(&output->mref_list, first); - list_connect(last, old_start); - INIT_LIST_HEAD(&ch->wait_list); + list_del_init(first); + list_add(first, &output->mref_list); + cond_resched(); } mb(); mutex_unlock(&output->mutex);