Polling and kern.polling.idle_poll
Luigi Rizzo
rizzo at iet.unipi.it
Thu Jul 2 15:20:08 UTC 2009
On Thu, Jul 02, 2009 at 10:21:55AM -0400, Larry Baird wrote:
> Paul,
>
> > Larry Baird wrote:
> > >The man page for polling states:
> > > kern.polling.idle_poll
> > > Controls if polling is enabled in the idle loop. There are no
> > > reasons (other than power saving or bugs in the scheduler's han-
> > > dling of idle priority kernel threads) to disable this.
> > >
> > >So why is it now disabled by default? Looking back through cvs the
> > >change was made by Luigi way back in August of 2002.
> > >
> > >
> > Did you ever get a reply for this question on the -net list? I may have
> > missed it, but I don't think you did.
> > I'm very interested in why this was changed too.
> I got some off list mail from Luigi. In 4.x, the idle_poll() was called
> from idle. Now it is its own thread. CPU statistics will now show high 100%
> utilization if your set kern.polling.idle_poll. He also has some concerns
> about if locking was in place for SMP. Looking at the code locking appears
> to be in place.
>
> The performance improvment is too great for me to ignore, so I made a few
> mods to my kernels. I modified kern_poll to set P_NOLOAD for the idle_poll
> thread. I then modified CPU statistics to view all processes with P_NOLOAD
> as the idle process. So far working great for me. Patches below.
just to understand -- the patch below is just cosmetics to avoid
seeing the polling thread appear as "SYS" time, right ?
cheers
luigi
> *** /sys/kern/kern_poll.c 2006-06-16 18:11:55.000000000 -0400
> --- kern_poll.c 2009-07-02 10:03:07.000000000 -0400
> ***************
> *** 577,583 ****
> --- 577,587 ----
> {
> struct thread *td = curthread;
> struct rtprio rtp;
> + struct proc *p = td->td_proc;
>
> + PROC_LOCK(p);
> + p->p_flag |= P_NOLOAD;
> + PROC_UNLOCK(p);
> rtp.prio = RTP_PRIO_MAX; /* lowest priority */
> rtp.type = RTP_PRIO_IDLE;
> mtx_lock_spin(&sched_lock);
>
> *** /sys/kern/kern_clock.c 2008-06-04 06:31:41.000000000 -0400
> --- kern_clock.c 2009-07-02 10:05:01.000000000 -0400
> ***************
> *** 516,522 ****
> thread_statclock(0);
> td->td_sticks++;
> p->p_rux.rux_sticks++;
> ! if (td != PCPU_GET(idlethread)) {
> cp_time[CP_SYS]++;
> pcp_time[CP_SYS]++;
> } else {
> --- 516,522 ----
> thread_statclock(0);
> td->td_sticks++;
> p->p_rux.rux_sticks++;
> ! if ( ! (p->p_flag & P_NOLOAD) ) {
> cp_time[CP_SYS]++;
> pcp_time[CP_SYS]++;
> } else {
>
>
>
> --
> ------------------------------------------------------------------------
> Larry Baird | http://www.gta.com
> Global Technology Associates, Inc. | Orlando, FL
> Email: lab at gta.com | TEL 407-380-0220, FAX 407-380-6080
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
More information about the freebsd-net
mailing list