diff options
author | dufault <dufault@FreeBSD.org> | 1998-05-19 21:11:53 +0000 |
---|---|---|
committer | dufault <dufault@FreeBSD.org> | 1998-05-19 21:11:53 +0000 |
commit | 9feb27237255a180d341b3412632902b6444e5db (patch) | |
tree | 06c73759b39ea07ecd0f30e9daad61d026283c8f /sys/kern/ksched.c | |
parent | c3a59be9e05f46a91db89ccc0c0e8f5d5502c8dc (diff) | |
download | FreeBSD-src-9feb27237255a180d341b3412632902b6444e5db.zip FreeBSD-src-9feb27237255a180d341b3412632902b6444e5db.tar.gz |
1. Add new defs for mins and maxs for the POSIX flavor priorities. They
end up being the same, but it doesn't look like you're comparing
apples and oranges.
2. Use need_resched instead of reset_priority. This isn't right
either, since for example you'll round-robin against equal priority FIFO
processes when lowering the priority of another process,
but this works better and a real fix needs to be in kern_synch and
not out here.
3. This is not a device driver: copyin/copyout the structure.
Diffstat (limited to 'sys/kern/ksched.c')
-rw-r--r-- | sys/kern/ksched.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c index 20c5c57..3718e253 100644 --- a/sys/kern/ksched.c +++ b/sys/kern/ksched.c @@ -87,6 +87,11 @@ int ksched_detach(struct ksched *p) #define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P)) #define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P)) +/* These improve readability a bit for me: + */ +#define P1B_PRIO_MIN rtpprio_to_p4prio(RTP_PRIO_MAX) +#define P1B_PRIO_MAX rtpprio_to_p4prio(RTP_PRIO_MIN) + static __inline int getscheduler(int *ret, struct ksched *ksched, struct proc *p) { @@ -155,15 +160,15 @@ int ksched_setscheduler(int *ret, struct ksched *ksched, case SCHED_RR: case SCHED_FIFO: - if (param->sched_priority >= RTP_PRIO_MIN && - param->sched_priority <= RTP_PRIO_MAX) + if (param->sched_priority >= P1B_PRIO_MIN && + param->sched_priority <= P1B_PRIO_MAX) { + rtp.prio = p4prio_to_rtpprio(param->sched_priority); rtp.type = (policy == SCHED_FIFO) ? RTP_PRIO_FIFO : RTP_PRIO_REALTIME; - rtp.prio = p4prio_to_rtpprio(param->sched_priority); p->p_rtprio = rtp; - (void)resetpriority(p); + need_resched(); } else e = EPERM; @@ -183,7 +188,7 @@ int ksched_setscheduler(int *ret, struct ksched *ksched, * on the scheduling code: You must leave the * scheduling info alone. */ - (void)resetpriority(p); + need_resched(); } break; } @@ -234,7 +239,7 @@ int ksched_get_priority_min(int *ret, struct ksched *ksched, int policy) { case SCHED_FIFO: case SCHED_RR: - *ret = RTP_PRIO_MIN; + *ret = P1B_PRIO_MIN; break; case SCHED_OTHER: |