summaryrefslogtreecommitdiff
path: root/kern/macros.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-01-11 23:49:23 +0100
committerRichard Braun <rbraun@sceen.net>2013-01-11 23:49:23 +0100
commit644a177521a390133c98b9de83934a25e2be4f67 (patch)
tree186d4c4d5b23b4e0a94460ecb75e7a1f910a249f /kern/macros.h
parentfb1b8cf4f196903f770ce9b0274423626c145517 (diff)
kern/thread: improve processor-local scheduling
This change introduces scheduling classes, including support for real-time and time-sharing threads. The real-time class matches the requirements of the POSIX SCHED_FIFO and SCHED_RR policies. The time-sharing class makes use of a scheduling algorithm based on group ratio round-robin (GR3) to provide proportional fairness.
Diffstat (limited to 'kern/macros.h')
-rw-r--r--kern/macros.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/kern/macros.h b/kern/macros.h
index 012dd15b..8e04d72b 100644
--- a/kern/macros.h
+++ b/kern/macros.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010 Richard Braun.
+ * Copyright (c) 2009, 2010, 2013 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,6 +44,8 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define DIV_CEIL(n, d) (((n) + (d) - 1) / (d))
+
#define P2ALIGNED(x, a) (((x) & ((a) - 1)) == 0)
#define ISP2(x) P2ALIGNED(x, x)
#define P2ALIGN(x, a) ((x) & -(a))