Re: [PATCH] Fix WARN_ON / WARN_ON_ONCE regression

From: Tim Chen
Date: Tue Oct 03 2006 - 20:32:25 EST


On Tue, 2006-10-03 at 17:07 -0700, Andrew Morton wrote:

> >
> > introduced 40% more 2nd level cache miss to tbench workload
> > being run in a loop back mode on a Core 2 machine. I think the
> > introduction of the local variables to WARN_ON and WARN_ON_ONCE
> >
> > typeof(x) __ret_warn_on = (x);
> > typeof(condition) __ret_warn_once = (condition);
> >
> > results in the extra cache misses.
>
> I don't see why it should.
>

Before the WARN_ON/WARN_ON_ONCE patch, the condition given to
WARN_ON/WARN_ON_ONCE is evaluated once and that's it. But after the
patch, the condition is stored in a variable and returned later. I
think that accessing this variable causes cache misses.

> Perhaps the `static int __warn_once' is getting put in the same cacheline
> as some frequently-modified thing. Perhaps try marking that as __read_mostly?
>

I'll give that a try to see if it will improve things.

Tim
-
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/