[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] lib/uksched: Make waiting queue act like actual queues


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 3 Jun 2019 16:40:08 +0300
  • Cc: Florian.Schmidt@xxxxxxxxx
  • Delivery-date: Mon, 03 Jun 2019 13:40:27 +0000
  • Ironport-phdr: 9a23:1CSKvxPAqtRRlhpaPEIl6mtUPXoX/o7sNwtQ0KIMzox0Iv3zrarrMEGX3/hxlliBBdydt6sdzbON7Ou+ACQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTagfL9+Ngi6oAvTu8UZgIZuN7s6xwfUrHdPZ+lY335jK0iJnxb76Mew/Zpj/DpVtvk86cNOUrj0crohQ7BAAzsoL2465MvwtRneVgSP/WcTUn8XkhVTHQfI6gzxU4rrvSv7sup93zSaPdHzQLspVzmu87tnRRn1gyoBKjU38nzYitZogaxbvhyvuhJxzY3TboyOKPZyYrnQcc8ASGZdQspcUTFKDIOmb4sICuoMJfhVr47mp1sSrBu+AxSnCuXyyj9Qm3/9wKo33PgmEQHdwAwgHtQOvG7QrNXoLKcSTPu4w7XTzTnZd/NWxCzy5JLSchAmuPyBW697f8nJyUQ3Cg/IgUicpZbmMj6VzOgBrXaX4uh6We+hk2Irtg58riW1ysovioTFnJwZx17K+Clj3Yo4KsO0RUhmatC+CpRQrTuVN45uT8MnRGFnpTg1x6UduZ6+YCgK0JMnxwPDa/Cfc4iH/BbjVOGJLDdmgXJqYrO/hxKo/Ue80e3wTNG00EtRoSZfiNnMsWgB1x3V6seZVvtw5lqt1DmS2wzJ6exJIVo4mbTFJ5Mj2LI9mIIfsUHZES/3nEX2grWWdkIh+uWw9+vnZa7mpoOdN49ykA3+NrkumtSiAekjLgcORHKX+fyh1LL450H5WrJKguUskqbFqJDaOdgbpqmhDg9Q04Yj7Re/DzC90NgBgHYIMkxFdwyDj4XyP1HOIev4Deukg1i2nzZk2fbGMqfmApXXIXjJiK3hcqpl605A1AozyshS6ZJQCrEGOvLzW1X+tNrCAhEkLwO0w+PnCNRg2YMCQm+PBLGWP7/WsVCS/e0jOfeDZJJG8Ar6fv0k4f/pljo1lEEQeYGt3IALczaoE/IgJF+WMlT2hdJUOmARogs4BMj3kEDKBTVUfGqzWeQ4+ykmIIm9S5/eTMa3h+rSj2+AApRKazUeWRi3GnDyetDcVg==
  • Ironport-sdr: 84y4WVDfpkQFE/4icGpPeckAZZvyP26NuzsF7Dfqb09+9I80L7PQ7c7tgJ/kcsTPjxQ7SkuKGo zjrF5yanNxjA==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Waiting queues were used as stacks (LIFO) instead of queues (FIFO). The
last added thread was the first one to be woken up which violates the
fairness quality of waiting queues. This patch fixes that by adding the
last added thread at the end of the queue.

The pthread-embedded library provides a test which verifies this propery
- the rwlock6 test.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uksched/include/uk/wait.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/uksched/include/uk/wait.h b/lib/uksched/include/uk/wait.h
index bf0e0c5c..94dae16f 100644
--- a/lib/uksched/include/uk/wait.h
+++ b/lib/uksched/include/uk/wait.h
@@ -60,7 +60,7 @@ void uk_waitq_add(struct uk_waitq *wq,
                struct uk_waitq_entry *entry)
 {
        if (!entry->waiting) {
-               UK_STAILQ_INSERT_HEAD(wq, entry, thread_list);
+               UK_STAILQ_INSERT_TAIL(wq, entry, thread_list);
                entry->waiting = 1;
        }
 }
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.