• Home
  • Raw
  • Download

Lines Matching full:order

243  * change gfp_allowed_mask in order to avoid using I/O during memory allocations
282 static void __free_pages_ok(struct page *page, unsigned int order,
362 * many cases very high-order allocations like THP are likely to be
419 static inline void kasan_free_nondeferred_pages(struct page *page, int order) in kasan_free_nondeferred_pages() argument
422 kasan_free_pages(page, order); in kasan_free_nondeferred_pages()
683 * Higher-order pages are called "compound pages". They are structured thusly:
693 * The first tail page's ->compound_order holds the order of allocation.
694 * This usage means that zero-order pages may not be compound.
703 void prep_compound_page(struct page *page, unsigned int order) in prep_compound_page() argument
706 int nr_pages = 1 << order; in prep_compound_page()
717 set_compound_order(page, order); in prep_compound_page()
768 unsigned int order, int migratetype) in set_page_guard() argument
773 if (order >= debug_guardpage_minorder()) in set_page_guard()
778 set_page_private(page, order); in set_page_guard()
780 __mod_zone_freepage_state(zone, -(1 << order), migratetype); in set_page_guard()
786 unsigned int order, int migratetype) in clear_page_guard() argument
795 __mod_zone_freepage_state(zone, (1 << order), migratetype); in clear_page_guard()
799 unsigned int order, int migratetype) { return false; } in set_page_guard() argument
801 unsigned int order, int migratetype) {} in clear_page_guard() argument
804 static inline void set_buddy_order(struct page *page, unsigned int order) in set_buddy_order() argument
806 set_page_private(page, order); in set_buddy_order()
815 * (c) a page and its buddy have the same order &&
821 * For recording page's order, we use page_private(page).
824 unsigned int order) in page_is_buddy() argument
829 if (buddy_order(buddy) != order) in page_is_buddy()
857 int order, int migratetype) in compaction_capture() argument
859 if (!capc || order != capc->cc->order) in compaction_capture()
868 * Do not let lower order allocations polluate a movable pageblock. in compaction_capture()
871 * have trouble finding a high-order free page. in compaction_capture()
873 if (order < pageblock_order && migratetype == MIGRATE_MOVABLE) in compaction_capture()
888 int order, int migratetype) in compaction_capture() argument
896 unsigned int order, int migratetype) in add_to_free_list() argument
898 struct free_area *area = &zone->free_area[order]; in add_to_free_list()
906 unsigned int order, int migratetype) in add_to_free_list_tail() argument
908 struct free_area *area = &zone->free_area[order]; in add_to_free_list_tail()
920 unsigned int order, int migratetype) in move_to_free_list() argument
922 struct free_area *area = &zone->free_area[order]; in move_to_free_list()
928 unsigned int order) in del_page_from_free_list() argument
937 zone->free_area[order].nr_free--; in del_page_from_free_list()
942 * of the next-highest order is free. If it is, it's possible
946 * as a higher order page
950 struct page *page, unsigned int order) in buddy_merge_likely() argument
955 if (order >= MAX_ORDER - 2) in buddy_merge_likely()
963 buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1); in buddy_merge_likely()
967 page_is_buddy(higher_page, higher_buddy, order + 1); in buddy_merge_likely()
983 * free pages of length of (1 << order) and marked with PageBuddy.
984 * Page's order is recorded in page_private(page) field.
996 struct zone *zone, unsigned int order, in __free_one_page() argument
1013 __mod_zone_freepage_state(zone, 1 << order, migratetype); in __free_one_page()
1015 VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page); in __free_one_page()
1019 while (order < max_order) { in __free_one_page()
1020 if (compaction_capture(capc, page, order, migratetype)) { in __free_one_page()
1021 __mod_zone_freepage_state(zone, -(1 << order), in __free_one_page()
1025 buddy_pfn = __find_buddy_pfn(pfn, order); in __free_one_page()
1030 if (!page_is_buddy(page, buddy, order)) in __free_one_page()
1034 * merge with it and move up one order. in __free_one_page()
1037 clear_page_guard(zone, buddy, order, migratetype); in __free_one_page()
1039 del_page_from_free_list(buddy, zone, order); in __free_one_page()
1043 order++; in __free_one_page()
1045 if (order < MAX_ORDER - 1) { in __free_one_page()
1046 /* If we are here, it means order is >= pageblock_order. in __free_one_page()
1052 * low-order merging. in __free_one_page()
1057 buddy_pfn = __find_buddy_pfn(pfn, order); in __free_one_page()
1066 max_order = order + 1; in __free_one_page()
1071 set_buddy_order(page, order); in __free_one_page()
1075 else if (is_shuffle_order(order)) in __free_one_page()
1078 to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); in __free_one_page()
1081 add_to_free_list_tail(page, zone, order, migratetype); in __free_one_page()
1083 add_to_free_list(page, zone, order, migratetype); in __free_one_page()
1087 page_reporting_notify_free(order); in __free_one_page()
1213 unsigned int order, bool check_free) in free_pages_prepare() argument
1219 trace_mm_page_free(page, order); in free_pages_prepare()
1221 if (unlikely(PageHWPoison(page)) && !order) { in free_pages_prepare()
1227 __memcg_kmem_uncharge_page(page, order); in free_pages_prepare()
1228 reset_page_owner(page, order); in free_pages_prepare()
1234 * avoid checking PageCompound for order-0 pages. in free_pages_prepare()
1236 if (unlikely(order)) { in free_pages_prepare()
1240 VM_BUG_ON_PAGE(compound && compound_order(page) != order, page); in free_pages_prepare()
1244 for (i = 1; i < (1 << order); i++) { in free_pages_prepare()
1257 __memcg_kmem_uncharge_page(page, order); in free_pages_prepare()
1265 reset_page_owner(page, order); in free_pages_prepare()
1269 PAGE_SIZE << order); in free_pages_prepare()
1271 PAGE_SIZE << order); in free_pages_prepare()
1274 kernel_init_free_pages(page, 1 << order); in free_pages_prepare()
1276 kernel_poison_pages(page, 1 << order, 0); in free_pages_prepare()
1282 arch_free_page(page, order); in free_pages_prepare()
1285 kernel_map_pages(page, 1 << order, 0); in free_pages_prepare()
1287 kasan_free_nondeferred_pages(page, order); in free_pages_prepare()
1294 * With DEBUG_VM enabled, order-0 pages are checked immediately when being freed
1312 * With DEBUG_VM disabled, order-0 pages being freed are checked only when
1313 * moving from pcp lists to free list in order to reduce overhead. With
1342 * Assumes all pages on list are in same zone, and of same order.
1435 unsigned int order, in free_one_page() argument
1443 __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); in free_one_page()
1521 static void __free_pages_ok(struct page *page, unsigned int order, in __free_pages_ok() argument
1528 if (!free_pages_prepare(page, order, true)) in __free_pages_ok()
1533 __count_vm_events(PGFREE, 1 << order); in __free_pages_ok()
1534 free_one_page(page_zone(page), page, pfn, order, migratetype, in __free_pages_ok()
1539 void __free_pages_core(struct page *page, unsigned int order) in __free_pages_core() argument
1541 unsigned int nr_pages = 1 << order; in __free_pages_core()
1565 __free_pages_ok(page, order, FPI_TO_TAIL); in __free_pages_core()
1613 unsigned int order) in memblock_free_pages() argument
1617 __free_pages_core(page, order); in memblock_free_pages()
1839 * In order to try and keep some memory in the cache we have the loop
1840 * broken along max page order boundaries. This way we will not cause
1993 * deferred pages to satisfy the allocation specified by order, rounded up to
2007 deferred_grow_zone(struct zone *zone, unsigned int order) in deferred_grow_zone() argument
2009 unsigned long nr_pages_needed = ALIGN(1 << order, PAGES_PER_SECTION); in deferred_grow_zone()
2074 _deferred_grow_zone(struct zone *zone, unsigned int order) in _deferred_grow_zone() argument
2076 return deferred_grow_zone(zone, order); in _deferred_grow_zone()
2157 * The order of subdivision here is critical for the IO subsystem.
2158 * Please do not alter this order without good reasons and regression
2160 * the order in which smaller blocks are delivered depends on the order
2162 * influencing the order in which pages are delivered to the IO
2227 * With DEBUG_VM enabled, order-0 pages are checked for expected state when
2245 * With DEBUG_VM disabled, free order-0 pages are checked for expected state
2262 static bool check_new_pages(struct page *page, unsigned int order) in check_new_pages() argument
2265 for (i = 0; i < (1 << order); i++) { in check_new_pages()
2275 inline void post_alloc_hook(struct page *page, unsigned int order, in post_alloc_hook() argument
2281 arch_alloc_page(page, order); in post_alloc_hook()
2283 kernel_map_pages(page, 1 << order, 1); in post_alloc_hook()
2284 kasan_alloc_pages(page, order); in post_alloc_hook()
2285 kernel_poison_pages(page, 1 << order, 1); in post_alloc_hook()
2286 set_page_owner(page, order, gfp_flags); in post_alloc_hook()
2289 static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags, in prep_new_page() argument
2292 post_alloc_hook(page, order, gfp_flags); in prep_new_page()
2295 kernel_init_free_pages(page, 1 << order); in prep_new_page()
2297 if (order && (gfp_flags & __GFP_COMP)) in prep_new_page()
2298 prep_compound_page(page, order); in prep_new_page()
2317 struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, in __rmqueue_smallest() argument
2325 for (current_order = order; current_order < MAX_ORDER; ++current_order) { in __rmqueue_smallest()
2331 expand(zone, page, order, current_order, migratetype); in __rmqueue_smallest()
2341 * This array describes the order lists are fallen back to when
2358 unsigned int order) in __rmqueue_cma_fallback() argument
2360 return __rmqueue_smallest(zone, order, MIGRATE_CMA); in __rmqueue_cma_fallback()
2364 unsigned int order) { return NULL; } in __rmqueue_cma_fallback() argument
2378 unsigned int order; in move_freepages() local
2405 order = buddy_order(page); in move_freepages()
2406 move_to_free_list(page, zone, order, migratetype); in move_freepages()
2407 pfn += 1 << order; in move_freepages()
2408 pages_moved += 1 << order; in move_freepages()
2459 static bool can_steal_fallback(unsigned int order, int start_mt) in can_steal_fallback() argument
2462 * Leaving this order check is intended, although there is in can_steal_fallback()
2463 * relaxed order check in next check. The reason is that in can_steal_fallback()
2468 if (order >= pageblock_order) in can_steal_fallback()
2471 if (order >= pageblock_order / 2 || in can_steal_fallback()
2518 * This function implements actual steal behaviour. If order is large enough,
2602 * Check whether there is a suitable fallback freepage with requested order.
2607 int find_suitable_fallback(struct free_area *area, unsigned int order, in find_suitable_fallback() argument
2625 if (can_steal_fallback(order, migratetype)) in find_suitable_fallback()
2639 * Reserve a pageblock for exclusive use of high-order atomic allocations if
2640 * there are no empty page blocks that contain a page with a suitable order
2677 * potentially hurts the reliability of high-order allocations when under
2692 int order; in unreserve_highatomic_pageblock() local
2706 for (order = 0; order < MAX_ORDER; order++) { in unreserve_highatomic_pageblock()
2707 struct free_area *area = &(zone->free_area[order]); in unreserve_highatomic_pageblock()
2762 * The use of signed ints for order and current_order is a deliberate
2767 __rmqueue_fallback(struct zone *zone, int order, int start_migratetype, in __rmqueue_fallback() argument
2772 int min_order = order; in __rmqueue_fallback()
2807 && current_order > order) in __rmqueue_fallback()
2816 for (current_order = order; current_order < MAX_ORDER; in __rmqueue_fallback()
2837 trace_mm_page_alloc_extfrag(page, order, current_order, in __rmqueue_fallback()
2845 __rmqueue_with_cma_reuse(struct zone *zone, unsigned int order, in __rmqueue_with_cma_reuse() argument
2850 page = __rmqueue_smallest(zone, order, migratetype); in __rmqueue_with_cma_reuse()
2855 page = __rmqueue_smallest(zone, order, migratetype); in __rmqueue_with_cma_reuse()
2859 __rmqueue_fallback(zone, order, migratetype, alloc_flags)) in __rmqueue_with_cma_reuse()
2870 __rmqueue(struct zone *zone, unsigned int order, int migratetype, in __rmqueue() argument
2876 page = __rmqueue_with_cma_reuse(zone, order, migratetype, alloc_flags); in __rmqueue()
2889 page = __rmqueue_cma_fallback(zone, order); in __rmqueue()
2895 page = __rmqueue_smallest(zone, order, migratetype); in __rmqueue()
2898 page = __rmqueue_cma_fallback(zone, order); in __rmqueue()
2900 if (!page && __rmqueue_fallback(zone, order, migratetype, in __rmqueue()
2906 trace_mm_page_alloc_zone_locked(page, order, migratetype); in __rmqueue()
2915 static int rmqueue_bulk(struct zone *zone, unsigned int order, in rmqueue_bulk() argument
2923 struct page *page = __rmqueue(zone, order, migratetype, in rmqueue_bulk()
2933 * physical page order. The page is added to the tail of in rmqueue_bulk()
2937 * head, thus also in the physical page order. This is useful in rmqueue_bulk()
2945 -(1 << order)); in rmqueue_bulk()
2954 __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); in rmqueue_bulk()
3144 unsigned int order, t; in mark_free_pages() local
3169 for_each_migratetype_order(order, t) { in mark_free_pages()
3171 &zone->free_area[order].free_list[t], lru) { in mark_free_pages()
3175 for (i = 0; i < (1UL << order); i++) { in mark_free_pages()
3235 * Free a 0-order page
3251 * Free a list of 0-order pages
3289 * split_page takes a non-compound higher-order page, and splits it into
3290 * n (1<<order) sub-pages: page[0..n]
3296 void split_page(struct page *page, unsigned int order) in split_page() argument
3303 for (i = 1; i < (1 << order); i++) in split_page()
3305 split_page_owner(page, 1 << order); in split_page()
3306 split_page_memcg(page, 1 << order); in split_page()
3310 int __isolate_free_page(struct page *page, unsigned int order) in __isolate_free_page() argument
3324 * emulate a high-order watermark check with a raised order-0 in __isolate_free_page()
3325 * watermark, because we already know our high-order page in __isolate_free_page()
3328 watermark = zone->_watermark[WMARK_MIN] + (1UL << order); in __isolate_free_page()
3332 __mod_zone_freepage_state(zone, -(1UL << order), mt); in __isolate_free_page()
3337 del_page_from_free_list(page, zone, order); in __isolate_free_page()
3343 if (order >= pageblock_order - 1) { in __isolate_free_page()
3344 struct page *endpage = page + (1 << order) - 1; in __isolate_free_page()
3355 return 1UL << order; in __isolate_free_page()
3361 * @order: Order of the isolated page
3367 void __putback_isolated_page(struct page *page, unsigned int order, int mt) in __putback_isolated_page() argument
3375 __free_one_page(page, page_to_pfn(page), zone, order, mt, in __putback_isolated_page()
3454 * Allocate a page from the given zone. Use pcplists for order-0 allocations.
3458 struct zone *zone, unsigned int order, in rmqueue() argument
3465 if (likely(order == 0)) { in rmqueue()
3481 * allocate greater than order-1 page units with __GFP_NOFAIL. in rmqueue()
3483 WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); in rmqueue()
3489 * order-0 request can reach here when the pcplist is skipped in rmqueue()
3491 * reserved for high-order atomic allocation, so order-0 in rmqueue()
3494 if (order > 0 && alloc_flags & ALLOC_HARDER) { in rmqueue()
3495 page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC); in rmqueue()
3497 trace_mm_page_alloc_zone_locked(page, order, migratetype); in rmqueue()
3500 page = __rmqueue(zone, order, migratetype, alloc_flags); in rmqueue()
3501 } while (page && check_new_pages(page, order)); in rmqueue()
3505 __mod_zone_freepage_state(zone, -(1 << order), in rmqueue()
3508 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order); in rmqueue()
3548 static bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in __should_fail_alloc_page() argument
3550 if (order < fail_page_alloc.min_order) in __should_fail_alloc_page()
3560 return should_fail(&fail_page_alloc.attr, 1 << order); in __should_fail_alloc_page()
3577 debugfs_create_u32("min-order", mode, dir, &fail_page_alloc.min_order); in fail_page_alloc_debugfs()
3588 static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in __should_fail_alloc_page() argument
3595 noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in should_fail_alloc_page() argument
3597 return __should_fail_alloc_page(gfp_mask, order); in should_fail_alloc_page()
3602 unsigned int order, unsigned int alloc_flags) in __zone_watermark_unusable_free() argument
3605 long unusable_free = (1 << order) - 1; in __zone_watermark_unusable_free()
3625 * Return true if free base pages are above 'mark'. For high-order checks it
3626 * will return true of the order-0 watermark is reached and there is at least
3630 bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, in __zone_watermark_ok() argument
3639 free_pages -= __zone_watermark_unusable_free(z, order, alloc_flags); in __zone_watermark_ok()
3658 * Check watermarks for an order-0 allocation request. If these in __zone_watermark_ok()
3659 * are not met, then a high-order request also cannot go ahead in __zone_watermark_ok()
3665 /* If this is an order-0 request then the watermark is fine */ in __zone_watermark_ok()
3666 if (!order) in __zone_watermark_ok()
3669 /* For a high-order request, check at least one suitable page is free */ in __zone_watermark_ok()
3670 for (o = order; o < MAX_ORDER; o++) { in __zone_watermark_ok()
3694 bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, in zone_watermark_ok() argument
3697 return __zone_watermark_ok(z, order, mark, highest_zoneidx, alloc_flags, in zone_watermark_ok()
3701 static inline bool zone_watermark_fast(struct zone *z, unsigned int order, in zone_watermark_fast() argument
3710 * Fast check for order-0 only. If this fails then the reserves in zone_watermark_fast()
3713 if (!order) { in zone_watermark_fast()
3722 if (__zone_watermark_ok(z, order, mark, highest_zoneidx, alloc_flags, in zone_watermark_fast()
3726 * Ignore watermark boosting for GFP_ATOMIC order-0 allocations in zone_watermark_fast()
3731 if (unlikely(!order && (gfp_mask & __GFP_ATOMIC) && z->watermark_boost in zone_watermark_fast()
3734 return __zone_watermark_ok(z, order, mark, highest_zoneidx, in zone_watermark_fast()
3741 bool zone_watermark_ok_safe(struct zone *z, unsigned int order, in zone_watermark_ok_safe() argument
3749 return __zone_watermark_ok(z, order, mark, highest_zoneidx, 0, in zone_watermark_ok_safe()
3825 get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, in get_page_from_freelist() argument
3895 if (!zone_watermark_fast(zone, order, mark, in get_page_from_freelist()
3906 if (_deferred_grow_zone(zone, order)) in get_page_from_freelist()
3919 ret = node_reclaim(zone->zone_pgdat, gfp_mask, order); in get_page_from_freelist()
3929 if (zone_watermark_ok(zone, order, mark, in get_page_from_freelist()
3938 page = rmqueue(ac->preferred_zoneref->zone, zone, order, in get_page_from_freelist()
3941 prep_new_page(page, order, gfp_mask, alloc_flags); in get_page_from_freelist()
3944 * If this is a high-order atomic allocation then check in get_page_from_freelist()
3947 if (unlikely(order && (alloc_flags & ALLOC_HARDER))) in get_page_from_freelist()
3948 reserve_highatomic_pageblock(page, zone, order); in get_page_from_freelist()
3955 if (_deferred_grow_zone(zone, order)) in get_page_from_freelist()
4019 __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order, in __alloc_pages_cpuset_fallback() argument
4025 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
4032 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
4039 __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, in __alloc_pages_may_oom() argument
4047 .order = order, in __alloc_pages_may_oom()
4071 ~__GFP_DIRECT_RECLAIM, order, in __alloc_pages_may_oom()
4079 /* The OOM killer will not help higher order allocs */ in __alloc_pages_may_oom()
4080 if (order > PAGE_ALLOC_COSTLY_ORDER) in __alloc_pages_may_oom()
4116 page = __alloc_pages_cpuset_fallback(gfp_mask, order, in __alloc_pages_may_oom()
4131 /* Try memory compaction for high-order allocations before reclaim */
4133 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
4141 if (!order) in __alloc_pages_direct_compact()
4147 *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac, in __alloc_pages_direct_compact()
4161 prep_new_page(page, order, gfp_mask, alloc_flags); in __alloc_pages_direct_compact()
4165 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_compact()
4171 compaction_defer_reset(zone, order, true); in __alloc_pages_direct_compact()
4188 should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, in should_compact_retry() argument
4199 if (!order) in should_compact_retry()
4214 * compaction was skipped because there are not enough order-0 pages in should_compact_retry()
4218 ret = compaction_zonelist_suitable(ac, order, alloc_flags); in should_compact_retry()
4240 if (order > PAGE_ALLOC_COSTLY_ORDER) in should_compact_retry()
4252 min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ? in should_compact_retry()
4261 trace_compact_retry(order, priority, compact_result, retries, max_retries, ret); in should_compact_retry()
4266 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
4275 should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags, in should_compact_retry() argument
4283 if (!order || order > PAGE_ALLOC_COSTLY_ORDER) in should_compact_retry()
4289 * Let's give them a good hope and keep retrying while the order-0 in should_compact_retry()
4355 __perform_reclaim(gfp_t gfp_mask, unsigned int order, in __perform_reclaim() argument
4369 progress = try_to_free_pages(ac->zonelist, order, gfp_mask, in __perform_reclaim()
4383 __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_reclaim() argument
4390 *did_some_progress = __perform_reclaim(gfp_mask, order, ac); in __alloc_pages_direct_reclaim()
4395 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_reclaim()
4418 static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask, in wake_all_kswapds() argument
4429 wakeup_kswapd(zone, gfp_mask, order, highest_zoneidx); in wake_all_kswapds()
4529 should_reclaim_retry(gfp_t gfp_mask, unsigned order, in should_reclaim_retry() argument
4539 * their order will become available due to high fragmentation so in should_reclaim_retry()
4542 if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) in should_reclaim_retry()
4576 wmark = __zone_watermark_ok(zone, order, min_wmark, in should_reclaim_retry()
4578 trace_reclaim_retry_zone(z, order, reclaimable, in should_reclaim_retry()
4653 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, in __alloc_pages_slowpath() argument
4657 const bool costly_order = order > PAGE_ALLOC_COSTLY_ORDER; in __alloc_pages_slowpath()
4704 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4710 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4717 * movable high-order allocations, do that as well, as compaction will in __alloc_pages_slowpath()
4725 (order > 0 && ac->migratetype != MIGRATE_MOVABLE)) in __alloc_pages_slowpath()
4727 page = __alloc_pages_direct_compact(gfp_mask, order, in __alloc_pages_slowpath()
4743 * order, fail immediately unless the allocator has in __alloc_pages_slowpath()
4749 * bursty high order allocations, in __alloc_pages_slowpath()
4772 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4790 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4806 page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4815 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4825 * Do not retry costly high order allocations unless they are in __alloc_pages_slowpath()
4831 if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, in __alloc_pages_slowpath()
4836 * It doesn't make any sense to retry for the compaction if the order-0 in __alloc_pages_slowpath()
4842 should_compact_retry(ac, order, alloc_flags, in __alloc_pages_slowpath()
4853 page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); in __alloc_pages_slowpath()
4899 WARN_ON_ONCE(order > PAGE_ALLOC_COSTLY_ORDER); in __alloc_pages_slowpath()
4907 page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_HARDER, ac); in __alloc_pages_slowpath()
4916 "page allocation failure: order:%u", order); in __alloc_pages_slowpath()
4921 static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, in prepare_alloc_pages() argument
4953 if (should_fail_alloc_page(gfp_mask, order)) in prepare_alloc_pages()
4976 __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, in __alloc_pages_nodemask() argument
4985 * There are several places where we assume that the order value is sane in __alloc_pages_nodemask()
4988 if (unlikely(order >= MAX_ORDER)) { in __alloc_pages_nodemask()
4995 if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) in __alloc_pages_nodemask()
5005 page = get_page_from_freelist(alloc_mask, order, alloc_flags, &ac); in __alloc_pages_nodemask()
5024 page = __alloc_pages_slowpath(alloc_mask, order, &ac); in __alloc_pages_nodemask()
5028 unlikely(__memcg_kmem_charge_page(page, gfp_mask, order) != 0)) { in __alloc_pages_nodemask()
5029 __free_pages(page, order); in __alloc_pages_nodemask()
5033 trace_mm_page_alloc(page, order, alloc_mask, ac.migratetype); in __alloc_pages_nodemask()
5044 unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) in __get_free_pages() argument
5048 page = alloc_pages(gfp_mask & ~__GFP_HIGHMEM, order); in __get_free_pages()
5061 static inline void free_the_page(struct page *page, unsigned int order) in free_the_page() argument
5063 if (order == 0) /* Via pcp? */ in free_the_page()
5066 __free_pages_ok(page, order, FPI_NONE); in free_the_page()
5069 void __free_pages(struct page *page, unsigned int order) in __free_pages() argument
5072 free_the_page(page, order); in __free_pages()
5074 while (order-- > 0) in __free_pages()
5075 free_the_page(page + (1 << order), order); in __free_pages()
5079 void free_pages(unsigned long addr, unsigned int order) in free_pages() argument
5083 __free_pages(virt_to_page((void *)addr), order); in free_pages()
5092 * within a 0 or higher order page. Multiple fragments within that page
5120 int order = get_order(nc->size); in __page_frag_cache_refill() local
5123 unsigned int deta = 1U << (unsigned int)order; in __page_frag_cache_refill()
5125 for (i = 0; i < (1 << order); i++) { in __page_frag_cache_refill()
5215 * Frees a page fragment allocated out of either a compound or order 0 page.
5234 static void *make_alloc_exact(unsigned long addr, unsigned int order, in make_alloc_exact() argument
5238 unsigned long alloc_end = addr + (PAGE_SIZE << order); in make_alloc_exact()
5241 split_page(virt_to_page((void *)addr), order); in make_alloc_exact()
5267 unsigned int order = get_order(size); in alloc_pages_exact() local
5273 addr = __get_free_pages(gfp_mask, order); in alloc_pages_exact()
5274 return make_alloc_exact(addr, order, size); in alloc_pages_exact()
5292 unsigned int order = get_order(size); in alloc_pages_exact_nid() local
5298 p = alloc_pages_node(nid, gfp_mask, order); in alloc_pages_exact_nid()
5301 return make_alloc_exact((unsigned long)page_address(p), order, size); in alloc_pages_exact_nid()
5681 unsigned int order; in show_free_areas() local
5691 for (order = 0; order < MAX_ORDER; order++) { in show_free_areas()
5692 struct free_area *area = &zone->free_area[order]; in show_free_areas()
5695 nr[order] = area->nr_free; in show_free_areas()
5696 total += nr[order] << order; in show_free_areas()
5698 types[order] = 0; in show_free_areas()
5701 types[order] |= 1 << type; in show_free_areas()
5705 for (order = 0; order < MAX_ORDER; order++) { in show_free_areas()
5707 nr[order], K(1UL) << order); in show_free_areas()
5708 if (nr[order]) in show_free_areas()
5709 show_migration_types(types[order]); in show_free_areas()
6063 * needs the percpu allocator in order to allocate its pagesets in build_all_zonelists_init()
6273 unsigned int order, t; in zone_init_free_lists() local
6274 for_each_migratetype_order(order, t) { in zone_init_free_lists()
6275 INIT_LIST_HEAD(&zone->free_area[order].free_list[t]); in zone_init_free_lists()
6276 zone->free_area[order].nr_free = 0; in zone_init_free_lists()
6444 * fragmented and becoming unavailable for high-order allocations. in zone_batchsize()
6470 /* Update high, then batch, in order */ in pageset_update()
6669 * zones within a node are in order of monotonic increases memory addresses
6907 unsigned int order; in set_pageblock_order() local
6914 order = HUGETLB_PAGE_ORDER; in set_pageblock_order()
6916 order = MAX_ORDER - 1; in set_pageblock_order()
6919 * Assume the largest contiguous order of interest is a huge page. in set_pageblock_order()
6923 pageblock_order = order; in set_pageblock_order()
7126 * aligned but the node_mem_map endpoints must be in order in alloc_node_mem_map()
7524 * such cases we allow max_zone_pfn sorted in the descending order
8312 /* Make sure we've got at least a 0-order allocation.. */ in alloc_large_system_hash()
8366 pr_info("%s hash table entries: %ld (order: %d, %lu bytes, %s)\n", in alloc_large_system_hash()
8477 * in MEM_GOING_OFFLINE in order to indicate that these pages in has_unmovable_pages()
8587 unsigned int order; in alloc_contig_range() local
8592 .order = -1, in alloc_contig_range()
8604 * MIGRATE_ISOLATE. Because pageblock and max order pages may in alloc_contig_range()
8655 * page allocator holds, ie. they can be part of higher order in alloc_contig_range()
8665 order = 0; in alloc_contig_range()
8668 if (++order >= MAX_ORDER) { in alloc_contig_range()
8672 outer_start &= ~0UL << order; in alloc_contig_range()
8676 order = buddy_order(pfn_to_page(outer_start)); in alloc_contig_range()
8679 * outer_start page could be small order buddy page and in alloc_contig_range()
8684 if (outer_start + (1UL << order) <= start) in alloc_contig_range()
8872 unsigned int order; in __offline_isolated_pages() local
8901 order = buddy_order(page); in __offline_isolated_pages()
8902 del_page_from_free_list(page, zone, order); in __offline_isolated_pages()
8903 pfn += (1 << order); in __offline_isolated_pages()
8914 unsigned int order; in is_free_buddy_page() local
8917 for (order = 0; order < MAX_ORDER; order++) { in is_free_buddy_page()
8918 struct page *page_head = page - (pfn & ((1 << order) - 1)); in is_free_buddy_page()
8920 if (PageBuddy(page_head) && buddy_order(page_head) >= order) in is_free_buddy_page()
8925 return order < MAX_ORDER; in is_free_buddy_page()
8930 * Break down a higher-order page in sub-pages, and keep our target out of
8971 unsigned int order; in take_page_off_buddy() local
8975 for (order = 0; order < MAX_ORDER; order++) { in take_page_off_buddy()
8976 struct page *page_head = page - (pfn & ((1 << order) - 1)); in take_page_off_buddy()
8979 if (PageBuddy(page_head) && page_order >= order) { in take_page_off_buddy()