| 371 | static struct timeval poll_start_t; |
| 372 | |
| 373 | void |
| 374 | netisr_pollmore() |
| 375 | { |
| 376 | struct timeval t; |
| 377 | int kern_load; |
| 378 | |
| 379 | if (poll_handlers == 0) |
| 380 | return; |
| 381 | |
| 382 | mtx_lock(&poll_mtx); |
| 383 | if (!netisr_pollmore_scheduled) { |
| 384 | mtx_unlock(&poll_mtx); |
| 385 | return; |
| 386 | } |
| 387 | netisr_pollmore_scheduled = 0; |
| 388 | phase = 5; |
| 389 | if (residual_burst > 0) { |
| 390 | netisr_poll_scheduled = 1; |
| 391 | netisr_pollmore_scheduled = 1; |
| 392 | netisr_sched_poll(); |
| 393 | mtx_unlock(&poll_mtx); |
| 394 | /* will run immediately on return, followed by netisrs */ |
| 395 | return; |
| 396 | } |
| 397 | /* here we can account time spent in netisr's in this tick */ |
| 398 | microuptime(&t); |
| 399 | kern_load = (t.tv_usec - poll_start_t.tv_usec) + |
| 400 | (t.tv_sec - poll_start_t.tv_sec)*1000000; /* us */ |
| 401 | kern_load = (kern_load * hz) / 10000; /* 0..100 */ |
| 402 | if (kern_load > (100 - user_frac)) { /* try decrease ticks */ |
| 403 | if (poll_burst > 1) |
| 404 | poll_burst--; |
| 405 | } else { |
| 406 | if (poll_burst < poll_burst_max) |
| 407 | poll_burst++; |
| 408 | } |
| 409 | |
| 410 | pending_polls--; |
| 411 | if (pending_polls == 0) /* we are done */ |
| 412 | phase = 0; |
| 413 | else { |
| 414 | /* |
| 415 | * Last cycle was long and caused us to miss one or more |
| 416 | * hardclock ticks. Restart processing again, but slightly |
| 417 | * reduce the burst size to prevent that this happens again. |
| 418 | */ |
| 419 | poll_burst -= (poll_burst / 8); |
| 420 | if (poll_burst < 1) |
| 421 | poll_burst = 1; |
| 422 | netisr_poll_scheduled = 1; |
| 423 | netisr_pollmore_scheduled = 1; |
| 424 | netisr_sched_poll(); |
| 425 | phase = 6; |
| 426 | } |
| 427 | mtx_unlock(&poll_mtx); |
| 428 | } |
| 429 | |
| 430 | /* |
no test coverage detected