From 5af9fffd558e1467695ee6faed6c85172897b4e5 Mon Sep 17 00:00:00 2001 From: xiaosuGW Date: Thu, 23 Sep 2021 08:14:08 -0500 Subject: [PATCH] modify priority function for srsf: if remaining slack is negative, return 0 priority --- runtime/include/sandbox_functions.h | 5 ++++- runtime/src/global_request_scheduler_minheap.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/include/sandbox_functions.h b/runtime/include/sandbox_functions.h index 3803cc2..c4aee1a 100644 --- a/runtime/include/sandbox_functions.h +++ b/runtime/include/sandbox_functions.h @@ -105,12 +105,15 @@ sandbox_get_priority(void *element) return sandbox->absolute_deadline; }; -static inline int64_t +static inline uint64_t sandbox_get_srsf_priority(void *element) { struct sandbox *sandbox = (struct sandbox *)element; uint64_t now = __getcycles(); int64_t remaining_slack = sandbox->remaining_slack - (now - sandbox->last_update_timestamp); + if (remaining_slack < 0) { + return 0; + } return remaining_slack; }; diff --git a/runtime/src/global_request_scheduler_minheap.c b/runtime/src/global_request_scheduler_minheap.c index 94f45d8..f0c731b 100644 --- a/runtime/src/global_request_scheduler_minheap.c +++ b/runtime/src/global_request_scheduler_minheap.c @@ -71,12 +71,15 @@ sandbox_request_get_priority_fn(void *element) return sandbox_request->absolute_deadline; }; -int64_t +uint64_t sandbox_request_get_priority_srsf_fn(void *element) { struct sandbox_request *sandbox_request = (struct sandbox_request *)element; uint64_t now = __getcycles(); int64_t remaining_slack = sandbox_request->remaining_slack - (now - sandbox_request->last_update_timestamp); + if (remaining_slack < 0) { + return 0; + } return remaining_slack; };