Re: [PATCH 2/3 htlb-fault] Demand faulting for huge pages

From: Andrew Morton
Date: Thu Sep 29 2005 - 01:10:07 EST


Adam Litke <agl@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/