Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug ngx_http_upstream_fair_sched_score function. #2

Merged
merged 1 commit into from
Nov 11, 2011
Merged

Fixed a bug ngx_http_upstream_fair_sched_score function. #2

merged 1 commit into from
Nov 11, 2011

Conversation

qualtrics
Copy link

In SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta))) the ~(delta) would dominate the "bitwise or", making the calculated score ignore the number of requests the peer is currently processing.

The fix is to perform a bitwise mask on (delta) so it only affect the lower 20bits.
SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (
(delta) & SCHED_COUNTER_MAX))

In SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta))) the ~(delta) would dominate the "bitwise or", making the calculated score ignore the number of requests the peer is currently processing.

The fix is to perform a bitwise mask on ~(delta) so it only affect the lower 20bits.
SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta) & SCHED_COUNTER_MAX))
gnosek added a commit that referenced this pull request Nov 11, 2011
Fixed a bug ngx_http_upstream_fair_sched_score function.
@gnosek gnosek merged commit 7171df8 into gnosek:master Nov 11, 2011
@gnosek
Copy link
Owner

gnosek commented Nov 11, 2011

Duh. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants