Commit ca4b75dc authored by Linus Torvalds's avatar Linus Torvalds

Make it clear that GFP_ZERO does not work with atomic highmem allocations.

We use a non-atomic kmap() to clear the page, which cannot be
used from atomic contexts.
parent aafeed4a
......@@ -591,19 +591,20 @@ void fastcall free_cold_page(struct page *page)
free_hot_cold_page(page, 1);
}
/*
* Really, prep_compound_page() should be called from __rmqueue_bulk(). But
* we cheat by calling it from here, in the order > 0 path. Saves a branch
* or two.
*/
static inline void prep_zero_page(struct page *page, int order)
static inline void prep_zero_page(struct page *page, int order, int gfp_flags)
{
int i;
BUG_ON((gfp_flags & (__GFP_WAIT | __GFP_HIGHMEM)) == __GFP_HIGHMEM);
for(i = 0; i < (1 << order); i++)
clear_highpage(page + i);
}
/*
* Really, prep_compound_page() should be called from __rmqueue_bulk(). But
* we cheat by calling it from here, in the order > 0 path. Saves a branch
* or two.
*/
static struct page *
buffered_rmqueue(struct zone *zone, int order, int gfp_flags)
{
......@@ -640,7 +641,7 @@ buffered_rmqueue(struct zone *zone, int order, int gfp_flags)
prep_new_page(page, order);
if (gfp_flags & __GFP_ZERO)
prep_zero_page(page, order);
prep_zero_page(page, order, gfp_flags);
if (order && (gfp_flags & __GFP_COMP))
prep_compound_page(page, order);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment