Date: Fri, 4 Feb 2011 13:56:39 -0500 From: John Baldwin <jhb@freebsd.org> To: Julian Elischer <julian@freebsd.org> Cc: svn-src-head@freebsd.org, Randall Stewart <rrs@freebsd.org>, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson <rwatson@freebsd.org> Subject: Re: svn commit: r218232 - head/sys/netinet Message-ID: <201102041356.39777.jhb@freebsd.org> In-Reply-To: <4D4C45C9.4080105@freebsd.org> References: <201102031922.p13JML8i055697@svn.freebsd.org> <alpine.BSF.2.00.1102041731160.17623@fledge.watson.org> <4D4C45C9.4080105@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, February 04, 2011 1:30:33 pm Julian Elischer wrote: > On 2/4/11 9:38 AM, Robert Watson wrote: > > > > On Thu, 3 Feb 2011, John Baldwin wrote: > > > >>> 1) Move per John Baldwin to mp_maxid > >>> 2) Some signed/unsigned errors found by Mac OS compiler (from > >>> Michael) > >>> 3) a couple of copyright updates on the effected files. > >> > >> Note that mp_maxid is the maxium valid ID, so you typically have to > >> do things like: > >> > >> for (i = 0; i <= mp_maxid; i++) { > >> if (CPU_ABSENT(i)) > >> continue; > >> ... > >> } > >> > >> There is a CPU_FOREACH() macro that does the above (but assumes you > >> want to skip over non-existent CPUs). > > > > I'm finding the network stack requires quite a bit more along these > > lines, btw. I'd love also to have: > > > > PACKAGE_FOREACH() > > CORE_FOREACH() > > HWTHREAD_FOREACH() > > > > I agree, which is why I usually support adding such iterators though > some people scream about them. > (e.g. FOREACH_THREAD_IN_PROC and there is one for iterating through > vnets too.) The difference here is that FOREACH_THREAD_IN_PROC() is just a TAILQ_FOREACH(). The CPU iterators are more complex. I agree that that we should have topology-aware iterators, though part of the problem is what do you iterate? We'd have to create new sets of package and core IDs. For HWTHREAD_FOREACH() you can already use CPU_FOREACH(). -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102041356.39777.jhb>