Bug 197923 - [patch] [sched] Fix comment in sched_balance_pair and move load check ahead of lock
Summary: [patch] [sched] Fix comment in sched_balance_pair and move load check ahead o...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL: https://github.com/AstrodogInc/freebs...
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2015-02-22 15:40 UTC by Harrison Grundy
Modified: 2015-02-23 13:09 UTC (History)
3 users (show)

See Also:


Attachments
Fix comment in sched_balance_pair and move load check ahead of lock (928 bytes, patch)
2015-02-22 15:40 UTC, Harrison Grundy
no flags Details | Diff
Updated Patch (929 bytes, patch)
2015-02-22 16:53 UTC, Harrison Grundy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Harrison Grundy 2015-02-22 15:40:48 UTC
Created attachment 153318 [details]
Fix comment in sched_balance_pair and move load check ahead of lock

Comment in sched_balance_pair suggests that it may balance more than one thread at a time, while tdq_move operates on only one thread.

Also move load check to before tdq_lock_pair, as the tdq lock is not required to
check load.
Comment 1 Ivan Klymenko 2015-02-22 16:28:55 UTC
(In reply to Harrison Grundy from comment #0)
-	if (high->tdq_load <= low->tdq_load)
-		return(0)
+	if (high->tdq_load <= low->tdq_load)
+		return(0);
Comment 2 Harrison Grundy 2015-02-22 16:53:01 UTC
Created attachment 153321 [details]
Updated Patch

Thanks Ivan.
Comment 3 Ivan Klymenko 2015-02-23 13:04:10 UTC
Maybe still "high-> tdq_transferable! = 0" because "tdq_transferable - transferable thread count". And if the counter is already 0, then the thread can not be transferable?
Comment 4 Harrison Grundy 2015-02-23 13:09:25 UTC
It still checks that in the lower if. We can't check tdq_transferable without the lock.