lkml.org 
[lkml]   [2005]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3 htlb-fault] Demand faulting for huge pages
Adam Litke <agl@us.ibm.com> wrote:
>
> +static struct page *find_get_huge_page(struct address_space *mapping,
> + unsigned long idx)
> +{
> + struct page *page = NULL;
> +
> +retry:
> + page = find_get_page(mapping, idx);
> + if (page)
> + goto out;
> +
> + if (hugetlb_get_quota(mapping))
> + goto out;
> + page = alloc_huge_page();
> + if (!page) {
> + hugetlb_put_quota(mapping);
> + goto out;
> + }
> +
> + if (add_to_page_cache(page, mapping, idx, GFP_ATOMIC)) {
> + put_page(page);
> + hugetlb_put_quota(mapping);
> + goto retry;

If add_to_page_cache() fails due to failure in radix_tree_preload(), this
code will lock up.

A lame fix is to check for -ENOMEM and bale. A better fix would be to use
GFP_KERNEL.

-
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/

\
 
 \ /
  Last update: 2005-09-29 08:12    [W:0.646 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site