[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <EE6A12AA-3BE6-43DE-AEB2-7477CDAD21DC@kernel.crashing.org>
Date: Fri, 22 Dec 2006 19:51:09 +0100
From: Segher Boessenkool <segher@...nel.crashing.org>
To: David Gibson <david@...son.dropbear.id.au>
Cc: Andrew Morton <akpm@...l.org>,
libhugetlbfs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
William Lee Irwin <wli@...omorphy.com>,
linuxppc-dev@...abs.org, Paul Mackerras <paulus@...ba.org>
Subject: Re: [powerpc] Fix bogus BUG_ON() in in hugetlb_get_unmapped_area()
>>> + if (len > TASK_SIZE)
>>> + return -ENOMEM;
>>
>> Shouldn't that be addr+len instead? The check looks incomplete
>> otherwise. And you meant ">=" I guess?
>
> No. Have a look at the other hugetlb_get_unmapped_area()
> implementations. Because this is in the get_unmapped_area() path,
> 'addr' is just a hint,
Ah I missed this vital piece of information, thanks for the
explanation. Care putting in a code comment pointing this out?
> so checking addr+len would give bogus
> failures. This test is, I believe, essentially an optimization - if
> it fails, we're never going to find a suitable addr, so we might as
> well give up now.
Yes, it all makes sense now.
>>> - /* Paranoia, caller should have dealt with this */
>>> - BUG_ON((addr + len) > 0x100000000UL);
>>> -
>>
>> Any real reason to remove the paranoia check? If it's trivially
>> always satisfied, the compiler will get rid of it for you :-)
>
> Yes - this is the very bug on which was causing crashes - the "caller
> should have dealt with this" comment is wrong. The test has been
> moved into htlb_check_hinted_area() and now simply fails (and so falls
> back to searching for a suitable address), rather than BUG()ing.
Yep.
Cheers,
Segher
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists