* Possible eHEA performance issue
@ 2007-07-20 3:02 Michael Neuling
2007-07-20 8:17 ` Thomas Klein
0 siblings, 1 reply; 2+ messages in thread
From: Michael Neuling @ 2007-07-20 3:02 UTC (permalink / raw)
To: Thomas Klein, Jan-Bernd Themann, netdev, Christoph Raisch,
Stefan Roscher, linux-ppc
Cc: anton
>From ehea_start_xmit in ehea_main.c we have:
if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
spin_lock_irqsave(&pr->netif_queue, flags);
if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
pr->p_stats.queue_stopped++;
netif_stop_queue(dev);
pr->queue_stopped = 1;
}
spin_unlock_irqrestore(&pr->netif_queue, flags);
}
Since the conditions are the same, isn't it likely that the second 'if'
is going to be taken. Hence, shouldn't the second 'unlikely' hint be
removed or even changed to likely?
Either way, some documentation here as to why it's done this way would
be useful. I assume the atomic_read is cheap compared to the
spin_unlock_irqsave, so we quickly check swqe_avail before we check it
again properly with the lock on so we can change some stuff.
Mikey
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Possible eHEA performance issue
2007-07-20 3:02 Possible eHEA performance issue Michael Neuling
@ 2007-07-20 8:17 ` Thomas Klein
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Klein @ 2007-07-20 8:17 UTC (permalink / raw)
To: Michael Neuling
Cc: Thomas Klein, Jan-Bernd Themann, netdev, Stefan Roscher,
linux-ppc, Christoph Raisch, anton
Michael Neuling wrote:
> From ehea_start_xmit in ehea_main.c we have:
>
> if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
> spin_lock_irqsave(&pr->netif_queue, flags);
> if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
> pr->p_stats.queue_stopped++;
> netif_stop_queue(dev);
> pr->queue_stopped = 1;
> }
> spin_unlock_irqrestore(&pr->netif_queue, flags);
> }
>
> Since the conditions are the same, isn't it likely that the second 'if'
> is going to be taken. Hence, shouldn't the second 'unlikely' hint be
> removed or even changed to likely?
>
> Either way, some documentation here as to why it's done this way would
> be useful. I assume the atomic_read is cheap compared to the
> spin_unlock_irqsave, so we quickly check swqe_avail before we check it
> again properly with the lock on so we can change some stuff.
>
> Mikey
Hi Mike,
good point the second if could be a likely(). The impact isn't that big
because the if statement is true in the unlikely() case that the send queue
is full - which doesn't happen often. Anyway we will modify this in one of
the next driver versions. Thanks for the hint!
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-20 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20 3:02 Possible eHEA performance issue Michael Neuling
2007-07-20 8:17 ` Thomas Klein
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).