From: Benjamin Poirier <bpoirier@suse.de>
To: Michael Chan <mchan@broadcom.com>
Cc: Prashant Sreedharan <prashant@broadcom.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] tg3: Limit minimum tx queue wakeup threshold
Date: Thu, 21 Aug 2014 16:06:07 -0700 [thread overview]
Message-ID: <20140821230607.GB7724@f1.synalogic.ca> (raw)
In-Reply-To: <1408660355.7644.50.camel@LTIRV-MCHAN1.corp.ad.broadcom.com>
On 2014/08/21 15:32, Michael Chan wrote:
> On Thu, 2014-08-21 at 15:04 -0700, Benjamin Poirier wrote:
> > On 2014/08/19 15:00, Michael Chan wrote:
> > > On Tue, 2014-08-19 at 11:52 -0700, Benjamin Poirier wrote:
> > > > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> > > > index 3ac5d23..b11c0fd 100644
> > > > --- a/drivers/net/ethernet/broadcom/tg3.c
> > > > +++ b/drivers/net/ethernet/broadcom/tg3.c
> > > > @@ -202,7 +202,8 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
> > > > #endif
> > > >
> > > > /* minimum number of free TX descriptors required to wake up TX process */
> > > > -#define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4)
> > > > +#define TG3_TX_WAKEUP_THRESH(tnapi) max_t(u32, (tnapi)->tx_pending / 4, \
> > > > + MAX_SKB_FRAGS + 1)
> > >
> > > I think we should precompute this and store it in something like
> > > tp->tx_wake_thresh.
> >
> > I've tried this by adding the following patch at the end of the v2
> > series but I did not measure a significant latency improvement. Was
> > there another reason for the change?
>
> Just performance. The wake up threshold is checked in the tx fast path
> in both start_xmit() and tg3_tx(). I would optimize such code for speed
I don't see what you mean. The code in those two functions that used to
invoke TG3_TX_WAKEUP_THRESH is wrapped in unlikely() conditions. You
can't tell me that's the fast path ;) It's only checked when the queue
is stopped.
Moreover, the patches I've sent already add tg3_napi.wakeup_thresh. It
is over those patches that I've made the measurements.
> as much as possible. In the current code, it was just a right shift
> operation. Now, with max_t() added, I think I prefer having it
> pre-computed. The performance difference may not be measurable, but I
> think the compiled code size may be smaller too.
Maybe in certain areas, but not overall:
with v2 patches 1-3
text data bss dec hex filename
149495 1247 0 150742 24cd6 drivers/net/ethernet/broadcom/tg3.o
with v2 patches 1-3 + tx_wake_thresh_def
text data bss dec hex filename
149524 1247 0 150771 24cf3 drivers/net/ethernet/broadcom/tg3.o
I really don't see a gain.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2014-08-21 23:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 18:52 [PATCH 1/3] tg3: Limit minimum tx queue wakeup threshold Benjamin Poirier
2014-08-19 18:52 ` [PATCH 2/3] tg3: Fix tx_pending checks for tg3_tso_bug Benjamin Poirier
2014-08-19 20:56 ` Benjamin Poirier
2014-08-19 23:10 ` Michael Chan
2014-08-21 1:23 ` Benjamin Poirier
2014-08-21 9:51 ` Michael Chan
2014-08-21 21:59 ` Benjamin Poirier
2014-08-22 4:25 ` David Miller
2014-08-19 18:52 ` [PATCH 3/3] tg3: Fix tx_pending check for MAX_SKB_FRAGS Benjamin Poirier
2014-08-19 22:00 ` [PATCH 1/3] tg3: Limit minimum tx queue wakeup threshold Michael Chan
2014-08-21 22:04 ` Benjamin Poirier
2014-08-21 22:32 ` Michael Chan
2014-08-21 23:06 ` Benjamin Poirier [this message]
2014-08-21 23:26 ` Michael Chan
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=20140821230607.GB7724@f1.synalogic.ca \
--to=bpoirier@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mchan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=prashant@broadcom.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