login
Header Space

 
 

Re: [PATCH] hugetlb: Fix pool resizing corner case

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Adam Litke <agl@...>
Cc: Andrew Morton <akpm@...>, <linux-mm@...>, <linux-kernel@...>
Date: Wednesday, October 3, 2007 - 1:40 pm

On Wed, 2007-10-03 at 08:47 -0700, Adam Litke wrote:

That's an excellent problem description.  I'm just a bit hazy on how the
patch fixes it. :)

What is the actual error in this loop?  The fact that we can go trying
to free pages when the count is actually OK?

BTW, try_to_free_low(count) kinda sucks for a function name.  Is that
count the number of pages we're trying to end up with, or the total
number of low pages that we're trying to free?

Also, as I look at try_to_free_low(), why do we need to #ifdef it out in
the case of !HIGHMEM?  If we have CONFIG_HIGHMEM=yes, we still might not
have any _actual_ high memory.  So, they loop obviously doesn't *hurt*
when there is no high memory.  


The real problem with this line is that "count" is too ambiguous. :)

We could rewrite the original max() line this way:

	if (resv_huge_pages > nr_of_pages_to_end_up_with)
		nr_of_pages_to_end_up_with = resv_huge_pages;
	try_to_make_the_total_nr_of_hpages(nr_of_pages_to_end_up_with);

Which makes it more clear that you're setting the number of total pages
to the number of reserved pages, which is obviously screwy.

OK, so this is actually saying: "count can never go below
resv_huge_pages+nr_huge_pages"?

Could we change try_to_free_low() to free a distinct number of pages?

	if (count > free_huge_pages)
		count = free_huge_pages;
	try_to_free_nr_huge_pages(count);

I feel a bit sketchy about the "resv_huge_pages + nr_huge_pages -
free_huge_pages" logic.  Could you elaborate a bit there on what the
rules are?

-- Dave

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] hugetlb: Fix pool resizing corner case, Adam Litke, (Wed Oct 3, 11:47 am)
Re: [PATCH] hugetlb: Fix pool resizing corner case, Dave Hansen, (Wed Oct 3, 1:40 pm)
Re: [PATCH] hugetlb: Fix pool resizing corner case, Adam Litke, (Wed Oct 3, 2:33 pm)
Re: [PATCH] hugetlb: Fix pool resizing corner case, Dave Hansen, (Wed Oct 3, 2:59 pm)
speck-geostationary