Re: [PATCH] Make for_each_cpu_mask a bit smaller

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matthew Wilcox
Date: Sunday, May 11, 2008 - 3:01 pm

On Sun, May 11, 2008 at 06:19:39PM +0200, Alexander van Heukelum wrote:

How about doing it this way?

#define for_each_cpu_mask(cpu, mask)				\
	for ((cpu) = -1;					\
	     (cpu) < NR_CPUS;					\
	     (cpu) = find_next_cpu_mask((cpu), &(mask)))

int find_next_cpu_mask(int n, const cpumask_t *srcp)
{
	return find_next_bit(srcp->bits, NR_CPUS, ++n);
}

That actually behaves the way I'd expect a function called
'find_next_cpu_mask' to work.  It also abuses the 'for' condtion
less and might take a little less text space.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Make for_each_cpu_mask a bit smaller, Alexander van Heukelum, (Sun May 11, 6:50 am)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Paul Jackson, (Sun May 11, 6:57 am)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Paul Jackson, (Sun May 11, 7:14 am)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Matthew Wilcox, (Sun May 11, 8:24 am)
[RFC/PATCH] Make for_each_node_mask out-of-line, Alexander van Heukelum, (Sun May 11, 9:06 am)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Alexander van Heukelum, (Sun May 11, 9:19 am)
Re: [RFC/PATCH] Make for_each_node_mask out-of-line, Paul Jackson, (Sun May 11, 2:01 pm)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Matthew Wilcox, (Sun May 11, 3:01 pm)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Alexander van Heukelum, (Mon May 12, 4:04 am)
Re: [PATCH] Make for_each_cpu_mask a bit smaller, Matthew Wilcox, (Mon May 12, 4:56 am)
Re: [RFC/PATCH] Make for_each_node_mask out-of-line, Alexander van Heukelum, (Mon May 12, 5:04 am)
Re: [RFC/PATCH] Make for_each_node_mask out-of-line, Mike Travis, (Mon May 12, 9:45 am)
[PATCHv2] Make for_each_cpu_mask a bit smaller, Alexander van Heukelum, (Mon May 12, 12:00 pm)
Re: [PATCHv2] Make for_each_cpu_mask a bit smaller, Andreas Schwab, (Mon May 12, 2:45 pm)
[PATCHv3] Make for_each_cpu_mask a bit smaller, Alexander van Heukelum, (Tue May 13, 2:28 am)
Re: [PATCHv3] Make for_each_cpu_mask a bit smaller, Ingo Molnar, (Tue May 13, 5:02 am)