Lines Matching refs:gfp_mask

3045 static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)  in should_fail_alloc_page()  argument
3049 if (gfp_mask & __GFP_NOFAIL) in should_fail_alloc_page()
3051 if (fail_page_alloc.ignore_gfp_highmem && (gfp_mask & __GFP_HIGHMEM)) in should_fail_alloc_page()
3054 (gfp_mask & __GFP_DIRECT_RECLAIM)) in should_fail_alloc_page()
3095 static inline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) in should_fail_alloc_page() argument
3250 get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, in get_page_from_freelist() argument
3268 !__cpuset_zone_allowed(zone, gfp_mask)) in get_page_from_freelist()
3323 ret = node_reclaim(zone->zone_pgdat, gfp_mask, order); in get_page_from_freelist()
3343 gfp_mask, alloc_flags, ac->migratetype); in get_page_from_freelist()
3345 prep_new_page(page, order, gfp_mask, alloc_flags); in get_page_from_freelist()
3383 static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask) in warn_alloc_show_mem() argument
3396 if (!(gfp_mask & __GFP_NOMEMALLOC)) in warn_alloc_show_mem()
3400 if (in_interrupt() || !(gfp_mask & __GFP_DIRECT_RECLAIM)) in warn_alloc_show_mem()
3406 void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...) in warn_alloc() argument
3413 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) in warn_alloc()
3420 current->comm, &vaf, gfp_mask, &gfp_mask, in warn_alloc()
3427 warn_alloc_show_mem(gfp_mask, nodemask); in warn_alloc()
3431 __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order, in __alloc_pages_cpuset_fallback() argument
3437 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
3444 page = get_page_from_freelist(gfp_mask, order, in __alloc_pages_cpuset_fallback()
3451 __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, in __alloc_pages_may_oom() argument
3458 .gfp_mask = gfp_mask, in __alloc_pages_may_oom()
3482 page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) & in __alloc_pages_may_oom()
3500 if (gfp_mask & __GFP_RETRY_MAYFAIL) in __alloc_pages_may_oom()
3518 if (gfp_mask & __GFP_THISNODE) in __alloc_pages_may_oom()
3522 if (out_of_memory(&oc) || WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL)) { in __alloc_pages_may_oom()
3529 if (gfp_mask & __GFP_NOFAIL) in __alloc_pages_may_oom()
3530 page = __alloc_pages_cpuset_fallback(gfp_mask, order, in __alloc_pages_may_oom()
3547 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
3558 *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac, in __alloc_pages_direct_compact()
3571 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_compact()
3664 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_compact() argument
3704 static bool __need_fs_reclaim(gfp_t gfp_mask) in __need_fs_reclaim() argument
3706 gfp_mask = current_gfp_context(gfp_mask); in __need_fs_reclaim()
3709 if (!(gfp_mask & __GFP_DIRECT_RECLAIM)) in __need_fs_reclaim()
3717 if (!(gfp_mask & __GFP_FS)) in __need_fs_reclaim()
3720 if (gfp_mask & __GFP_NOLOCKDEP) in __need_fs_reclaim()
3736 void fs_reclaim_acquire(gfp_t gfp_mask) in fs_reclaim_acquire() argument
3738 if (__need_fs_reclaim(gfp_mask)) in fs_reclaim_acquire()
3743 void fs_reclaim_release(gfp_t gfp_mask) in fs_reclaim_release() argument
3745 if (__need_fs_reclaim(gfp_mask)) in fs_reclaim_release()
3753 __perform_reclaim(gfp_t gfp_mask, unsigned int order, in __perform_reclaim() argument
3764 fs_reclaim_acquire(gfp_mask); in __perform_reclaim()
3769 progress = try_to_free_pages(ac->zonelist, order, gfp_mask, in __perform_reclaim()
3774 fs_reclaim_release(gfp_mask); in __perform_reclaim()
3783 __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, in __alloc_pages_direct_reclaim() argument
3790 *did_some_progress = __perform_reclaim(gfp_mask, order, ac); in __alloc_pages_direct_reclaim()
3795 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_direct_reclaim()
3812 static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask, in wake_all_kswapds() argument
3823 wakeup_kswapd(zone, gfp_mask, order, high_zoneidx); in wake_all_kswapds()
3829 gfp_to_alloc_flags(gfp_t gfp_mask) in gfp_to_alloc_flags() argument
3842 alloc_flags |= (__force int) (gfp_mask & __GFP_HIGH); in gfp_to_alloc_flags()
3844 if (gfp_mask & __GFP_ATOMIC) { in gfp_to_alloc_flags()
3849 if (!(gfp_mask & __GFP_NOMEMALLOC)) in gfp_to_alloc_flags()
3860 if (gfpflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE) in gfp_to_alloc_flags()
3885 static inline int __gfp_pfmemalloc_flags(gfp_t gfp_mask) in __gfp_pfmemalloc_flags() argument
3887 if (unlikely(gfp_mask & __GFP_NOMEMALLOC)) in __gfp_pfmemalloc_flags()
3889 if (gfp_mask & __GFP_MEMALLOC) in __gfp_pfmemalloc_flags()
3903 bool gfp_pfmemalloc_allowed(gfp_t gfp_mask) in gfp_pfmemalloc_allowed() argument
3905 return !!__gfp_pfmemalloc_flags(gfp_mask); in gfp_pfmemalloc_allowed()
3919 should_reclaim_retry(gfp_t gfp_mask, unsigned order, in should_reclaim_retry() argument
4043 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, in __alloc_pages_slowpath() argument
4046 bool can_direct_reclaim = gfp_mask & __GFP_DIRECT_RECLAIM; in __alloc_pages_slowpath()
4065 WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)); in __alloc_pages_slowpath()
4073 if (WARN_ON_ONCE((gfp_mask & (__GFP_ATOMIC|__GFP_DIRECT_RECLAIM)) == in __alloc_pages_slowpath()
4075 gfp_mask &= ~__GFP_ATOMIC; in __alloc_pages_slowpath()
4088 alloc_flags = gfp_to_alloc_flags(gfp_mask); in __alloc_pages_slowpath()
4101 if (gfp_mask & __GFP_KSWAPD_RECLAIM) in __alloc_pages_slowpath()
4102 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4108 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4124 && !gfp_pfmemalloc_allowed(gfp_mask)) { in __alloc_pages_slowpath()
4125 page = __alloc_pages_direct_compact(gfp_mask, order, in __alloc_pages_slowpath()
4136 if (costly_order && (gfp_mask & __GFP_NORETRY)) { in __alloc_pages_slowpath()
4159 if (gfp_mask & __GFP_KSWAPD_RECLAIM) in __alloc_pages_slowpath()
4160 wake_all_kswapds(order, gfp_mask, ac); in __alloc_pages_slowpath()
4162 reserve_flags = __gfp_pfmemalloc_flags(gfp_mask); in __alloc_pages_slowpath()
4178 page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); in __alloc_pages_slowpath()
4191 page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4197 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, in __alloc_pages_slowpath()
4203 if (gfp_mask & __GFP_NORETRY) in __alloc_pages_slowpath()
4210 if (costly_order && !(gfp_mask & __GFP_RETRY_MAYFAIL)) in __alloc_pages_slowpath()
4213 if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, in __alloc_pages_slowpath()
4235 page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); in __alloc_pages_slowpath()
4242 (gfp_mask & __GFP_NOMEMALLOC))) in __alloc_pages_slowpath()
4260 if (gfp_mask & __GFP_NOFAIL) { in __alloc_pages_slowpath()
4289 page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_HARDER, ac); in __alloc_pages_slowpath()
4297 warn_alloc(gfp_mask, ac->nodemask, in __alloc_pages_slowpath()
4303 static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, in prepare_alloc_pages() argument
4308 ac->high_zoneidx = gfp_zone(gfp_mask); in prepare_alloc_pages()
4309 ac->zonelist = node_zonelist(preferred_nid, gfp_mask); in prepare_alloc_pages()
4311 ac->migratetype = gfpflags_to_migratetype(gfp_mask); in prepare_alloc_pages()
4321 fs_reclaim_acquire(gfp_mask); in prepare_alloc_pages()
4322 fs_reclaim_release(gfp_mask); in prepare_alloc_pages()
4324 might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); in prepare_alloc_pages()
4326 if (should_fail_alloc_page(gfp_mask, order)) in prepare_alloc_pages()
4336 static inline void finalise_ac(gfp_t gfp_mask, struct alloc_context *ac) in finalise_ac() argument
4339 ac->spread_dirty_pages = (gfp_mask & __GFP_WRITE); in finalise_ac()
4354 __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, in __alloc_pages_nodemask() argument
4362 gfp_mask &= gfp_allowed_mask; in __alloc_pages_nodemask()
4363 alloc_mask = gfp_mask; in __alloc_pages_nodemask()
4364 if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) in __alloc_pages_nodemask()
4367 finalise_ac(gfp_mask, &ac); in __alloc_pages_nodemask()
4380 alloc_mask = current_gfp_context(gfp_mask); in __alloc_pages_nodemask()
4393 if (memcg_kmem_enabled() && (gfp_mask & __GFP_ACCOUNT) && page && in __alloc_pages_nodemask()
4394 unlikely(memcg_kmem_charge(page, gfp_mask, order) != 0)) { in __alloc_pages_nodemask()
4410 unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) in __get_free_pages() argument
4414 page = alloc_pages(gfp_mask & ~__GFP_HIGHMEM, order); in __get_free_pages()
4421 unsigned long get_zeroed_page(gfp_t gfp_mask) in get_zeroed_page() argument
4423 return __get_free_pages(gfp_mask | __GFP_ZERO, 0); in get_zeroed_page()
4461 gfp_t gfp_mask) in __page_frag_cache_refill() argument
4464 gfp_t gfp = gfp_mask; in __page_frag_cache_refill()
4467 gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY | in __page_frag_cache_refill()
4469 page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, in __page_frag_cache_refill()
4497 unsigned int fragsz, gfp_t gfp_mask) in page_frag_alloc() argument
4505 page = __page_frag_cache_refill(nc, gfp_mask); in page_frag_alloc()
4591 void *alloc_pages_exact(size_t size, gfp_t gfp_mask) in alloc_pages_exact() argument
4596 addr = __get_free_pages(gfp_mask, order); in alloc_pages_exact()
4611 void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask) in alloc_pages_exact_nid() argument
4614 struct page *p = alloc_pages_node(nid, gfp_mask, order); in alloc_pages_exact_nid()
7834 unsigned migratetype, gfp_t gfp_mask) in alloc_contig_range() argument
7847 .gfp_mask = current_gfp_context(gfp_mask), in alloc_contig_range()