diff options
-rw-r--r-- | mm/page_alloc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 092b2d8f2f0c..8dadda6e1feb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3584,6 +3584,21 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
3584 | for (order = 0; ((1UL << order) << PAGE_SHIFT) < size; order++) | 3584 | for (order = 0; ((1UL << order) << PAGE_SHIFT) < size; order++) |
3585 | ; | 3585 | ; |
3586 | table = (void*) __get_free_pages(GFP_ATOMIC, order); | 3586 | table = (void*) __get_free_pages(GFP_ATOMIC, order); |
3587 | /* | ||
3588 | * If bucketsize is not a power-of-two, we may free | ||
3589 | * some pages at the end of hash table. | ||
3590 | */ | ||
3591 | if (table) { | ||
3592 | unsigned long alloc_end = (unsigned long)table + | ||
3593 | (PAGE_SIZE << order); | ||
3594 | unsigned long used = (unsigned long)table + | ||
3595 | PAGE_ALIGN(size); | ||
3596 | split_page(virt_to_page(table), order); | ||
3597 | while (used < alloc_end) { | ||
3598 | free_page(used); | ||
3599 | used += PAGE_SIZE; | ||
3600 | } | ||
3601 | } | ||
3587 | } | 3602 | } |
3588 | } while (!table && size > PAGE_SIZE && --log2qty); | 3603 | } while (!table && size > PAGE_SIZE && --log2qty); |
3589 | 3604 | ||