Date: Thu, 2 Jul 2009 08:17:51 -0700 (PDT) From: Barney Cordoba <barney_cordoba@yahoo.com> To: Paul Thornton <prt@prt.org>, Larry Baird <lab@gta.com> Cc: freebsd-net@freebsd.org Subject: Re: Polling and kern.polling.idle_poll Message-ID: <806553.16497.qm@web63903.mail.re1.yahoo.com>
next in thread | raw e-mail | index | archive | help
=0A=0A--- On Thu, 7/2/09, Larry Baird <lab@gta.com> wrote:=0A=0A> From: Lar= ry Baird <lab@gta.com>=0A> Subject: Re: Polling and kern.polling.idle_poll= =0A> To: "Paul Thornton" <prt@prt.org>=0A> Cc: freebsd-net@freebsd.org=0A> = Date: Thursday, July 2, 2009, 10:21 AM=0A> Paul,=0A> =0A> > Larry Baird wro= te:=0A> > >The man page for polling states:=0A> > >=A0 =A0 kern.polling.idl= e_poll=0A> > >=A0=A0=A0=A0=A0Controls if polling=0A> is enabled in the idle= loop.=A0 There are no=0A> > >=A0=A0=A0=A0=A0reasons (other than=0A> power = saving or bugs in the scheduler's han-=0A> > >=A0=A0=A0=A0=A0dling of idle= =0A> priority kernel threads) to disable this.=0A> > >=0A> > >So why is it = now disabled by default?=A0=0A> Looking back through cvs the=0A> > >change = was made by Luigi way back in August of=0A> 2002.=A0 =0A> > >=0A> > >=A0 = =0A> > Did you ever get a reply for this question on the -net=0A> list?=A0 = I may have =0A> > missed it, but I don't think you did.=0A> > I'm very inte= rested in why this was changed too.=0A> I got some off list mail from Luigi= .=A0 In 4.x, the=0A> idle_poll() was called=0A> from idle.=A0 Now it is its= own thread.=A0 CPU=0A> statistics will now show high 100%=0A> utilization = if your set kern.polling.idle_poll.=A0 He=0A> also has some concerns=0A> ab= out if locking was in place for SMP.=A0 Looking at the=0A> code locking app= ears=0A> to be in place.=0A> =0A> The performance improvment is too great f= or me to ignore,=0A> so I made a few=0A> mods to my kernels.=A0 I modified = kern_poll to set=0A> P_NOLOAD for the idle_poll=0A> thread. I then modified= CPU statistics to view all=0A> processes with P_NOLOAD=0A> as the idle pro= cess.=A0 So far working great for=0A> me.=A0 Patches below.=0A> =0A> *** /s= ys/kern/kern_poll.c=A0 =A0=0A> =A0=A0=A02006-06-16 18:11:55.000000000 -0400= =0A> --- kern_poll.c 2009-07-02 10:03:07.000000000 -0400=0A> **************= *=0A> *** 577,583 ****=0A> --- 577,587 ----=0A> =A0 {=0A> =A0 =A0 =A0 =A0 s= truct thread *td =3D curthread;=0A> =A0 =A0 =A0 =A0 struct rtprio rtp;=0A> = +=A0 =A0 =A0=A0=A0struct proc *p =3D=0A> td->td_proc;=0A> =A0 =0A> +=A0 =A0= =A0=A0=A0PROC_LOCK(p);=0A> +=A0 =A0 =A0=A0=A0p->p_flag |=3D P_NOLOAD;=0A> = +=A0 =A0 =A0=A0=A0PROC_UNLOCK(p);=0A> =A0 =A0 =A0 =A0 rtp.prio =3D RTP_PRIO= _MAX;=A0=0A> =A0 =A0 =A0 /* lowest priority */=0A> =A0 =A0 =A0 =A0 rtp.type= =3D RTP_PRIO_IDLE;=0A> =A0 =A0 =A0 =A0=0A> mtx_lock_spin(&sched_lock);=0A>= =0A> *** /sys/kern/kern_clock.c=A0 =A0 =A0 2008-06-04=0A> 06:31:41.0000000= 00 -0400=0A> --- kern_clock.c=A0 =A0 =A0 =A0 2009-07-02=0A> 10:05:01.000000= 000 -0400=0A> ***************=0A> *** 516,522 ****=0A> =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> thread_statclock(0);=0A= > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 td->td_sticks++;=0A> = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 p->p_rux.rux_sticks++;= =0A> !=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0=A0=A0if (td !=3D=0A> = PCPU_GET(idlethread)) {=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0=0A> cp_time[CP_SYS]++;=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> pcp_time[CP_SYS]++;=0A> =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 } else {=0A> --- 516,522 --= --=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =0A> thread_statclock(0);=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 = =A0 =A0 td->td_sticks++;=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 = =A0 =A0 p->p_rux.rux_sticks++;=0A> !=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0= =A0 =A0=A0=A0if ( ! (p->p_flag &=0A> P_NOLOAD) ) {=0A> =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> cp_time[CP_SYS]++;=0A>= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> pc= p_time[CP_SYS]++;=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 }= else {=0A> =0A=0ACurious as to why you don't simply lay out the $40 for a = modern ethernet card that doesn't need polling to work well?=0A=0ABarney=0A= =0A=0A
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?806553.16497.qm>