Re: kernel BUGs when removing largish files with the SLOB allocator

From: Nick Piggin
Date: Tue Sep 12 2006 - 22:16:35 EST


David Howells wrote:
Matt Mackall <mpm@xxxxxxxxxxx> wrote:


+ for (i = 0; i < (1 << bb->order); i++) {
+ SetPageSlab(page);
+ page++;
+ }

for ( ; page < page + (1 << bb->order), page++)
SetPageSlab(page);


Ugh. No. You can't do that. "page < page + X" will be true until "page + X"
wraps the end of memory.


+ for (i = 0; i < (1 << bb->order); i++) {
+ if (!TestClearPageSlab(page))
+ BUG();
+ page++;
+ }

Please drop the BUG. We've already established it's on our lists by
this point.


I disagree. Let's catch accidental reuse of pages. It should, however, be
marked unlikely().

If you do this, the biggest problem with those ops is that they are atomic,
and the latter also requires strong memory barriers. Don't use RMW variants,
and use __ prepended iff you are the only user of the page at this point.

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com -
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/