rqd->load += change;
rqd->load_last_update = now;
- ASSERT(rqd->avgload <= STIME_MAX && rqd->b_avgload <= STIME_MAX);
+ /* Overflow, capable of making the load look negative, must not occur. */
+ ASSERT(rqd->avgload >= 0 && rqd->b_avgload >= 0);
if ( unlikely(tb_init_done) )
{
}
svc->load_last_update = now;
+ /* Overflow, capable of making the load look negative, must not occur. */
+ ASSERT(svc->avgload >= 0);
+
if ( unlikely(tb_init_done) )
{
struct {
* If we're under 100% capacaty, only shift if load difference
* is > 1. otherwise, shift if under 12.5%
*/
- if ( load_max < (cpus_max << prv->load_precision_shift) )
+ if ( load_max < ((s_time_t)cpus_max << prv->load_precision_shift) )
{
if ( st.load_delta < (1ULL << (prv->load_precision_shift +
opt_underload_balance_tolerance)) )