Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161158716
D57826.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57826.diff
View Options
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -78,8 +78,8 @@
#define NICE_WEIGHT 1 /* Priorities per nice level. */
#define ESTCPULIM(e) \
min((e), INVERSE_ESTCPU_WEIGHT * \
- (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) + \
- PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) \
+ (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE - \
+ (PRIO_MAX - PRIO_MIN) * NICE_WEIGHT) \
+ INVERSE_ESTCPU_WEIGHT - 1)
#define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX)))
@@ -596,11 +596,13 @@
if (td->td_pri_class != PRI_TIMESHARE)
return;
- newpriority = PUSER +
+ newpriority = PRI_MIN_TIMESHARE +
td_get_sched(td)->ts_estcpu / INVERSE_ESTCPU_WEIGHT +
NICE_WEIGHT * (td->td_proc->p_nice - PRIO_MIN);
- newpriority = min(max(newpriority, PRI_MIN_TIMESHARE),
- PRI_MAX_TIMESHARE);
+ KASSERT(PRI_MIN_TIMESHARE <= newpriority &&
+ newpriority <= PRI_MAX_TIMESHARE,
+ ("Out-of-bounds priority, probably 'ts_estcpu' not clamped "
+ "correctly, see ESTCPULIM()"));
sched_user_prio(td, newpriority);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 2, 2:30 AM (29 m, 26 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34326988
Default Alt Text
D57826.diff (1 KB)
Attached To
Mode
D57826: sched_4bsd: Fix conflating priority of differently-niced CPU-bound threads
Attached
Detach File
Event Timeline
Log In to Comment