On Fri, Feb 04, 2005 at 10:55:59AM +0200, Julian Anastasov wrote:
>
> Hello,
>
> I'm periodically unsubscribed from this lists (due to
> bounces?) while subscriptions to other lists are still alive and
> sometimes i'm missing interesting topics.
>
> Can you change WRR on update instead of setting mark->cw to 0,
> to clamp it to mw, sort of:
>
> if (mark->cw > mark->mw)
> mark->cw = mark->mw;
That probably is a slightly smarter approach.
As it happens, it ends up being set to mark->mw a bit
later if we reset it to 0. But your idea would allow
it to stay at its existing value if it is still valid
for the new mw.
>
> By this way we preserve the weight distribution without
> restarting it on update.
>
> Can this fix a problem where on reducing the max weight
> no dests are returned until cw reaches down to mw.
Yes, I am pretty sure that problem would be resolved.
Either with the previous two patches (which both set mark->cw to 0),
or the one below which implements your idea.
--
Horms
===== net/ipv4/ipvs/ip_vs_wrr.c 1.5 vs edited =====
--- 1.5/net/ipv4/ipvs/ip_vs_wrr.c 2004-02-19 06:03:53 +09:00
+++ edited/net/ipv4/ipvs/ip_vs_wrr.c 2005-02-04 18:58:29 +09:00
@@ -25,6 +25,8 @@
#include <net/ip_vs.h>
+static int ip_vs_wrr_update_svc(struct ip_vs_service *svc);
+
/*
* current destination pointer for weighted round-robin scheduling
*/
@@ -98,11 +100,9 @@ static int ip_vs_wrr_init_svc(struct ip_
IP_VS_ERR("ip_vs_wrr_init_svc(): no memory\n");
return -ENOMEM;
}
- mark->cl = &svc->destinations;
mark->cw = 0;
- mark->mw = ip_vs_wrr_max_weight(svc);
- mark->di = ip_vs_wrr_gcd_weight(svc);
svc->sched_data = mark;
+ ip_vs_wrr_update_svc(svc);
return 0;
}
@@ -124,6 +124,8 @@ static int ip_vs_wrr_update_svc(struct i
struct ip_vs_wrr_mark *mark = svc->sched_data;
mark->cl = &svc->destinations;
+ if (mark->cw > mark->mw)
+ mark->cw = mark->mw;
mark->mw = ip_vs_wrr_max_weight(svc);
mark->di = ip_vs_wrr_gcd_weight(svc);
return 0;
|