From patchwork Sat May 16 14:14:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 27303 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 9A2E3B7069 for ; Sun, 17 May 2009 00:16:24 +1000 (EST) Received: by ozlabs.org (Postfix) id 7BE99DE0FB; Sun, 17 May 2009 00:16:24 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 14DB9DE0F9 for ; Sun, 17 May 2009 00:16:24 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754612AbZEPOQM (ORCPT ); Sat, 16 May 2009 10:16:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754112AbZEPOQM (ORCPT ); Sat, 16 May 2009 10:16:12 -0400 Received: from mail-fx0-f158.google.com ([209.85.220.158]:59455 "EHLO mail-fx0-f158.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753755AbZEPOQK (ORCPT ); Sat, 16 May 2009 10:16:10 -0400 Received: by fxm2 with SMTP id 2so2416790fxm.37 for ; Sat, 16 May 2009 07:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=z1QB26vfJrgPq57+/Ihl8rHawe4We64ILz6KM3R7jfk=; b=ORE9licTc5Dy7EhJ59u8nQ+5JLhL91TcrM0MHFM80SBy9aMrvlXDOSMLYuRF/WzdeT 00S8BN+N3OqlQDnppwwSR3704L7Ed7T4UOD5GaNPyNW4yp/EVx/l2NJdAsbHThqZIi2D WZCUfCLX6XXjFmYI9nDFlA8JF5+CzywJwNwY0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; b=DGMZ1tV+WGHXaLXLhSQiFIpcaUeWhKrFKhVVEX8vj8E8tuvx93p+FZmaskGKefNQug qYhmONTPpxB34/8IY4KfOPuSQNUw7TOPwirK/8p8AqWHV6jEypf378z8Xkr1AEDQk7be ON3zTwc/ebC76cDs1eNjbfBUZ5NYP13sbt6wY= Received: by 10.204.52.135 with SMTP id i7mr4490391bkg.154.1242483370402; Sat, 16 May 2009 07:16:10 -0700 (PDT) Received: from ami.dom.local ([79.162.157.181]) by mx.google.com with ESMTPS id g28sm4033248fkg.25.2009.05.16.07.16.08 (version=SSLv3 cipher=RC4-MD5); Sat, 16 May 2009 07:16:09 -0700 (PDT) Date: Sat, 16 May 2009 16:14:30 +0200 From: Jarek Poplawski To: Antonio Almeida Cc: netdev@vger.kernel.org, kaber@trash.net, davem@davemloft.net, devik@cdi.cz Subject: Re: HTB accuracy for high speed Message-ID: <20090516141430.GB3013@ami.dom.local> References: <298f5c050905150745p13dc226eia1ff50ffa8c4b300@mail.gmail.com> <298f5c050905150749s3597328dr8dd15adbd7a37532@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <298f5c050905150749s3597328dr8dd15adbd7a37532@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, May 15, 2009 at 03:49:31PM +0100, Antonio Almeida wrote: ... > I also note that, for HTB rate configurations over 500Mbit/s on leaf > class, when I stop the traffic, in the output of "tc -s -d class ls > dev eth1" command, I see that leaf's rate (in bits/s) is growing > instead of decreasing (as expected since I've stopped the traffic). > Rate in pps is ok and decreases until 0pps. Rate in bits/s increases > above 1000Mbit and stays there for a few minutes. After two or three > minutes it becomes 0bit. The same happens for it's ancestors (also for > root class).Here's tc output of my leaf class for this situation: > > class htb 1:108 parent 1:10 leaf 108: prio 7 quantum 1514 rate > 555000Kbit ceil 555000Kbit burst 70901b/8 mpu 0b overhead 0b cburst > 70901b/8 mpu 0b overhead 0b level 0 >  Sent 120267768144 bytes 242475339 pkt (dropped 62272599, overlimits 0 > requeues 0) >  rate 1074Mbit 0pps backlog 0b 0p requeues 0 >  lended: 242475339 borrowed: 0 giants: 0 >  tokens: 8 ctokens: 8 This looks like a regular bug. I guess it's an overflow in gen_estimator(), but I'm not sure there is nothing more. Could you try the patch below? (An offset warning when patching 2.6.25 is OK) Thanks, Jarek P. --- net/core/gen_estimator.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 9cc9f95..87f0ced 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c @@ -127,7 +127,11 @@ static void est_timer(unsigned long arg) npackets = e->bstats->packets; rate = (nbytes - e->last_bytes)<<(7 - idx); e->last_bytes = nbytes; - e->avbps += ((long)rate - (long)e->avbps) >> e->ewma_log; + if (rate > e->avbps) + e->avbps += (rate - e->avbps) >> e->ewma_log; + else + e->avbps -= (e->avbps - rate) >> e->ewma_log; + e->rate_est->bps = (e->avbps+0xF)>>5; rate = (npackets - e->last_packets)<<(12 - idx);