Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1445695

Re: [PATCH] net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int

From Cong Wang <xiyou.wangcong@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int
Date 2016-07-18 20:40 +0200
Message-ID <rWlCp-1nW-1@gated-at.bofh.it> (permalink)
References <rVys1-4MB-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Jul 16, 2016 at 7:08 AM, Konstantin Khlebnikov
<khlebnikov@yandex-team.ru> wrote:
> In kernel HTB keeps tokens in signed 64-bit in nanoseconds. In netlink
> protocol these values are converted into pshed ticks (64ns for now) and
> truncated to 32-bit. In struct tc_htb_xstats fields "tokens" and "ctokens"
> are declared as unsigned 32-bit but they could be negative thus tool 'tc'
> prints them as signed. Big values loose higher bits and/or become negative.
>
> This patch clamps tokens in xstat into range from INT_MIN to INT_MAX.
> In this way it's easier to understand what's going on here.

Makes sense to me, I don't know why we didn't use signed int in
the beginning, interpreting an unsigned int as signed is confusing.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net/sched/sch_htb: clamp xstats tokens to fit into 32-bit  int Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2016-07-16 16:10 +0200
  Re: [PATCH] net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int Cong Wang <xiyou.wangcong@gmail.com> - 2016-07-18 20:40 +0200
  Re: [PATCH] net/sched/sch_htb: clamp xstats tokens to fit into  32-bit int David Miller <davem@davemloft.net> - 2016-07-19 07:50 +0200

csiph-web