Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: George Amanakis <gamanakis@gmail.com>
To: cake@lists.bufferbloat.net
Subject: [Cake]  dual-src/dsthost unfairness, only with bi-directional traffic
Date: Tue, 15 Jan 2019 14:22:00 -0500	[thread overview]
Message-ID: <20190115192200.5644-1-gamanakis@gmail.com> (raw)
In-Reply-To: <D387E590-F518-4DED-85CE-40679D51F760@heistp.net>


I think what is happening here is that if a client has flows such as "a
(bulk upload)" and "b (bulk download)", the incoming ACKs of flow "a"
compete with the incoming bulk traffic on flow "b". With compete I mean
in terms of flow selection.

So if we adjust the host_load to be the same with the bulk_flow_count of
*each* host, the problem seems to be resolved.
I drafted a patch below.

Pete's setup, tested with the patch (ingress in mbit/s):
IP1: 8down  49.18mbit/s
IP1: 1up    46.73mbit/s
IP2: 1down  47.39mbit/s
IP2: 8up    49.21mbit/s


---
 sch_cake.c | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/sch_cake.c b/sch_cake.c
index d434ae0..5c0f0e1 100644
--- a/sch_cake.c
+++ b/sch_cake.c
@@ -148,6 +148,7 @@ struct cake_host {
 	u32 dsthost_tag;
 	u16 srchost_refcnt;
 	u16 dsthost_refcnt;
+	u16 bulk_flow_count;
 };
 
 struct cake_heap_entry {
@@ -1897,10 +1898,10 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		q->last_packet_time = now;
 	}
 
+	struct cake_host *srchost = &b->hosts[flow->srchost];
+	struct cake_host *dsthost = &b->hosts[flow->dsthost];
 	/* flowchain */
 	if (!flow->set || flow->set == CAKE_SET_DECAYING) {
-		struct cake_host *srchost = &b->hosts[flow->srchost];
-		struct cake_host *dsthost = &b->hosts[flow->dsthost];
 		u16 host_load = 1;
 
 		if (!flow->set) {
@@ -1927,6 +1928,11 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		flow->set = CAKE_SET_BULK;
 		b->sparse_flow_count--;
 		b->bulk_flow_count++;
+		if (cake_dsrc(q->flow_mode))
+			srchost->bulk_flow_count++;
+
+		if (cake_ddst(q->flow_mode))
+			dsthost->bulk_flow_count++;
 	}
 
 	if (q->buffer_used > q->buffer_max_used)
@@ -2101,7 +2107,7 @@ retry:
 		host_load = max(host_load, srchost->srchost_refcnt);
 
 	if (cake_ddst(q->flow_mode))
-		host_load = max(host_load, dsthost->dsthost_refcnt);
+		host_load = max(host_load, dsthost->bulk_flow_count);
 
 	WARN_ON(host_load > CAKE_QUEUES);
 
@@ -2110,8 +2116,6 @@ retry:
 		/* The shifted prandom_u32() is a way to apply dithering to
 		 * avoid accumulating roundoff errors
 		 */
-		flow->deficit += (b->flow_quantum * quantum_div[host_load] +
-				  (prandom_u32() >> 16)) >> 16;
 		list_move_tail(&flow->flowchain, &b->old_flows);
 
 		/* Keep all flows with deficits out of the sparse and decaying
@@ -2122,6 +2126,11 @@ retry:
 			if (flow->head) {
 				b->sparse_flow_count--;
 				b->bulk_flow_count++;
+				if (cake_dsrc(q->flow_mode))
+					srchost->bulk_flow_count++;
+
+				if (cake_ddst(q->flow_mode))
+					dsthost->bulk_flow_count++;
 				flow->set = CAKE_SET_BULK;
 			} else {
 				/* we've moved it to the bulk rotation for
@@ -2131,6 +2140,8 @@ retry:
 				flow->set = CAKE_SET_SPARSE_WAIT;
 			}
 		}
+		flow->deficit += (b->flow_quantum * quantum_div[host_load] +
+				  (prandom_u32() >> 16)) >> 16;
 		goto retry;
 	}
 
@@ -2151,6 +2162,11 @@ retry:
 					       &b->decaying_flows);
 				if (flow->set == CAKE_SET_BULK) {
 					b->bulk_flow_count--;
+					if (cake_dsrc(q->flow_mode))
+						srchost->bulk_flow_count--;
+
+					if (cake_ddst(q->flow_mode))
+						dsthost->bulk_flow_count--;
 					b->decaying_flow_count++;
 				} else if (flow->set == CAKE_SET_SPARSE ||
 					   flow->set == CAKE_SET_SPARSE_WAIT) {
@@ -2164,8 +2180,14 @@ retry:
 				if (flow->set == CAKE_SET_SPARSE ||
 				    flow->set == CAKE_SET_SPARSE_WAIT)
 					b->sparse_flow_count--;
-				else if (flow->set == CAKE_SET_BULK)
+				else if (flow->set == CAKE_SET_BULK) {
 					b->bulk_flow_count--;
+					if (cake_dsrc(q->flow_mode))
+						srchost->bulk_flow_count--;
+
+					if (cake_ddst(q->flow_mode))
+						dsthost->bulk_flow_count--;
+				}
 				else
 					b->decaying_flow_count--;
 
-- 
2.20.1


  reply	other threads:[~2019-01-15 19:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01 23:04 Pete Heist
2019-01-03  3:57 ` Georgios Amanakis
2019-01-03  4:15   ` Georgios Amanakis
2019-01-03  5:18     ` Jonathan Morton
2019-01-03 10:46       ` Pete Heist
2019-01-03 11:03         ` Toke Høiland-Jørgensen
2019-01-03 13:02           ` Pete Heist
2019-01-03 13:20             ` Toke Høiland-Jørgensen
2019-01-03 16:35               ` Pete Heist
2019-01-03 18:24                 ` Georgios Amanakis
2019-01-03 22:06                 ` Pete Heist
2019-01-04  2:08                   ` Georgios Amanakis
2019-01-04  8:09                     ` Pete Heist
2019-01-04  7:37                   ` Pete Heist
2019-01-04 11:34             ` Pete Heist
2019-01-15 19:22               ` George Amanakis [this message]
2019-01-15 22:42                 ` Georgios Amanakis
2019-01-16  3:34                   ` George Amanakis
2019-01-16  3:47                     ` gamanakis
2019-01-16  7:58                       ` Pete Heist
2019-01-26  7:35                       ` Pete Heist
2019-01-28  1:34                         ` Georgios Amanakis
2019-01-18 10:06                     ` Toke Høiland-Jørgensen
2019-01-18 12:07                       ` Georgios Amanakis
2019-01-18 13:33                         ` Toke Høiland-Jørgensen
2019-01-18 13:40                           ` Sebastian Moeller
2019-01-18 14:30                             ` Toke Høiland-Jørgensen
2019-01-18 13:45                           ` Jonathan Morton
2019-01-18 14:32                             ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190115192200.5644-1-gamanakis@gmail.com \
    --to=gamanakis@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox