From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-13-ewr.dyndns.com (mxout-160-ewr.mailhop.org [216.146.33.160]) by lists.bufferbloat.net (Postfix) with ESMTP id F2F672E0047 for ; Fri, 25 Feb 2011 10:22:22 -0800 (PST) Received: from scan-12-ewr.mailhop.org (scan-12-ewr.local [10.0.141.230]) by mail-13-ewr.dyndns.com (Postfix) with ESMTP id 134D7A4D098 for ; Fri, 25 Feb 2011 18:22:05 +0000 (UTC) X-Spam-Score: -1.0 (-) X-Mail-Handler: MailHop by DynDNS X-Originating-IP: 209.85.214.43 Received: from mail-bw0-f43.google.com (mail-bw0-f43.google.com [209.85.214.43]) by mail-13-ewr.dyndns.com (Postfix) with ESMTP id A7AB3A4CFBB for ; Fri, 25 Feb 2011 18:22:04 +0000 (UTC) Received: by bwz14 with SMTP id 14so2767369bwz.16 for ; Fri, 25 Feb 2011 10:22:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.74.74 with SMTP id t10mr2380811bkj.161.1298658111259; Fri, 25 Feb 2011 10:21:51 -0800 (PST) Sender: njs@vorpus.org Received: by 10.204.54.4 with HTTP; Fri, 25 Feb 2011 10:21:50 -0800 (PST) In-Reply-To: <20110223222842.GA20039@tuxdriver.com> References: <1297907356-3214-1-git-send-email-linville@tuxdriver.com> <1298064074-8108-1-git-send-email-linville@tuxdriver.com> <20110221184716.GD9650@tuxdriver.com> <20110223222842.GA20039@tuxdriver.com> Date: Fri, 25 Feb 2011 10:21:50 -0800 X-Google-Sender-Auth: Ku6zi_zrr5yB0mif0Cleg4FK1Qc Message-ID: Subject: Re: [RFC v2] mac80211: implement eBDP algorithm to fight bufferbloat From: Nathaniel Smith To: "John W. Linville" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: bloat-devel@lists.bufferbloat.net, johannes@sipsolutions.net, linux-wireless@vger.kernel.org X-BeenThere: bloat-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Developers working on AQM, device drivers, and networking stacks" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2011 18:22:23 -0000 On Wed, Feb 23, 2011 at 2:28 PM, John W. Linville wrote: > On Mon, Feb 21, 2011 at 03:26:32PM -0800, Nathaniel Smith wrote: >> But for this calculation to make sense, we need T to be the time it >> takes the card to transmit 1 fragment. In your patch, you're not >> measuring that. You're measuring the total time between when a packet >> is enqueued and when it is transmitted; if there were K packets in the >> queue ahead of it, then this is the time to send *all* of them -- >> you're measuring (K+1)*T. That's why in my patch, I recorded the >> current size of the queue when each packet is enqueued, so I could >> compute T =3D total_time / (K+1). > > Thanks for the math! =C2=A0I think I see what you are saying now. =C2=A0S= ince the > measured time is being used to determine the queue size, we need to > factor-in the length of the queue that resulted in that measurment. > > Unfortunately, I'm not sure how to apply this with the technique I > am using for the timing measurements. :-( =C2=A0I'll have to think about > this some more... I guess an ugly but effective approach would be to steal some bits from the timestamp... something like (untested, and probably needs some sign-extension bugs fixed): #define LATENCY_BITS 8 #define ENQUEUED_BITS 24 BUILD_BUG_ON(LATENCY_BITS + ENQUEUED_BITS !=3D 32); static ktime_t _ktime_get_and_stash(int enqueued) { timespec now =3D ktime_to_timespec(ktime_get()); now.sec &=3D (1 << LATENCY_BITS) - 1; BUG_ON(enqueued > (1 << ENQUEUED_BITS)); now.sec |=3D enqueued << LATENCY_BITS; return timespec_to_ktime(now); } static u64 _ktime_diff_to_now_and_unstash(ktime_t then, int * enqueued) { timespec ts_then =3D ktime_to_timespec(then); timespec ts_now =3D ktime_to_timespec(ktime_get()); *enqueued =3D ts_then.tv_sec >> LATENCY_BITS; ts_then.tv_sec &=3D (1 << LATENCY_BITS) - 1; ts_now.tv_sec &=3D (1 << LATENCY_BITS) - 1; if (ts_now.tv_sec < ts_then.tv_sec) ts_now.tv_sec +=3D (1 << LATENCY_BITS); timespec_sub(ts_now, ts_then); }