From owner-freebsd-net@FreeBSD.ORG Thu Jul 2 15:17:52 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D01171065672 for ; Thu, 2 Jul 2009 15:17:52 +0000 (UTC) (envelope-from barney_cordoba@yahoo.com) Received: from web63903.mail.re1.yahoo.com (web63903.mail.re1.yahoo.com [69.147.97.118]) by mx1.freebsd.org (Postfix) with SMTP id 895E68FC0C for ; Thu, 2 Jul 2009 15:17:52 +0000 (UTC) (envelope-from barney_cordoba@yahoo.com) Received: (qmail 16694 invoked by uid 60001); 2 Jul 2009 15:17:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1246547871; bh=Qxi4L/Tcq/dCYN1UviR4MorfVs7iCQgbDRKOo05ONiU=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=us+fYJKehg83jkXxo5yd/1C9iR90G2i9S/+7OyfukM6SeCPYqjx2ZMIjC9v45ZsoJWMZ1Em5Mj88YAeRmvf0/CiMnIXzufXTUPdTfL5la59szQstH/ZR+87EEfYETIWdTJeKkXJMQ/if8H7pPzV+1dZuuQaAupiTCVoF8oJRWjw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=IxsTdLvTI+GRMzyonk7tCGV2Gr2S10KbbPz8zcPBwp/qYZhqYciZjYFVStXFhrOeLVtpZcXVvsYVdG8MZJEJUW9HVqFo6bbZ/a6fe89z2cL9XSXJZaSzk1V/vREZJPgeep9TjTvXaLWncke0B0LuNu1dsR0FAceN+7BqCexhUnU=; Message-ID: <806553.16497.qm@web63903.mail.re1.yahoo.com> X-YMail-OSG: psenVZ0VM1nMKZx1a0QlFNYUFXOYDcOCN38W5SJTt0gYHPqnWZ5ewcYCglMAKPJvVnnbD10gZCUvUmUBIRJPE56nwOW.i1NDDiPTZcSpF41oRhv6GlA7hzxCvPEENqZZEnUyesHLBzaQRM7D89.FYpGKPjxC1CRwxFYBOB7UeRVIgYD0i.TcBicvoMAVD6UL0Pvg_B55ftXzJhCHy17fKt3ELttT2mluvsGlvM.YHstzTEXRSO8fzmHpMPilhH0uOKne24fLdfQ_H8P9rR7Vhg-- Received: from [66.176.162.245] by web63903.mail.re1.yahoo.com via HTTP; Thu, 02 Jul 2009 08:17:51 PDT X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15 Date: Thu, 2 Jul 2009 08:17:51 -0700 (PDT) From: Barney Cordoba To: Paul Thornton , Larry Baird MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org Subject: Re: Polling and kern.polling.idle_poll X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 15:17:53 -0000 =0A=0A--- On Thu, 7/2/09, Larry Baird wrote:=0A=0A> From: Lar= ry Baird =0A> Subject: Re: Polling and kern.polling.idle_poll= =0A> To: "Paul Thornton" =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