linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int
Date: Mon, 18 Jul 2016 11:29:33 -0700	[thread overview]
Message-ID: <CAM_iQpUHeNKGbjRY13nTp4F5fgEitQXz2W2C9GbqS+ygNhZGHg@mail.gmail.com> (raw)
In-Reply-To: <146867813621.23552.6234170020058724059.stgit@buzz>

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.

  reply	other threads:[~2016-07-18 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-16 14:08 [PATCH] net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int Konstantin Khlebnikov
2016-07-18 18:29 ` Cong Wang [this message]
2016-07-19  5:45 ` David Miller

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

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

  git send-email \
    --in-reply-to=CAM_iQpUHeNKGbjRY13nTp4F5fgEitQXz2W2C9GbqS+ygNhZGHg@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).