Messages in this thread | | | Subject | Re: [PATCH] get_nodes mask miscalculation | From | Andi Kleen <> | Date | Tue, 10 Aug 2004 03:44:52 +0200 |
| |
Brent Casavant <bcasavan@sgi.com> writes:
The idea behind this is was to make it behave like select. And select passes highest valid value + 1. In this case valid value is not the highest bit number, but the length of the bitmap.
For some reason nobody except me seems to get it though, probably because the description in the manpages is a bit confusing:
get_mempolicy(2):
"maxnode is the maximum bit number plus one that can be stored into nodemask."
I suppose this should be better described. For changing it it is too late unfortunately because the libnuma binaries are already out in the wild.
> It appears there is a nodemask miscalculation in the get_nodes() > function in mm/mempolicy.c. This bug has two effects: > > 1. It is impossible to specify a length 1 nodemask.
Sure. You pass 2.
> 2. It is impossible to specify a nodemask containing the last node.
you pass number of nodes + 1.
> The following patch against 2.6.8-rc3 has been confirmed to solve > both problems.
Problem is that you'll break all existing libnuma binaries which pass NUMA_MAX_NODES + 1. In your scheme the kernel will access one bit beyond the bitmap that got passed, and depending on its random value you may get a failure or not.
BTW there is a minor problem in the code that there isn't a upper limit. When you pass 0 it currently iterates through all your memory until it hits an EFAULT, which can be a bit slow. But that's easy to fix.
-Andi
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |