Lines Matching refs:order
229 static void __free_pages_ok(struct page *page, unsigned int order,
303 static bool page_contains_unaccepted(struct page *page, unsigned int order);
304 static void accept_page(struct page *page, unsigned int order);
305 static bool cond_accept_memory(struct zone *zone, unsigned int order);
331 _deferred_grow_zone(struct zone *zone, unsigned int order) in _deferred_grow_zone() argument
333 return deferred_grow_zone(zone, order); in _deferred_grow_zone()
520 static inline unsigned int order_to_pindex(int migratetype, int order) in order_to_pindex() argument
525 if (order > PAGE_ALLOC_COSTLY_ORDER) { in order_to_pindex()
526 VM_BUG_ON(order != pageblock_order); in order_to_pindex()
533 VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER); in order_to_pindex()
536 return (MIGRATE_PCPTYPES * order) + migratetype; in order_to_pindex()
541 int order = pindex / MIGRATE_PCPTYPES; in pindex_to_order() local
545 order = pageblock_order; in pindex_to_order()
547 VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER); in pindex_to_order()
550 return order; in pindex_to_order()
553 static inline bool pcp_allowed_order(unsigned int order) in pcp_allowed_order() argument
555 if (order <= PAGE_ALLOC_COSTLY_ORDER) in pcp_allowed_order()
558 if (order == pageblock_order) in pcp_allowed_order()
564 static inline void free_the_page(struct page *page, unsigned int order) in free_the_page() argument
566 if (pcp_allowed_order(order)) /* Via pcp? */ in free_the_page()
567 free_unref_page(page, order); in free_the_page()
569 __free_pages_ok(page, order, FPI_NONE); in free_the_page()
584 void prep_compound_page(struct page *page, unsigned int order) in prep_compound_page() argument
587 int nr_pages = 1 << order; in prep_compound_page()
593 prep_compound_head(page, order); in prep_compound_page()
610 static inline void set_buddy_order(struct page *page, unsigned int order) in set_buddy_order() argument
612 set_page_private(page, order); in set_buddy_order()
629 int order, int migratetype) in compaction_capture() argument
631 if (!capc || order != capc->cc->order) in compaction_capture()
645 if (order < pageblock_order && migratetype == MIGRATE_MOVABLE) in compaction_capture()
660 int order, int migratetype) in compaction_capture() argument
668 unsigned int order, int migratetype) in add_to_free_list() argument
670 struct free_area *area = &zone->free_area[order]; in add_to_free_list()
678 unsigned int order, int migratetype) in add_to_free_list_tail() argument
680 struct free_area *area = &zone->free_area[order]; in add_to_free_list_tail()
692 unsigned int order, int migratetype) in move_to_free_list() argument
694 struct free_area *area = &zone->free_area[order]; in move_to_free_list()
700 unsigned int order) in del_page_from_free_list() argument
709 zone->free_area[order].nr_free--; in del_page_from_free_list()
729 struct page *page, unsigned int order) in buddy_merge_likely() argument
734 if (order >= MAX_ORDER - 1) in buddy_merge_likely()
740 return find_buddy_page_pfn(higher_page, higher_page_pfn, order + 1, in buddy_merge_likely()
770 struct zone *zone, unsigned int order, in __free_one_page() argument
784 __mod_zone_freepage_state(zone, 1 << order, migratetype); in __free_one_page()
786 VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page); in __free_one_page()
789 while (order < MAX_ORDER) { in __free_one_page()
790 if (compaction_capture(capc, page, order, migratetype)) { in __free_one_page()
791 __mod_zone_freepage_state(zone, -(1 << order), in __free_one_page()
796 buddy = find_buddy_page_pfn(page, pfn, order, &buddy_pfn); in __free_one_page()
800 if (unlikely(order >= pageblock_order)) { in __free_one_page()
820 clear_page_guard(zone, buddy, order, migratetype); in __free_one_page()
822 del_page_from_free_list(buddy, zone, order); in __free_one_page()
826 order++; in __free_one_page()
830 set_buddy_order(page, order); in __free_one_page()
834 else if (is_shuffle_order(order)) in __free_one_page()
837 to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); in __free_one_page()
840 add_to_free_list_tail(page, zone, order, migratetype); in __free_one_page()
842 add_to_free_list(page, zone, order, migratetype); in __free_one_page()
846 page_reporting_notify_free(order); in __free_one_page()
863 unsigned int order, unsigned long split_pfn_offset) in split_free_page() argument
878 if (!PageBuddy(free_page) || buddy_order(free_page) != order) { in split_free_page()
885 __mod_zone_freepage_state(zone, -(1UL << order), mt); in split_free_page()
887 del_page_from_free_list(free_page, zone, order); in split_free_page()
889 pfn < free_page_pfn + (1UL << order);) { in split_free_page()
893 pfn ? __ffs(pfn) : order, in split_free_page()
901 split_pfn_offset = (1UL << order) - (pfn - free_page_pfn); in split_free_page()
1081 unsigned int order, fpi_t fpi_flags) in free_pages_prepare() argument
1089 trace_mm_page_free(page, order); in free_pages_prepare()
1090 kmsan_free_page(page, order); in free_pages_prepare()
1092 if (unlikely(PageHWPoison(page)) && !order) { in free_pages_prepare()
1098 __memcg_kmem_uncharge_page(page, order); in free_pages_prepare()
1099 reset_page_owner(page, order); in free_pages_prepare()
1100 page_table_check_free(page, order); in free_pages_prepare()
1108 if (unlikely(order)) { in free_pages_prepare()
1112 VM_BUG_ON_PAGE(compound && compound_order(page) != order, page); in free_pages_prepare()
1116 for (i = 1; i < (1 << order); i++) { in free_pages_prepare()
1131 __memcg_kmem_uncharge_page(page, order); in free_pages_prepare()
1141 reset_page_owner(page, order); in free_pages_prepare()
1142 page_table_check_free(page, order); in free_pages_prepare()
1146 PAGE_SIZE << order); in free_pages_prepare()
1148 PAGE_SIZE << order); in free_pages_prepare()
1151 kernel_poison_pages(page, 1 << order); in free_pages_prepare()
1162 kasan_poison_pages(page, order, init); in free_pages_prepare()
1169 kernel_init_pages(page, 1 << order); in free_pages_prepare()
1176 arch_free_page(page, order); in free_pages_prepare()
1178 debug_pagealloc_unmap_pages(page, 1 << order); in free_pages_prepare()
1193 unsigned int order; in free_pcppages_bulk() local
1220 order = pindex_to_order(pindex); in free_pcppages_bulk()
1221 nr_pages = 1 << order; in free_pcppages_bulk()
1239 __free_one_page(page, page_to_pfn(page), zone, order, mt, FPI_NONE); in free_pcppages_bulk()
1240 trace_mm_page_pcpu_drain(page, order, mt); in free_pcppages_bulk()
1249 unsigned int order, in free_one_page() argument
1259 __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); in free_one_page()
1263 static void __free_pages_ok(struct page *page, unsigned int order, in __free_pages_ok() argument
1271 if (!free_pages_prepare(page, order, fpi_flags)) in __free_pages_ok()
1286 __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); in __free_pages_ok()
1289 __count_vm_events(PGFREE, 1 << order); in __free_pages_ok()
1292 void __free_pages_core(struct page *page, unsigned int order) in __free_pages_core() argument
1294 unsigned int nr_pages = 1 << order; in __free_pages_core()
1314 if (page_contains_unaccepted(page, order)) { in __free_pages_core()
1315 if (order == MAX_ORDER && __free_unaccepted(page)) in __free_pages_core()
1318 accept_page(page, order); in __free_pages_core()
1325 __free_pages_ok(page, order, FPI_TO_TAIL); in __free_pages_core()
1443 static inline bool check_new_pages(struct page *page, unsigned int order) in check_new_pages() argument
1446 for (int i = 0; i < (1 << order); i++) { in check_new_pages()
1485 inline void post_alloc_hook(struct page *page, unsigned int order, in post_alloc_hook() argument
1496 arch_alloc_page(page, order); in post_alloc_hook()
1497 debug_pagealloc_map_pages(page, 1 << order); in post_alloc_hook()
1504 kernel_unpoison_pages(page, 1 << order); in post_alloc_hook()
1518 for (i = 0; i != 1 << order; ++i) in post_alloc_hook()
1525 kasan_unpoison_pages(page, order, init)) { in post_alloc_hook()
1534 for (i = 0; i != 1 << order; ++i) in post_alloc_hook()
1539 kernel_init_pages(page, 1 << order); in post_alloc_hook()
1541 set_page_owner(page, order, gfp_flags); in post_alloc_hook()
1542 page_table_check_alloc(page, order); in post_alloc_hook()
1545 static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags, in prep_new_page() argument
1548 post_alloc_hook(page, order, gfp_flags); in prep_new_page()
1550 if (order && (gfp_flags & __GFP_COMP)) in prep_new_page()
1551 prep_compound_page(page, order); in prep_new_page()
1570 struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, in __rmqueue_smallest() argument
1578 for (current_order = order; current_order < NR_PAGE_ORDERS; ++current_order) { in __rmqueue_smallest()
1584 expand(zone, page, order, current_order, migratetype); in __rmqueue_smallest()
1586 trace_mm_page_alloc_zone_locked(page, order, migratetype, in __rmqueue_smallest()
1587 pcp_allowed_order(order) && in __rmqueue_smallest()
1610 unsigned int order) in __rmqueue_cma_fallback() argument
1612 return __rmqueue_smallest(zone, order, MIGRATE_CMA); in __rmqueue_cma_fallback()
1616 unsigned int order) { return NULL; } in __rmqueue_cma_fallback() argument
1630 unsigned int order; in move_freepages() local
1652 order = buddy_order(page); in move_freepages()
1653 move_to_free_list(page, zone, order, migratetype); in move_freepages()
1654 pfn += 1 << order; in move_freepages()
1655 pages_moved += 1 << order; in move_freepages()
1706 static bool can_steal_fallback(unsigned int order, int start_mt) in can_steal_fallback() argument
1715 if (order >= pageblock_order) in can_steal_fallback()
1718 if (order >= pageblock_order / 2 || in can_steal_fallback()
1853 int find_suitable_fallback(struct free_area *area, unsigned int order, in find_suitable_fallback() argument
1868 if (can_steal_fallback(order, migratetype)) in find_suitable_fallback()
1934 int order; in unreserve_highatomic_pageblock() local
1948 for (order = 0; order < NR_PAGE_ORDERS; order++) { in unreserve_highatomic_pageblock()
1949 struct free_area *area = &(zone->free_area[order]); in unreserve_highatomic_pageblock()
2009 __rmqueue_fallback(struct zone *zone, int order, int start_migratetype, in __rmqueue_fallback() argument
2014 int min_order = order; in __rmqueue_fallback()
2024 if (order < pageblock_order && alloc_flags & ALLOC_NOFRAGMENT) in __rmqueue_fallback()
2049 && current_order > order) in __rmqueue_fallback()
2058 for (current_order = order; current_order < NR_PAGE_ORDERS; current_order++) { in __rmqueue_fallback()
2078 trace_mm_page_alloc_extfrag(page, order, current_order, in __rmqueue_fallback()
2090 __rmqueue(struct zone *zone, unsigned int order, int migratetype, in __rmqueue() argument
2104 page = __rmqueue_cma_fallback(zone, order); in __rmqueue()
2110 page = __rmqueue_smallest(zone, order, migratetype); in __rmqueue()
2113 page = __rmqueue_cma_fallback(zone, order); in __rmqueue()
2115 if (!page && __rmqueue_fallback(zone, order, migratetype, in __rmqueue()
2127 static int rmqueue_bulk(struct zone *zone, unsigned int order, in rmqueue_bulk() argument
2136 struct page *page = __rmqueue(zone, order, migratetype, in rmqueue_bulk()
2154 -(1 << order)); in rmqueue_bulk()
2157 __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); in rmqueue_bulk()
2319 unsigned int order) in free_unref_page_prepare() argument
2323 if (!free_pages_prepare(page, order, FPI_NONE)) in free_unref_page_prepare()
2380 unsigned int order) in free_unref_page_commit() argument
2386 __count_vm_events(PGFREE, 1 << order); in free_unref_page_commit()
2387 pindex = order_to_pindex(migratetype, order); in free_unref_page_commit()
2389 pcp->count += 1 << order; in free_unref_page_commit()
2397 free_high = (pcp->free_factor && order && order <= PAGE_ALLOC_COSTLY_ORDER); in free_unref_page_commit()
2408 void free_unref_page(struct page *page, unsigned int order) in free_unref_page() argument
2416 if (!free_unref_page_prepare(page, pfn, order)) in free_unref_page()
2429 free_one_page(page_zone(page), page, pfn, order, migratetype, FPI_NONE); in free_unref_page()
2439 free_unref_page_commit(zone, pcp, page, pcpmigratetype, order); in free_unref_page()
2442 free_one_page(zone, page, pfn, order, migratetype, FPI_NONE); in free_unref_page()
2540 void split_page(struct page *page, unsigned int order) in split_page() argument
2547 for (i = 1; i < (1 << order); i++) in split_page()
2549 split_page_owner(page, 1 << order); in split_page()
2550 split_page_memcg(page, 1 << order); in split_page()
2554 int __isolate_free_page(struct page *page, unsigned int order) in __isolate_free_page() argument
2567 watermark = zone->_watermark[WMARK_MIN] + (1UL << order); in __isolate_free_page()
2571 __mod_zone_freepage_state(zone, -(1UL << order), mt); in __isolate_free_page()
2574 del_page_from_free_list(page, zone, order); in __isolate_free_page()
2580 if (order >= pageblock_order - 1) { in __isolate_free_page()
2581 struct page *endpage = page + (1 << order) - 1; in __isolate_free_page()
2594 return 1UL << order; in __isolate_free_page()
2606 void __putback_isolated_page(struct page *page, unsigned int order, int mt) in __putback_isolated_page() argument
2614 __free_one_page(page, page_to_pfn(page), zone, order, mt, in __putback_isolated_page()
2646 unsigned int order, unsigned int alloc_flags, in rmqueue_buddy() argument
2656 page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC); in rmqueue_buddy()
2658 page = __rmqueue(zone, order, migratetype, alloc_flags); in rmqueue_buddy()
2667 page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC); in rmqueue_buddy()
2674 __mod_zone_freepage_state(zone, -(1 << order), in rmqueue_buddy()
2677 } while (check_new_pages(page, order)); in rmqueue_buddy()
2679 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order); in rmqueue_buddy()
2687 struct page *__rmqueue_pcplist(struct zone *zone, unsigned int order, in __rmqueue_pcplist() argument
2708 batch = max(batch >> order, 2); in __rmqueue_pcplist()
2709 alloced = rmqueue_bulk(zone, order, in __rmqueue_pcplist()
2713 pcp->count += alloced << order; in __rmqueue_pcplist()
2720 pcp->count -= 1 << order; in __rmqueue_pcplist()
2721 } while (check_new_pages(page, order)); in __rmqueue_pcplist()
2728 struct zone *zone, unsigned int order, in rmqueue_pcplist() argument
2750 list = &pcp->lists[order_to_pindex(migratetype, order)]; in rmqueue_pcplist()
2751 page = __rmqueue_pcplist(zone, order, migratetype, alloc_flags, pcp, list); in rmqueue_pcplist()
2755 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order); in rmqueue_pcplist()
2775 struct zone *zone, unsigned int order, in rmqueue() argument
2785 WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); in rmqueue()
2787 if (likely(pcp_allowed_order(order))) { in rmqueue()
2788 page = rmqueue_pcplist(preferred_zone, zone, order, in rmqueue()
2794 page = rmqueue_buddy(preferred_zone, zone, order, alloc_flags, in rmqueue()
2809 noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in should_fail_alloc_page() argument
2811 return __should_fail_alloc_page(gfp_mask, order); in should_fail_alloc_page()
2816 unsigned int order, unsigned int alloc_flags) in __zone_watermark_unusable_free() argument
2818 long unusable_free = (1 << order) - 1; in __zone_watermark_unusable_free()
2843 bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, in __zone_watermark_ok() argument
2851 free_pages -= __zone_watermark_unusable_free(z, order, alloc_flags); in __zone_watermark_ok()
2891 if (!order) in __zone_watermark_ok()
2895 for (o = order; o < NR_PAGE_ORDERS; o++) { in __zone_watermark_ok()
2921 bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, in zone_watermark_ok() argument
2924 return __zone_watermark_ok(z, order, mark, highest_zoneidx, alloc_flags, in zone_watermark_ok()
2928 static inline bool zone_watermark_fast(struct zone *z, unsigned int order, in zone_watermark_fast() argument
2940 if (!order) { in zone_watermark_fast()
2953 if (__zone_watermark_ok(z, order, mark, highest_zoneidx, alloc_flags, in zone_watermark_fast()
2963 if (unlikely(!order && (alloc_flags & ALLOC_MIN_RESERVE) && z->watermark_boost in zone_watermark_fast()
2966 return __zone_watermark_ok(z, order, mark, highest_zoneidx, in zone_watermark_fast()
2973 bool zone_watermark_ok_safe(struct zone *z, unsigned int order, in zone_watermark_ok_safe() argument
2981 return __zone_watermark_ok(z, order, mark, highest_zoneidx, 0, in zone_watermark_ok_safe()
3056 get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, in get_page_from_freelist() argument
3126 cond_accept_memory(zone, order); in get_page_from_freelist()
3129 if (!zone_watermark_fast(zone, order, mark, in get_page_from_freelist()
3134 if (cond_accept_memory(zone, order)) in get_page_from_freelist()
3143 if (_deferred_grow_zone(zone, order)) in get_page_from_freelist()
3156 ret = node_reclaim(zone->zone_pgdat, gfp_mask, order); in get_page_from_freelist()
3166 if (zone_watermark_ok(zone, order, mark, in get_page_from_freelist()
3175 page = rmqueue(ac->preferred_zoneref->zone, zone, order, in get_page_from_freelist()
3178 prep_new_page(page, order, gfp_mask, alloc_flags); in get_page_from_freelist()
3189 if (cond_accept_memory(zone, order)) in get_page_from_freelist()
3195 if (_deferred_grow_zone(zone, order)) in get_page_from_freelist()
3259 __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order, in __alloc_pages_cpuset_fallback() argument
3265 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
3272 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
3279 __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, in __alloc_pages_may_oom() argument
3287 .order = order, in __alloc_pages_may_oom()
3311 ~__GFP_DIRECT_RECLAIM, order, in __alloc_pages_may_oom()
3320 if (order > PAGE_ALLOC_COSTLY_ORDER) in __alloc_pages_may_oom()
3357 page = __alloc_pages_cpuset_fallback(gfp_mask, order, in __alloc_pages_may_oom()
3374 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
3382 if (!order) in __alloc_pages_direct_compact()
3389 *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac, in __alloc_pages_direct_compact()
3406 prep_new_page(page, order, gfp_mask, alloc_flags); in __alloc_pages_direct_compact()
3410 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_compact()
3416 compaction_defer_reset(zone, order, true); in __alloc_pages_direct_compact()
3433 should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, in should_compact_retry() argument
3444 if (!order) in should_compact_retry()
3455 ret = compaction_zonelist_suitable(ac, order, alloc_flags); in should_compact_retry()
3473 if (order > PAGE_ALLOC_COSTLY_ORDER) in should_compact_retry()
3485 min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ? in should_compact_retry()
3494 trace_compact_retry(order, priority, compact_result, retries, max_retries, ret); in should_compact_retry()
3499 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
3508 should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags, in should_compact_retry() argument
3516 if (!order || order > PAGE_ALLOC_COSTLY_ORDER) in should_compact_retry()
3620 __perform_reclaim(gfp_t gfp_mask, unsigned int order, in __perform_reclaim() argument
3633 progress = try_to_free_pages(ac->zonelist, order, gfp_mask, in __perform_reclaim()
3646 __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_reclaim() argument
3655 *did_some_progress = __perform_reclaim(gfp_mask, order, ac); in __alloc_pages_direct_reclaim()
3660 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_reclaim()
3679 static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask, in wake_all_kswapds() argument
3692 wakeup_kswapd(zone, gfp_mask, order, highest_zoneidx); in wake_all_kswapds()
3699 gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order) in gfp_to_alloc_flags() argument
3728 if (order > 0) in gfp_to_alloc_flags()
3800 should_reclaim_retry(gfp_t gfp_mask, unsigned order, in should_reclaim_retry() argument
3813 if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) in should_reclaim_retry()
3842 wmark = __zone_watermark_ok(zone, order, min_wmark, in should_reclaim_retry()
3844 trace_reclaim_retry_zone(z, order, reclaimable, in should_reclaim_retry()
3905 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, in __alloc_pages_slowpath() argument
3910 const bool costly_order = order > PAGE_ALLOC_COSTLY_ORDER; in __alloc_pages_slowpath()
3934 alloc_flags = gfp_to_alloc_flags(gfp_mask, order); in __alloc_pages_slowpath()
3961 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
3967 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
3982 (order > 0 && ac->migratetype != MIGRATE_MOVABLE)) in __alloc_pages_slowpath()
3984 page = __alloc_pages_direct_compact(gfp_mask, order, in __alloc_pages_slowpath()
4029 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4048 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4061 page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4067 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4084 if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, in __alloc_pages_slowpath()
4095 should_compact_retry(ac, order, alloc_flags, in __alloc_pages_slowpath()
4110 page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); in __alloc_pages_slowpath()
4169 page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_MIN_RESERVE, ac); in __alloc_pages_slowpath()
4178 "page allocation failure: order:%u", order); in __alloc_pages_slowpath()
4183 static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, in prepare_alloc_pages() argument
4207 if (should_fail_alloc_page(gfp_mask, order)) in prepare_alloc_pages()
4398 struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid, in __alloc_pages() argument
4410 if (WARN_ON_ONCE_GFP(order > MAX_ORDER, gfp)) in __alloc_pages()
4423 if (!prepare_alloc_pages(gfp, order, preferred_nid, nodemask, &ac, in __alloc_pages()
4434 page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac); in __alloc_pages()
4447 page = __alloc_pages_slowpath(alloc_gfp, order, &ac); in __alloc_pages()
4451 unlikely(__memcg_kmem_charge_page(page, gfp, order) != 0)) { in __alloc_pages()
4452 __free_pages(page, order); in __alloc_pages()
4456 trace_mm_page_alloc(page, order, alloc_gfp, ac.migratetype); in __alloc_pages()
4457 kmsan_alloc_page(page, order, alloc_gfp); in __alloc_pages()
4463 struct folio *__folio_alloc(gfp_t gfp, unsigned int order, int preferred_nid, in __folio_alloc() argument
4466 struct page *page = __alloc_pages(gfp | __GFP_COMP, order, in __folio_alloc()
4470 if (folio && order > 1) in __folio_alloc()
4481 unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) in __get_free_pages() argument
4485 page = alloc_pages(gfp_mask & ~__GFP_HIGHMEM, order); in __get_free_pages()
4518 void __free_pages(struct page *page, unsigned int order) in __free_pages() argument
4524 free_the_page(page, order); in __free_pages()
4526 while (order-- > 0) in __free_pages()
4527 free_the_page(page + (1 << order), order); in __free_pages()
4531 void free_pages(unsigned long addr, unsigned int order) in free_pages() argument
4535 __free_pages(virt_to_page((void *)addr), order); in free_pages()
4667 static void *make_alloc_exact(unsigned long addr, unsigned int order, in make_alloc_exact() argument
4675 split_page_owner(page, 1 << order); in make_alloc_exact()
4676 split_page_memcg(page, 1 << order); in make_alloc_exact()
4680 last = page + (1UL << order); in make_alloc_exact()
4704 unsigned int order = get_order(size); in alloc_pages_exact() local
4710 addr = __get_free_pages(gfp_mask, order); in alloc_pages_exact()
4711 return make_alloc_exact(addr, order, size); in alloc_pages_exact()
4729 unsigned int order = get_order(size); in alloc_pages_exact_nid() local
4735 p = alloc_pages_node(nid, gfp_mask, order); in alloc_pages_exact_nid()
4738 return make_alloc_exact((unsigned long)page_address(p), order, size); in alloc_pages_exact_nid()
6121 int order; in alloc_contig_range() local
6126 .order = -1, in alloc_contig_range()
6195 order = 0; in alloc_contig_range()
6198 if (++order > MAX_ORDER) { in alloc_contig_range()
6202 outer_start &= ~0UL << order; in alloc_contig_range()
6206 order = buddy_order(pfn_to_page(outer_start)); in alloc_contig_range()
6214 if (outer_start + (1UL << order) <= start) in alloc_contig_range()
6406 unsigned int order; in __offline_isolated_pages() local
6435 order = buddy_order(page); in __offline_isolated_pages()
6436 del_page_from_free_list(page, zone, order); in __offline_isolated_pages()
6437 pfn += (1 << order); in __offline_isolated_pages()
6449 unsigned int order; in is_free_buddy_page() local
6451 for (order = 0; order < NR_PAGE_ORDERS; order++) { in is_free_buddy_page()
6452 struct page *page_head = page - (pfn & ((1 << order) - 1)); in is_free_buddy_page()
6455 buddy_order_unsafe(page_head) >= order) in is_free_buddy_page()
6459 return order <= MAX_ORDER; in is_free_buddy_page()
6506 unsigned int order; in take_page_off_buddy() local
6510 for (order = 0; order < NR_PAGE_ORDERS; order++) { in take_page_off_buddy()
6511 struct page *page_head = page - (pfn & ((1 << order) - 1)); in take_page_off_buddy()
6514 if (PageBuddy(page_head) && page_order >= order) { in take_page_off_buddy()
6596 static bool page_contains_unaccepted(struct page *page, unsigned int order) in page_contains_unaccepted() argument
6599 phys_addr_t end = start + (PAGE_SIZE << order); in page_contains_unaccepted()
6604 static void accept_page(struct page *page, unsigned int order) in accept_page() argument
6608 accept_memory(start, start + (PAGE_SIZE << order)); in accept_page()
6642 static bool cond_accept_memory(struct zone *zone, unsigned int order) in cond_accept_memory() argument
6656 __zone_watermark_unusable_free(zone, order, 0) - in cond_accept_memory()
6698 static bool page_contains_unaccepted(struct page *page, unsigned int order) in page_contains_unaccepted() argument
6703 static void accept_page(struct page *page, unsigned int order) in accept_page() argument
6707 static bool cond_accept_memory(struct zone *zone, unsigned int order) in cond_accept_memory() argument