# idlepoll 100 % CPU usage



## theone4u (Dec 22, 2010)

Dear FreeBSD Lovers,

I am running FreeBSD 8.1 as Router for FIREWALL, Bandwidth Management (IPFW+Dummynet). For performance I turn on polling on Broadcom BCM5701 Gigabit Ethernet (BCM5701) which is my LAN end but it starts dropping 2 out of 10 ICMP packets and delay in response. My FreeBSD 8.1 Kernel support Device Polling. To solve this issue enable *kern.polling.idle_poll=1*. Now ICMP is ok and now delay in traffic but is using 100% of CPU. 1000 to 2000 Clients/IP's traffic is passing though it.

CHECK out the *# top -HSP* output:

```
last pid:  2857;  load averages:  1.00,  1.00,  1.00                                                            up 0+08:41:26  01:13:31
56 processes:  3 running, 41 sleeping, 12 waiting
CPU:  0.4% user,  0.0% nice, 98.1% system,  1.5% interrupt,  0.0% idle
Mem: 8044K Active, 6812K Inact, 40M Wired, 13M Buf, 937M Free
Swap: 2012M Total, 2012M Free

  PID USERNAME PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
   14 root     171 ki-6     0K     8K RUN    392:40 99.76% idlepoll
    0 root     -68    0     0K    72K -        7:18  1.95% {em1 taskq}
   12 root     -44    -     0K    96K WAIT    64:36  0.10% {swi1: netisr 0}
    0 root     -68    0     0K    72K -       52:34  0.00% {dummynet}
   12 root     -32    -     0K    96K WAIT     1:56  0.00% {swi4: clock}
   13 root     -16    -     0K     8K -        1:09  0.00% yarrow
    0 root      76    0     0K    72K sched    0:48  0.00% {swapper}
   19 root      44    -     0K     8K flowcl   0:18  0.00% flowcleaner
 1360 root      44    0  9500K  5352K select   0:11  0.00% snmpd
   11 root     171 ki31     0K     8K RUN      0:03  0.00% idle
    2 root      -8    -     0K     8K -        0:01  0.00% g_event
   16 root     -16    -     0K     8K syncer   0:00  0.00% syncer
    4 root      -8    -     0K     8K -        0:00  0.00% g_down
   18 root     -16    -     0K     8K sdflus   0:00  0.00% softdepflush
    3 root      -8    -     0K     8K -        0:00  0.00% g_up
 2773 root      44    0  9428K  4440K select   0:00  0.00% sshd
    0 root     -68    0     0K    72K -        0:00  0.00% {em0 taskq}
```
 
My FreeBSD 8.1 Router Hardware Specs are:


```
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (2992.51-MHz 686-class CPU)
IntelÂ® Server Board SE7230NH1-E  
1 GB non-ECC DDR2 RAM
bge0 = Broadcom BCM5701 Gigabit Ethernet (BCM5701) ## for LAN  
em0 = Intel PCIE Gigabit Ethernet (PC82573V) ## Proxy End
em1 = Intel Gigabit Ethernet Controller (82541EI) ## WAN END
```

I need advice about 100% CPU usage and how to make idlepoll process not to use more then 25% of CPU time or usage.

Thanks in advance.

TheOne4u


----------



## gordon@ (Dec 22, 2010)

Why use polling at all? Is the interrupt version not working well enough?


----------



## SirDice (Dec 23, 2010)

What's the current setting of kern.hz?


----------



## Alt (Dec 23, 2010)

Its all ok, if you set kern.polling.idle_poll=1, your system will have 0% idle -- its repeatly polling.
But, afaik this should not damage processes speed/working - he just polling when cpu is free, this showing in stat as cpu load.



			
				theone4u said:
			
		

> I need advice about 100% CPU usage and how to make idlepoll process not to use more then 25% of CPU time or usage.


Again, he is polling when cpu is idle, eating that idle, not eating other processes cpu time. Afaik, there is no way to set to 25%


----------



## theone4u (Dec 23, 2010)

gordon@ said:
			
		

> Why use polling at all? Is the interrupt version not working well enough?



interrupts were using more then 50% of CPU and on load it was dropping ICMP request.


----------



## theone4u (Dec 23, 2010)

SirDice said:
			
		

> What's the current setting of kern.hz?



kern.hz = 1000


----------



## SirDice (Dec 23, 2010)

Try turning off the idle_polling and play a bit with kern.hz. See polling(4) for more information.


----------



## theone4u (Dec 25, 2010)

SirDice said:
			
		

> Try turning off the idle_polling and play a bit with kern.hz. See polling(4) for more information.



Well I have played a lot with it as I configure it to 2000 and now back to 1000.

But I have another server with same rule as router have INTEL GIGA LAN Cards ... I donnot why the process em0 taskq is eating to much fo cpu even with polling.


----------



## Alt (Dec 25, 2010)

Do you have many rules in ipfw?


----------



## theone4u (Dec 27, 2010)

Alt said:
			
		

> Do you have many rules in ipfw?



Yes total rules are 263 and out of these 263 we have 128 dummynet pipes.


----------



## SirDice (Dec 27, 2010)

theone4u said:
			
		

> But I have another server with same rule as router have INTEL GIGA LAN Cards ... I donnot why the process em0 taskq is eating to much fo cpu even with polling.


Probably because the Intel cards do most of the work compared to to Broadcom. The Intel cards can do a lot of things like checksums etc. on the hardware. The Broadcoms need to do this in software.


----------



## theone4u (Dec 29, 2010)

SirDice said:
			
		

> Probably because the Intel cards do most of the work compared to to Broadcom. The Intel cards can do a lot of things like checksums etc. on the hardware. The Broadcoms need to do this in software.



If Intel cards do most of the work on hardware level then why they are eating 50-65 % CPU. Specially the ( em0 taskq ) process.

Well after enabling polling and idlepolling on that server things are normal. But there must be some patch or way for Intel cards to stop them to eating to much cpu time.

Thanks in advance.


----------

