kern_poll.c (170289) | kern_poll.c (170307) |
---|---|
1/*- 2 * Copyright (c) 2001-2002 Luigi Rizzo 3 * 4 * Supported by: the Xorp Project (www.xorp.org) 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2002 Luigi Rizzo 3 * 4 * Supported by: the Xorp Project (www.xorp.org) 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/kern/kern_poll.c 170289 2007-06-04 18:25:08Z dwmalone $"); | 29__FBSDID("$FreeBSD: head/sys/kern/kern_poll.c 170307 2007-06-05 00:00:57Z jeff $"); |
30 31#include "opt_device_polling.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/socket.h> /* needed by net/if.h */ 37#include <sys/sockio.h> --- 537 unchanged lines hidden (view full) --- 575static void 576poll_idle(void) 577{ 578 struct thread *td = curthread; 579 struct rtprio rtp; 580 581 rtp.prio = RTP_PRIO_MAX; /* lowest priority */ 582 rtp.type = RTP_PRIO_IDLE; | 30 31#include "opt_device_polling.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/socket.h> /* needed by net/if.h */ 37#include <sys/sockio.h> --- 537 unchanged lines hidden (view full) --- 575static void 576poll_idle(void) 577{ 578 struct thread *td = curthread; 579 struct rtprio rtp; 580 581 rtp.prio = RTP_PRIO_MAX; /* lowest priority */ 582 rtp.type = RTP_PRIO_IDLE; |
583 mtx_lock_spin(&sched_lock); | 583 PROC_SLOCK(td->td_proc); |
584 rtp_to_pri(&rtp, td); | 584 rtp_to_pri(&rtp, td); |
585 mtx_unlock_spin(&sched_lock); | 585 PROC_SUNLOCK(td->td_proc); |
586 587 for (;;) { 588 if (poll_in_idle_loop && poll_handlers > 0) { 589 idlepoll_sleeping = 0; 590 ether_poll(poll_each_burst); | 586 587 for (;;) { 588 if (poll_in_idle_loop && poll_handlers > 0) { 589 idlepoll_sleeping = 0; 590 ether_poll(poll_each_burst); |
591 mtx_lock_spin(&sched_lock); | 591 thread_lock(td); |
592 mi_switch(SW_VOL, NULL); | 592 mi_switch(SW_VOL, NULL); |
593 mtx_unlock_spin(&sched_lock); | 593 thread_unlock(td); |
594 } else { 595 idlepoll_sleeping = 1; 596 tsleep(&idlepoll_sleeping, 0, "pollid", hz * 3); 597 } 598 } 599} 600 601static struct proc *idlepoll; 602static struct kproc_desc idlepoll_kp = { 603 "idlepoll", 604 poll_idle, 605 &idlepoll 606}; 607SYSINIT(idlepoll, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, kproc_start, &idlepoll_kp) | 594 } else { 595 idlepoll_sleeping = 1; 596 tsleep(&idlepoll_sleeping, 0, "pollid", hz * 3); 597 } 598 } 599} 600 601static struct proc *idlepoll; 602static struct kproc_desc idlepoll_kp = { 603 "idlepoll", 604 poll_idle, 605 &idlepoll 606}; 607SYSINIT(idlepoll, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, kproc_start, &idlepoll_kp) |