svn commit: r218232 - head/sys/netinet

John Baldwin jhb at freebsd.org
Fri Feb 4 18:56:53 UTC 2011


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


More information about the svn-src-head mailing list