[PATCH 2/2] netdev/fec: fix performance impact from mdio poll operation

Bryan Wu bryan.wu at canonical.com
Fri Apr 9 02:19:17 UTC 2010

Chase Douglas wrote:
> On Thu, Apr 8, 2010 at 2:44 AM, Bryan Wu <bryan.wu at canonical.com> wrote:
>> BugLink: http://bugs.launchpad.net/bugs/546649
>> BugLink: http://bugs.launchpad.net/bugs/457878
>> After introducing phylib supporting, users experienced performace drop. That is
>> because of the mdio polling operation of phylib. Use msleep to replace the busy
>> waiting cpu_relax() and remove the warning message.
> Is this performance drop in terms of overall system performance
> because of the cpu_relax loop, or network/driver performance? I'm
> assuming the former, but I want to make sure.
When we transfer some large file over the ethernet, the transfer speed 
will drop from 6MB/s to 3MB/s in my testing environment. And we also 
experienced some slow system response during the transfer.
So this cpu_relax() and timeout=10000 cause the system in busy wait for 
a mdio transaction finishing flag. It will cause the networking and 
system performance bad.

> I was going to ask whether this was safe due to the potential for
> msleep being run in an interrupt context. However, I found this
> comment which calls the read() function that is reassuring:
> http://lxr.linux.no/linux+v2.6.33/drivers/net/phy/mdio_bus.c#L201

Yeah, that's right. mdio_{read|write} cannot be called in interrupt 
context. So msleep is pretty safe here. I found other netdev drivers 
also use this method to polling.

> Although things look ok to me, I don't have enough insight into this
> driver to be able to give an Ack.

More information about the kernel-team mailing list