MAP_SHARED bizarrely slow

From: David Gibson
Date: Wed Oct 27 2004 - 01:53:10 EST


http://www.ozlabs.org/people/dgibson/maptest.tar.gz

has a small set of test programs which perform a naive matrix multiply
in memory obtained by several different methods: one is
MAP_PRIVATE|MAP_ANONYMOUS, one is MAP_SHARED|MAP_ANONYMOUS and the
third attempts to map from hugetlbfs.

On a number of machines I've tested - both ppc64 and x86 - the SHARED
version is consistently and significantly (50-100%) slower than the
PRIVATE version. Increasing the matrix size does not appear to make
the situation significantly better. The routine that does the actual
multiply is identical (same .o) in each case, only a wrapper which
allocates memory is different.

I am at a complete loss to explain this behaviour, and I'm sure it
didn't use to happen (unfortunately I can't remember what kernel
version we were on at the time). oprofile appears to show essentially
all the time is taken in userspace in both cases. Can anyone explain
what's going on?

I've also seen anomolies with the hugepage version, but it seems to be
less consistent.

--
David Gibson | For every complex problem there is a
david AT gibson.dropbear.id.au | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
-
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/