Skip to contentSkip to conversation

NAPI and tg3

DISCUSSION Applied Robert Olsson 3 participants 4 messages Jan 7, 2003 – Jan 10, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · Steffen Persvold

True, but it doesn't say that if you have two applications loaded on a SMP box, one which is for example constantly receiving and sending data from/to the network and doing computations on the data (100 % CPU) while some other app is only doing computations (also 100 % CPU), the ksoftirqd which should receive packets and refill the TX and RX rings will be put last in the queue because of its low nice level (19), thus the network dependent application has very much lower performance than what could be achieved with a nice level of 0 or even running the interrupt based mechanism. A nice level of 0 on ksoftirqd is still a heck of a lot better than interrupt context isn't it ?

Yes my scripts test/production has even been setting -19 to ksoftirq just for that reason so I almost forgot this issue so I'm happy you brought this up. But dev->poll is not the only user of ksoftirq but for heavy networking it's gets pretty dominant. So we add something to NAPI_HOWTO and pass the question about ksoftirq default priority to others.

Quoted 1 line

From a GIGE router in production.

USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND

root         3  0.2  0.0     0     0  ?  RWN Aug 15 602:00 (ksoftirqd_CPU0)
root       232  0.0  7.9 41400 40884  ?  S   Aug 15  74:12 gated 

Cheers.

						--ro
#1 lore raw
Quoted 21 lines · Robert Olsson
Quoted 10 lines · Steffen Persvold

True, but it doesn't say that if you have two applications loaded on a SMP box, one which is for example constantly receiving and sending data from/to the network and doing computations on the data (100 % CPU) while some other app is only doing computations (also 100 % CPU), the ksoftirqd which should receive packets and refill the TX and RX rings will be put last in the queue because of its low nice level (19), thus the network dependent application has very much lower performance than what could be achieved with a nice level of 0 or even running the interrupt based mechanism. A nice level of 0 on ksoftirqd is still a heck of a lot better than interrupt context isn't it ?

Yes my scripts test/production has even been setting -19 to ksoftirq just for that reason so I almost forgot this issue so I'm happy you brought this up. But dev->poll is not the only user of ksoftirq but for heavy networking it's gets pretty dominant. So we add something to NAPI_HOWTO and pass the question about ksoftirq default priority to others.

Quoted 6 lines
Quoted 1 line

From a GIGE router in production.

USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND

root         3  0.2  0.0     0     0  ?  RWN Aug 15 602:00 (ksoftirqd_CPU0)
root       232  0.0  7.9 41400 40884  ?  S   Aug 15  74:12 gated 

I'm happy that atleast someone can agree on something these days, looking at the latest discussions regarding binary only drivers and GPL could make one think that all that kernel developers do is to argue about who is right (allright, most of the quarrelsome people arent't really kernel developers) ;) So, who takes the decission regarding the ksoftirqd and when ?

Best regards,
--

  Steffen Persvold   |       Scali AS      
 mailto:[email protected] |  http://www.scali.com
Tel: (+47) 2262 8950 |   Olaf Helsets vei 6
Fax: (+47) 2262 8951 |   N0621 Oslo, NORWAY
#2 lore raw

Before it's get forgotten...

Cheers.

						--ro
NAPI_HOWTO.txt renamed from NAPI_HOWTO.txt.orig +17 -0
@@ -721,6 +721,23 @@
 
 
 
+
+APPENDIX 3: Scheduling issues.
+==============================
+As seen NAPI moves processing to softirq level. Linux uses the ksoftirqd as the 
+general solution to schedule softirq's to run before next interrupt and by putting 
+them under scheduler control. Also this prevents consecutive softirq's from 
+monopolize the CPU. This also have the effect that the priority of ksoftirq needs 
+to be considered when running very CPU-intensive applications and networking to
+get the proper balance of softirq/user balance. Increasing ksoftirq priority to 0 
+(eventually more) is reported cure problems with low network performance at high 
+CPU load.
+
+Most used processes in a GIGE router:
+USER       PID %CPU %MEM  SIZE   RSS TTY STAT START   TIME COMMAND
+root         3  0.2  0.0     0     0  ?  RWN Aug 15 602:00 (ksoftirqd_CPU0)
+root       232  0.0  7.9 41400 40884  ?  S   Aug 15  74:12 gated 
+
 --------------------------------------------------------------------
 
 relevant sites: