netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: paolo.valente@unimore.it
Cc: jhs@mojatatu.com, shemminger@vyatta.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	rizzo@iet.unipi.it, fchecconi@gmail.com
Subject: Re: [PATCH] pkt_sched: QFQ Plus: fair-queueing service at DRR cost
Date: Tue, 20 Nov 2012 13:54:09 -0500 (EST)	[thread overview]
Message-ID: <20121120.135409.1810847883436963918.davem@davemloft.net> (raw)
In-Reply-To: <20121120174513.GA21618@paolo-ThinkPad-W520>

From: Paolo Valente <paolo.valente@unimore.it>
Date: Tue, 20 Nov 2012 18:45:13 +0100

> -	struct sk_buff *skb;
> +	struct sk_buff *skb = NULL;

This is not really an improvement, now the compiler can think
that NULL is passed eventually into qdisc_bstats_update().

Please make the logic easier for the compiler to digest.

For example, restructure the top-level logic into something like:

	skb = NULL;
	if (!list_empty(&in_serv_agg->active))
		skb = qfq_peek_skb(in_serv_agg, &cl, &len);
	else
		len = 0; /* no more active classes in the in-service agg */

	if (len == 0 || in_serv_agg->budget < len) {
 ...
		/*
		 * If we get here, there are other aggregates queued:
		 * choose the new aggregate to serve.
		 */
		in_serv_agg = q->in_serv_agg = qfq_choose_next_agg(q);
		skb = qfq_peek_skb(in_serv_agg, &cl, &len);
	}
	if (!skb)
		return NULL;

That way it is clearer, to both humans and the compiler, what is
going on here.

Thanks.

  reply	other threads:[~2012-11-20 18:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 17:45 [PATCH] pkt_sched: QFQ Plus: fair-queueing service at DRR cost Paolo Valente
2012-11-20 18:54 ` David Miller [this message]
2012-11-21  9:45   ` Paolo Valente
2012-11-21 17:04     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2012-11-23 21:03 Paolo Valente
2012-11-28 16:20 ` David Miller
2012-11-22 16:56 Paolo Valente
2012-11-23 19:28 ` David Miller
2012-11-23 21:02   ` Paolo Valente
2012-11-12 16:48 Paolo Valente
2012-11-19 23:48 ` David Miller
2012-11-20 17:45   ` Paolo Valente
2012-11-20 17:53     ` Stephen Hemminger
2012-11-20 18:02       ` David Miller
2012-11-20 18:09         ` Stephen Hemminger
2012-11-20 18:15           ` David Miller
2012-11-20 18:44             ` Stephen Hemminger
2012-11-20 18:00     ` 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=20121120.135409.1810847883436963918.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=fchecconi@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paolo.valente@unimore.it \
    --cc=rizzo@iet.unipi.it \
    --cc=shemminger@vyatta.com \
    /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).