ipvs: unify the formula to estimate the overhead of processing connections
[firefly-linux-kernel-4.4.55.git] / net / netfilter / ipvs / ip_vs_lblc.c
index 4a9c8cd196902044a6bec8e38c4d7f1ab711ba13..6bf7a807649c15833f8cf46d94e87e0f839d2d19 100644 (file)
@@ -389,12 +389,7 @@ __ip_vs_lblc_schedule(struct ip_vs_service *svc)
        int loh, doh;
 
        /*
-        * We think the overhead of processing active connections is fifty
-        * times higher than that of inactive connections in average. (This
-        * fifty times might not be accurate, we will change it later.) We
-        * use the following formula to estimate the overhead:
-        *                dest->activeconns*50 + dest->inactconns
-        * and the load:
+        * We use the following formula to estimate the load:
         *                (dest overhead) / dest->weight
         *
         * Remember -- no floats in kernel mode!!!
@@ -410,8 +405,7 @@ __ip_vs_lblc_schedule(struct ip_vs_service *svc)
                        continue;
                if (atomic_read(&dest->weight) > 0) {
                        least = dest;
-                       loh = atomic_read(&least->activeconns) * 50
-                               + atomic_read(&least->inactconns);
+                       loh = ip_vs_dest_conn_overhead(least);
                        goto nextstage;
                }
        }
@@ -425,8 +419,7 @@ __ip_vs_lblc_schedule(struct ip_vs_service *svc)
                if (dest->flags & IP_VS_DEST_F_OVERLOAD)
                        continue;
 
-               doh = atomic_read(&dest->activeconns) * 50
-                       + atomic_read(&dest->inactconns);
+               doh = ip_vs_dest_conn_overhead(dest);
                if (loh * atomic_read(&dest->weight) >
                    doh * atomic_read(&least->weight)) {
                        least = dest;