Re: [PATCH -mm] i386: cpu_relax() smp.c

From: Andreas Mohr
Date: Wed Jun 14 2006 - 15:31:39 EST


Hi,

On Wed, Jun 14, 2006 at 12:10:16PM +1000, Nick Piggin wrote:
> Andreas Mohr wrote:
>
> >Hi,
> >
> >On Mon, Jun 12, 2006 at 08:37:43PM +0200, Andreas Mohr wrote:
> >
> >>Hi all,
> >>
> >>while reviewing 2.6.17-rc6-mm1, I found some places that might
> >>want to make use of cpu_relax() in order to not block secondary
> >>pipelines while busy-polling (probably especially useful on SMT CPUs):
> >>
> >
> >OK, no replies arguing against anything, thus patch follow-up. ;)
> >(no. 1 of 3)
> >
>
> The other two look fine. This one should remove the mb(). cpu_relax
> IIRC already includes a barrier(), and we are not concerned about
> consistency here, only coherency, which the hardware takes care of
> for us.
>
> The flush_cpumask is guaranteed to be cleared *after* all other
> variables (eg. flush_mm) have been used... that happens in the IPI
> handler of course.
>
> Aside, if we *were* worried about consistency here, smp_mb would
> have been the more correct barrier to use.

Thanks, updated patch to omit mb().

Signed-off-by: Andreas Mohr <andi@xxxxxxxx>


diff -urN linux-2.6.17-rc6-mm2.orig/arch/i386/kernel/smp.c linux-2.6.17-rc6-mm2.my/arch/i386/kernel/smp.c
--- linux-2.6.17-rc6-mm2.orig/arch/i386/kernel/smp.c 2006-06-08 10:38:04.000000000 +0200
+++ linux-2.6.17-rc6-mm2.my/arch/i386/kernel/smp.c 2006-06-14 20:30:46.000000000 +0200
@@ -388,9 +388,10 @@
*/
send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR);

- while (!cpus_empty(flush_cpumask))
+ while (!cpus_empty(flush_cpumask)) {
/* nothing. lockup detection does not belong here */
- mb();
+ cpu_relax();
+ }

flush_mm = NULL;
flush_va = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/