Lines Matching full:order

239  * change gfp_allowed_mask in order to avoid using I/O during memory allocations
278 static void __free_pages_ok(struct page *page, unsigned int order,
355 * many cases very high-order allocations like THP are likely to be
412 static inline void kasan_free_nondeferred_pages(struct page *page, int order) in kasan_free_nondeferred_pages() argument
415 kasan_free_pages(page, order); in kasan_free_nondeferred_pages()
674 * Higher-order pages are called "compound pages". They are structured thusly:
684 * The first tail page's ->compound_order holds the order of allocation.
685 * This usage means that zero-order pages may not be compound.
694 void prep_compound_page(struct page *page, unsigned int order) in prep_compound_page() argument
697 int nr_pages = 1 << order; in prep_compound_page()
708 set_compound_order(page, order); in prep_compound_page()
759 unsigned int order, int migratetype) in set_page_guard() argument
764 if (order >= debug_guardpage_minorder()) in set_page_guard()
769 set_page_private(page, order); in set_page_guard()
771 __mod_zone_freepage_state(zone, -(1 << order), migratetype); in set_page_guard()
777 unsigned int order, int migratetype) in clear_page_guard() argument
786 __mod_zone_freepage_state(zone, (1 << order), migratetype); in clear_page_guard()
790 unsigned int order, int migratetype) { return false; } in set_page_guard() argument
792 unsigned int order, int migratetype) {} in clear_page_guard() argument
795 static inline void set_buddy_order(struct page *page, unsigned int order) in set_buddy_order() argument
797 set_page_private(page, order); in set_buddy_order()
806 * (c) a page and its buddy have the same order &&
812 * For recording page's order, we use page_private(page).
815 unsigned int order) in page_is_buddy() argument
820 if (buddy_order(buddy) != order) in page_is_buddy()
848 int order, int migratetype) in compaction_capture() argument
850 if (!capc || order != capc->cc->order) in compaction_capture()
859 * Do not let lower order allocations polluate a movable pageblock. in compaction_capture()
862 * have trouble finding a high-order free page. in compaction_capture()
864 if (order < pageblock_order && migratetype == MIGRATE_MOVABLE) in compaction_capture()
879 int order, int migratetype) in compaction_capture() argument
887 unsigned int order, int migratetype) in add_to_free_list() argument
889 struct free_area *area = &zone->free_area[order]; in add_to_free_list()
897 unsigned int order, int migratetype) in add_to_free_list_tail() argument
899 struct free_area *area = &zone->free_area[order]; in add_to_free_list_tail()
911 unsigned int order, int migratetype) in move_to_free_list() argument
913 struct free_area *area = &zone->free_area[order]; in move_to_free_list()
919 unsigned int order) in del_page_from_free_list() argument
928 zone->free_area[order].nr_free--; in del_page_from_free_list()
933 * of the next-highest order is free. If it is, it's possible
937 * as a higher order page
941 struct page *page, unsigned int order) in buddy_merge_likely() argument
946 if (order >= MAX_ORDER - 2) in buddy_merge_likely()
954 buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1); in buddy_merge_likely()
958 page_is_buddy(higher_page, higher_buddy, order + 1); in buddy_merge_likely()
974 * free pages of length of (1 << order) and marked with PageBuddy.
975 * Page's order is recorded in page_private(page) field.
987 struct zone *zone, unsigned int order, in __free_one_page() argument
1004 __mod_zone_freepage_state(zone, 1 << order, migratetype); in __free_one_page()
1006 VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page); in __free_one_page()
1010 while (order < max_order - 1) { in __free_one_page()
1011 if (compaction_capture(capc, page, order, migratetype)) { in __free_one_page()
1012 __mod_zone_freepage_state(zone, -(1 << order), in __free_one_page()
1016 buddy_pfn = __find_buddy_pfn(pfn, order); in __free_one_page()
1021 if (!page_is_buddy(page, buddy, order)) in __free_one_page()
1025 * merge with it and move up one order. in __free_one_page()
1028 clear_page_guard(zone, buddy, order, migratetype); in __free_one_page()
1030 del_page_from_free_list(buddy, zone, order); in __free_one_page()
1034 order++; in __free_one_page()
1037 /* If we are here, it means order is >= pageblock_order. in __free_one_page()
1043 * low-order merging. in __free_one_page()
1048 buddy_pfn = __find_buddy_pfn(pfn, order); in __free_one_page()
1062 set_buddy_order(page, order); in __free_one_page()
1066 else if (is_shuffle_order(order)) in __free_one_page()
1069 to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); in __free_one_page()
1072 add_to_free_list_tail(page, zone, order, migratetype); in __free_one_page()
1074 add_to_free_list(page, zone, order, migratetype); in __free_one_page()
1078 page_reporting_notify_free(order); in __free_one_page()
1204 unsigned int order, bool check_free) in free_pages_prepare() argument
1210 trace_mm_page_free(page, order); in free_pages_prepare()
1212 if (unlikely(PageHWPoison(page)) && !order) { in free_pages_prepare()
1218 __memcg_kmem_uncharge_page(page, order); in free_pages_prepare()
1219 reset_page_owner(page, order); in free_pages_prepare()
1225 * avoid checking PageCompound for order-0 pages. in free_pages_prepare()
1227 if (unlikely(order)) { in free_pages_prepare()
1231 VM_BUG_ON_PAGE(compound && compound_order(page) != order, page); in free_pages_prepare()
1235 for (i = 1; i < (1 << order); i++) { in free_pages_prepare()
1248 __memcg_kmem_uncharge_page(page, order); in free_pages_prepare()
1256 reset_page_owner(page, order); in free_pages_prepare()
1260 PAGE_SIZE << order); in free_pages_prepare()
1262 PAGE_SIZE << order); in free_pages_prepare()
1265 kernel_init_free_pages(page, 1 << order); in free_pages_prepare()
1267 kernel_poison_pages(page, 1 << order, 0); in free_pages_prepare()
1273 arch_free_page(page, order); in free_pages_prepare()
1276 kernel_map_pages(page, 1 << order, 0); in free_pages_prepare()
1278 kasan_free_nondeferred_pages(page, order); in free_pages_prepare()
1285 * With DEBUG_VM enabled, order-0 pages are checked immediately when being freed
1303 * With DEBUG_VM disabled, order-0 pages being freed are checked only when
1304 * moving from pcp lists to free list in order to reduce overhead. With
1333 * Assumes all pages on list are in same zone, and of same order.
1426 unsigned int order, in free_one_page() argument
1434 __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); in free_one_page()
1512 static void __free_pages_ok(struct page *page, unsigned int order, in __free_pages_ok() argument
1519 if (!free_pages_prepare(page, order, true)) in __free_pages_ok()
1524 __count_vm_events(PGFREE, 1 << order); in __free_pages_ok()
1525 free_one_page(page_zone(page), page, pfn, order, migratetype, in __free_pages_ok()
1530 void __free_pages_core(struct page *page, unsigned int order) in __free_pages_core() argument
1532 unsigned int nr_pages = 1 << order; in __free_pages_core()
1556 __free_pages_ok(page, order, FPI_TO_TAIL); in __free_pages_core()
1604 unsigned int order) in memblock_free_pages() argument
1608 __free_pages_core(page, order); in memblock_free_pages()
1830 * In order to try and keep some memory in the cache we have the loop
1831 * broken along max page order boundaries. This way we will not cause
1984 * deferred pages to satisfy the allocation specified by order, rounded up to
1998 deferred_grow_zone(struct zone *zone, unsigned int order) in deferred_grow_zone() argument
2000 unsigned long nr_pages_needed = ALIGN(1 << order, PAGES_PER_SECTION); in deferred_grow_zone()
2065 _deferred_grow_zone(struct zone *zone, unsigned int order) in _deferred_grow_zone() argument
2067 return deferred_grow_zone(zone, order); in _deferred_grow_zone()
2148 * The order of subdivision here is critical for the IO subsystem.
2149 * Please do not alter this order without good reasons and regression
2151 * the order in which smaller blocks are delivered depends on the order
2153 * influencing the order in which pages are delivered to the IO
2218 * With DEBUG_VM enabled, order-0 pages are checked for expected state when
2236 * With DEBUG_VM disabled, free order-0 pages are checked for expected state
2253 static bool check_new_pages(struct page *page, unsigned int order) in check_new_pages() argument
2256 for (i = 0; i < (1 << order); i++) { in check_new_pages()
2266 inline void post_alloc_hook(struct page *page, unsigned int order, in post_alloc_hook() argument
2272 arch_alloc_page(page, order); in post_alloc_hook()
2274 kernel_map_pages(page, 1 << order, 1); in post_alloc_hook()
2275 kasan_alloc_pages(page, order); in post_alloc_hook()
2276 kernel_poison_pages(page, 1 << order, 1); in post_alloc_hook()
2277 set_page_owner(page, order, gfp_flags); in post_alloc_hook()
2280 static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags, in prep_new_page() argument
2283 post_alloc_hook(page, order, gfp_flags); in prep_new_page()
2286 kernel_init_free_pages(page, 1 << order); in prep_new_page()
2288 if (order && (gfp_flags & __GFP_COMP)) in prep_new_page()
2289 prep_compound_page(page, order); in prep_new_page()
2308 struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, in __rmqueue_smallest() argument
2316 for (current_order = order; current_order < MAX_ORDER; ++current_order) { in __rmqueue_smallest()
2322 expand(zone, page, order, current_order, migratetype); in __rmqueue_smallest()
2332 * This array describes the order lists are fallen back to when
2349 unsigned int order) in __rmqueue_cma_fallback() argument
2351 return __rmqueue_smallest(zone, order, MIGRATE_CMA); in __rmqueue_cma_fallback()
2355 unsigned int order) { return NULL; } in __rmqueue_cma_fallback() argument
2368 unsigned int order; in move_freepages() local
2395 order = buddy_order(page); in move_freepages()
2396 move_to_free_list(page, zone, order, migratetype); in move_freepages()
2397 page += 1 << order; in move_freepages()
2398 pages_moved += 1 << order; in move_freepages()
2452 static bool can_steal_fallback(unsigned int order, int start_mt) in can_steal_fallback() argument
2455 * Leaving this order check is intended, although there is in can_steal_fallback()
2456 * relaxed order check in next check. The reason is that in can_steal_fallback()
2461 if (order >= pageblock_order) in can_steal_fallback()
2464 if (order >= pageblock_order / 2 || in can_steal_fallback()
2509 * This function implements actual steal behaviour. If order is large enough,
2594 * Check whether there is a suitable fallback freepage with requested order.
2599 int find_suitable_fallback(struct free_area *area, unsigned int order, in find_suitable_fallback() argument
2617 if (can_steal_fallback(order, migratetype)) in find_suitable_fallback()
2631 * Reserve a pageblock for exclusive use of high-order atomic allocations if
2632 * there are no empty page blocks that contain a page with a suitable order
2669 * potentially hurts the reliability of high-order allocations when under
2684 int order; in unreserve_highatomic_pageblock() local
2698 for (order = 0; order < MAX_ORDER; order++) { in unreserve_highatomic_pageblock()
2699 struct free_area *area = &(zone->free_area[order]); in unreserve_highatomic_pageblock()
2754 * The use of signed ints for order and current_order is a deliberate
2759 __rmqueue_fallback(struct zone *zone, int order, int start_migratetype, in __rmqueue_fallback() argument
2764 int min_order = order; in __rmqueue_fallback()
2799 && current_order > order) in __rmqueue_fallback()
2808 for (current_order = order; current_order < MAX_ORDER; in __rmqueue_fallback()
2829 trace_mm_page_alloc_extfrag(page, order, current_order, in __rmqueue_fallback()
2841 __rmqueue(struct zone *zone, unsigned int order, int migratetype, in __rmqueue() argument
2855 page = __rmqueue_cma_fallback(zone, order); in __rmqueue()
2861 page = __rmqueue_smallest(zone, order, migratetype); in __rmqueue()
2864 page = __rmqueue_cma_fallback(zone, order); in __rmqueue()
2866 if (!page && __rmqueue_fallback(zone, order, migratetype, in __rmqueue()
2871 trace_mm_page_alloc_zone_locked(page, order, migratetype); in __rmqueue()
2880 static int rmqueue_bulk(struct zone *zone, unsigned int order, in rmqueue_bulk() argument
2888 struct page *page = __rmqueue(zone, order, migratetype, in rmqueue_bulk()
2898 * physical page order. The page is added to the tail of in rmqueue_bulk()
2902 * head, thus also in the physical page order. This is useful in rmqueue_bulk()
2910 -(1 << order)); in rmqueue_bulk()
2919 __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); in rmqueue_bulk()
3109 unsigned int order, t; in mark_free_pages() local
3134 for_each_migratetype_order(order, t) { in mark_free_pages()
3136 &zone->free_area[order].free_list[t], lru) { in mark_free_pages()
3140 for (i = 0; i < (1UL << order); i++) { in mark_free_pages()
3200 * Free a 0-order page
3216 * Free a list of 0-order pages
3254 * split_page takes a non-compound higher-order page, and splits it into
3255 * n (1<<order) sub-pages: page[0..n]
3261 void split_page(struct page *page, unsigned int order) in split_page() argument
3268 for (i = 1; i < (1 << order); i++) in split_page()
3270 split_page_owner(page, 1 << order); in split_page()
3274 int __isolate_free_page(struct page *page, unsigned int order) in __isolate_free_page() argument
3288 * emulate a high-order watermark check with a raised order-0 in __isolate_free_page()
3289 * watermark, because we already know our high-order page in __isolate_free_page()
3292 watermark = zone->_watermark[WMARK_MIN] + (1UL << order); in __isolate_free_page()
3296 __mod_zone_freepage_state(zone, -(1UL << order), mt); in __isolate_free_page()
3301 del_page_from_free_list(page, zone, order); in __isolate_free_page()
3307 if (order >= pageblock_order - 1) { in __isolate_free_page()
3308 struct page *endpage = page + (1 << order) - 1; in __isolate_free_page()
3319 return 1UL << order; in __isolate_free_page()
3325 * @order: Order of the isolated page
3331 void __putback_isolated_page(struct page *page, unsigned int order, int mt) in __putback_isolated_page() argument
3339 __free_one_page(page, page_to_pfn(page), zone, order, mt, in __putback_isolated_page()
3418 * Allocate a page from the given zone. Use pcplists for order-0 allocations.
3422 struct zone *zone, unsigned int order, in rmqueue() argument
3429 if (likely(order == 0)) { in rmqueue()
3444 * allocate greater than order-1 page units with __GFP_NOFAIL. in rmqueue()
3446 WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); in rmqueue()
3452 * order-0 request can reach here when the pcplist is skipped in rmqueue()
3454 * reserved for high-order atomic allocation, so order-0 in rmqueue()
3457 if (order > 0 && alloc_flags & ALLOC_HARDER) { in rmqueue()
3458 page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC); in rmqueue()
3460 trace_mm_page_alloc_zone_locked(page, order, migratetype); in rmqueue()
3463 page = __rmqueue(zone, order, migratetype, alloc_flags); in rmqueue()
3464 } while (page && check_new_pages(page, order)); in rmqueue()
3468 __mod_zone_freepage_state(zone, -(1 << order), in rmqueue()
3471 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order); in rmqueue()
3511 static bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in __should_fail_alloc_page() argument
3513 if (order < fail_page_alloc.min_order) in __should_fail_alloc_page()
3523 return should_fail(&fail_page_alloc.attr, 1 << order); in __should_fail_alloc_page()
3540 debugfs_create_u32("min-order", mode, dir, &fail_page_alloc.min_order); in fail_page_alloc_debugfs()
3551 static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in __should_fail_alloc_page() argument
3558 noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in should_fail_alloc_page() argument
3560 return __should_fail_alloc_page(gfp_mask, order); in should_fail_alloc_page()
3565 unsigned int order, unsigned int alloc_flags) in __zone_watermark_unusable_free() argument
3568 long unusable_free = (1 << order) - 1; in __zone_watermark_unusable_free()
3588 * Return true if free base pages are above 'mark'. For high-order checks it
3589 * will return true of the order-0 watermark is reached and there is at least
3593 bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, in __zone_watermark_ok() argument
3602 free_pages -= __zone_watermark_unusable_free(z, order, alloc_flags); in __zone_watermark_ok()
3621 * Check watermarks for an order-0 allocation request. If these in __zone_watermark_ok()
3622 * are not met, then a high-order request also cannot go ahead in __zone_watermark_ok()
3628 /* If this is an order-0 request then the watermark is fine */ in __zone_watermark_ok()
3629 if (!order) in __zone_watermark_ok()
3632 /* For a high-order request, check at least one suitable page is free */ in __zone_watermark_ok()
3633 for (o = order; o < MAX_ORDER; o++) { in __zone_watermark_ok()
3657 bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, in zone_watermark_ok() argument
3660 return __zone_watermark_ok(z, order, mark, highest_zoneidx, alloc_flags, in zone_watermark_ok()
3664 static inline bool zone_watermark_fast(struct zone *z, unsigned int order, in zone_watermark_fast() argument
3673 * Fast check for order-0 only. If this fails then the reserves in zone_watermark_fast()
3676 if (!order) { in zone_watermark_fast()
3685 if (__zone_watermark_ok(z, order, mark, highest_zoneidx, alloc_flags, in zone_watermark_fast()
3689 * Ignore watermark boosting for GFP_ATOMIC order-0 allocations in zone_watermark_fast()
3694 if (unlikely(!order && (gfp_mask & __GFP_ATOMIC) && z->watermark_boost in zone_watermark_fast()
3697 return __zone_watermark_ok(z, order, mark, highest_zoneidx, in zone_watermark_fast()
3704 bool zone_watermark_ok_safe(struct zone *z, unsigned int order, in zone_watermark_ok_safe() argument
3712 return __zone_watermark_ok(z, order, mark, highest_zoneidx, 0, in zone_watermark_ok_safe()
3788 get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, in get_page_from_freelist() argument
3858 if (!zone_watermark_fast(zone, order, mark, in get_page_from_freelist()
3869 if (_deferred_grow_zone(zone, order)) in get_page_from_freelist()
3882 ret = node_reclaim(zone->zone_pgdat, gfp_mask, order); in get_page_from_freelist()
3892 if (zone_watermark_ok(zone, order, mark, in get_page_from_freelist()
3901 page = rmqueue(ac->preferred_zoneref->zone, zone, order, in get_page_from_freelist()
3904 prep_new_page(page, order, gfp_mask, alloc_flags); in get_page_from_freelist()
3907 * If this is a high-order atomic allocation then check in get_page_from_freelist()
3910 if (unlikely(order && (alloc_flags & ALLOC_HARDER))) in get_page_from_freelist()
3911 reserve_highatomic_pageblock(page, zone, order); in get_page_from_freelist()
3918 if (_deferred_grow_zone(zone, order)) in get_page_from_freelist()
3980 __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order, in __alloc_pages_cpuset_fallback() argument
3986 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
3993 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
4000 __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, in __alloc_pages_may_oom() argument
4008 .order = order, in __alloc_pages_may_oom()
4032 ~__GFP_DIRECT_RECLAIM, order, in __alloc_pages_may_oom()
4040 /* The OOM killer will not help higher order allocs */ in __alloc_pages_may_oom()
4041 if (order > PAGE_ALLOC_COSTLY_ORDER) in __alloc_pages_may_oom()
4077 page = __alloc_pages_cpuset_fallback(gfp_mask, order, in __alloc_pages_may_oom()
4092 /* Try memory compaction for high-order allocations before reclaim */
4094 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
4102 if (!order) in __alloc_pages_direct_compact()
4108 *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac, in __alloc_pages_direct_compact()
4122 prep_new_page(page, order, gfp_mask, alloc_flags); in __alloc_pages_direct_compact()
4126 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_compact()
4132 compaction_defer_reset(zone, order, true); in __alloc_pages_direct_compact()
4149 should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, in should_compact_retry() argument
4160 if (!order) in should_compact_retry()
4175 * compaction was skipped because there are not enough order-0 pages in should_compact_retry()
4179 ret = compaction_zonelist_suitable(ac, order, alloc_flags); in should_compact_retry()
4201 if (order > PAGE_ALLOC_COSTLY_ORDER) in should_compact_retry()
4213 min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ? in should_compact_retry()
4222 trace_compact_retry(order, priority, compact_result, retries, max_retries, ret); in should_compact_retry()
4227 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
4236 should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags, in should_compact_retry() argument
4244 if (!order || order > PAGE_ALLOC_COSTLY_ORDER) in should_compact_retry()
4250 * Let's give them a good hope and keep retrying while the order-0 in should_compact_retry()
4316 __perform_reclaim(gfp_t gfp_mask, unsigned int order, in __perform_reclaim() argument
4330 progress = try_to_free_pages(ac->zonelist, order, gfp_mask, in __perform_reclaim()
4344 __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_reclaim() argument
4351 *did_some_progress = __perform_reclaim(gfp_mask, order, ac); in __alloc_pages_direct_reclaim()
4356 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_reclaim()
4373 static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask, in wake_all_kswapds() argument
4384 wakeup_kswapd(zone, gfp_mask, order, highest_zoneidx); in wake_all_kswapds()
4484 should_reclaim_retry(gfp_t gfp_mask, unsigned order, in should_reclaim_retry() argument
4494 * their order will become available due to high fragmentation so in should_reclaim_retry()
4497 if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) in should_reclaim_retry()
4531 wmark = __zone_watermark_ok(zone, order, min_wmark, in should_reclaim_retry()
4533 trace_reclaim_retry_zone(z, order, reclaimable, in should_reclaim_retry()
4608 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, in __alloc_pages_slowpath() argument
4612 const bool costly_order = order > PAGE_ALLOC_COSTLY_ORDER; in __alloc_pages_slowpath()
4656 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4662 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4669 * movable high-order allocations, do that as well, as compaction will in __alloc_pages_slowpath()
4677 (order > 0 && ac->migratetype != MIGRATE_MOVABLE)) in __alloc_pages_slowpath()
4679 page = __alloc_pages_direct_compact(gfp_mask, order, in __alloc_pages_slowpath()
4695 * order, fail immediately unless the allocator has in __alloc_pages_slowpath()
4701 * bursty high order allocations, in __alloc_pages_slowpath()
4724 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4742 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4755 page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4761 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4771 * Do not retry costly high order allocations unless they are in __alloc_pages_slowpath()
4777 if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, in __alloc_pages_slowpath()
4782 * It doesn't make any sense to retry for the compaction if the order-0 in __alloc_pages_slowpath()
4788 should_compact_retry(ac, order, alloc_flags, in __alloc_pages_slowpath()
4799 page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); in __alloc_pages_slowpath()
4845 WARN_ON_ONCE(order > PAGE_ALLOC_COSTLY_ORDER); in __alloc_pages_slowpath()
4853 page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_HARDER, ac); in __alloc_pages_slowpath()
4862 "page allocation failure: order:%u", order); in __alloc_pages_slowpath()
4867 static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, in prepare_alloc_pages() argument
4894 if (should_fail_alloc_page(gfp_mask, order)) in prepare_alloc_pages()
4917 __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, in __alloc_pages_nodemask() argument
4926 * There are several places where we assume that the order value is sane in __alloc_pages_nodemask()
4929 if (unlikely(order >= MAX_ORDER)) { in __alloc_pages_nodemask()
4936 if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) in __alloc_pages_nodemask()
4946 page = get_page_from_freelist(alloc_mask, order, alloc_flags, &ac); in __alloc_pages_nodemask()
4965 page = __alloc_pages_slowpath(alloc_mask, order, &ac); in __alloc_pages_nodemask()
4969 unlikely(__memcg_kmem_charge_page(page, gfp_mask, order) != 0)) { in __alloc_pages_nodemask()
4970 __free_pages(page, order); in __alloc_pages_nodemask()
4974 trace_mm_page_alloc(page, order, alloc_mask, ac.migratetype); in __alloc_pages_nodemask()
4985 unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) in __get_free_pages() argument
4989 page = alloc_pages(gfp_mask & ~__GFP_HIGHMEM, order); in __get_free_pages()
5002 static inline void free_the_page(struct page *page, unsigned int order) in free_the_page() argument
5004 if (order == 0) /* Via pcp? */ in free_the_page()
5007 __free_pages_ok(page, order, FPI_NONE); in free_the_page()
5010 void __free_pages(struct page *page, unsigned int order) in __free_pages() argument
5013 free_the_page(page, order); in __free_pages()
5015 while (order-- > 0) in __free_pages()
5016 free_the_page(page + (1 << order), order); in __free_pages()
5020 void free_pages(unsigned long addr, unsigned int order) in free_pages() argument
5024 __free_pages(virt_to_page((void *)addr), order); in free_pages()
5033 * within a 0 or higher order page. Multiple fragments within that page
5131 * Frees a page fragment allocated out of either a compound or order 0 page.
5142 static void *make_alloc_exact(unsigned long addr, unsigned int order, in make_alloc_exact() argument
5146 unsigned long alloc_end = addr + (PAGE_SIZE << order); in make_alloc_exact()
5149 split_page(virt_to_page((void *)addr), order); in make_alloc_exact()
5175 unsigned int order = get_order(size); in alloc_pages_exact() local
5181 addr = __get_free_pages(gfp_mask, order); in alloc_pages_exact()
5182 return make_alloc_exact(addr, order, size); in alloc_pages_exact()
5200 unsigned int order = get_order(size); in alloc_pages_exact_nid() local
5206 p = alloc_pages_node(nid, gfp_mask, order); in alloc_pages_exact_nid()
5209 return make_alloc_exact((unsigned long)page_address(p), order, size); in alloc_pages_exact_nid()
5589 unsigned int order; in show_free_areas() local
5599 for (order = 0; order < MAX_ORDER; order++) { in show_free_areas()
5600 struct free_area *area = &zone->free_area[order]; in show_free_areas()
5603 nr[order] = area->nr_free; in show_free_areas()
5604 total += nr[order] << order; in show_free_areas()
5606 types[order] = 0; in show_free_areas()
5609 types[order] |= 1 << type; in show_free_areas()
5613 for (order = 0; order < MAX_ORDER; order++) { in show_free_areas()
5615 nr[order], K(1UL) << order); in show_free_areas()
5616 if (nr[order]) in show_free_areas()
5617 show_migration_types(types[order]); in show_free_areas()
5971 * needs the percpu allocator in order to allocate its pagesets in build_all_zonelists_init()
6181 unsigned int order, t; in zone_init_free_lists() local
6182 for_each_migratetype_order(order, t) { in zone_init_free_lists()
6183 INIT_LIST_HEAD(&zone->free_area[order].free_list[t]); in zone_init_free_lists()
6184 zone->free_area[order].nr_free = 0; in zone_init_free_lists()
6251 * fragmented and becoming unavailable for high-order allocations. in zone_batchsize()
6277 /* Update high, then batch, in order */ in pageset_update()
6476 * zones within a node are in order of monotonic increases memory addresses
6714 unsigned int order; in set_pageblock_order() local
6721 order = HUGETLB_PAGE_ORDER; in set_pageblock_order()
6723 order = MAX_ORDER - 1; in set_pageblock_order()
6726 * Assume the largest contiguous order of interest is a huge page. in set_pageblock_order()
6730 pageblock_order = order; in set_pageblock_order()
6927 * aligned but the node_mem_map endpoints must be in order in alloc_node_mem_map()
7407 * such cases we allow max_zone_pfn sorted in the descending order
8201 /* Make sure we've got at least a 0-order allocation.. */ in alloc_large_system_hash()
8255 pr_info("%s hash table entries: %ld (order: %d, %lu bytes, %s)\n", in alloc_large_system_hash()
8366 * in MEM_GOING_OFFLINE in order to indicate that these pages in has_unmovable_pages()
8476 unsigned int order; in alloc_contig_range() local
8481 .order = -1, in alloc_contig_range()
8493 * MIGRATE_ISOLATE. Because pageblock and max order pages may in alloc_contig_range()
8544 * page allocator holds, ie. they can be part of higher order in alloc_contig_range()
8554 order = 0; in alloc_contig_range()
8557 if (++order >= MAX_ORDER) { in alloc_contig_range()
8561 outer_start &= ~0UL << order; in alloc_contig_range()
8565 order = buddy_order(pfn_to_page(outer_start)); in alloc_contig_range()
8568 * outer_start page could be small order buddy page and in alloc_contig_range()
8573 if (outer_start + (1UL << order) <= start) in alloc_contig_range()
8761 unsigned int order; in __offline_isolated_pages() local
8790 order = buddy_order(page); in __offline_isolated_pages()
8791 del_page_from_free_list(page, zone, order); in __offline_isolated_pages()
8792 pfn += (1 << order); in __offline_isolated_pages()
8803 unsigned int order; in is_free_buddy_page() local
8806 for (order = 0; order < MAX_ORDER; order++) { in is_free_buddy_page()
8807 struct page *page_head = page - (pfn & ((1 << order) - 1)); in is_free_buddy_page()
8809 if (PageBuddy(page_head) && buddy_order(page_head) >= order) in is_free_buddy_page()
8814 return order < MAX_ORDER; in is_free_buddy_page()
8819 * Break down a higher-order page in sub-pages, and keep our target out of
8860 unsigned int order; in take_page_off_buddy() local
8864 for (order = 0; order < MAX_ORDER; order++) { in take_page_off_buddy()
8865 struct page *page_head = page - (pfn & ((1 << order) - 1)); in take_page_off_buddy()
8868 if (PageBuddy(page_head) && page_order >= order) { in take_page_off_buddy()