@@ -7478,23 +7478,7 @@ static bool __free_unaccepted(struct page *page)
74787478
74797479#endif /* CONFIG_UNACCEPTED_MEMORY */
74807480
7481- /**
7482- * alloc_pages_nolock - opportunistic reentrant allocation from any context
7483- * @gfp_flags: GFP flags. Only __GFP_ACCOUNT allowed.
7484- * @nid: node to allocate from
7485- * @order: allocation order size
7486- *
7487- * Allocates pages of a given order from the given node. This is safe to
7488- * call from any context (from atomic, NMI, and also reentrant
7489- * allocator -> tracepoint -> alloc_pages_nolock_noprof).
7490- * Allocation is best effort and to be expected to fail easily so nobody should
7491- * rely on the success. Failures are not reported via warn_alloc().
7492- * See always fail conditions below.
7493- *
7494- * Return: allocated page or NULL on failure. NULL does not mean EBUSY or EAGAIN.
7495- * It means ENOMEM. There is no reason to call it again and expect !NULL.
7496- */
7497- struct page * alloc_pages_nolock_noprof (gfp_t gfp_flags , int nid , unsigned int order )
7481+ struct page * alloc_frozen_pages_nolock_noprof (gfp_t gfp_flags , int nid , unsigned int order )
74987482{
74997483 /*
75007484 * Do not specify __GFP_DIRECT_RECLAIM, since direct claim is not allowed.
@@ -7557,15 +7541,38 @@ struct page *alloc_pages_nolock_noprof(gfp_t gfp_flags, int nid, unsigned int or
75577541
75587542 /* Unlike regular alloc_pages() there is no __alloc_pages_slowpath(). */
75597543
7560- if (page )
7561- set_page_refcounted (page );
7562-
75637544 if (memcg_kmem_online () && page && (gfp_flags & __GFP_ACCOUNT ) &&
75647545 unlikely (__memcg_kmem_charge_page (page , alloc_gfp , order ) != 0 )) {
7565- free_pages_nolock (page , order );
7546+ __free_frozen_pages (page , order , FPI_TRYLOCK );
75667547 page = NULL ;
75677548 }
75687549 trace_mm_page_alloc (page , order , alloc_gfp , ac .migratetype );
75697550 kmsan_alloc_page (page , order , alloc_gfp );
75707551 return page ;
75717552}
7553+ /**
7554+ * alloc_pages_nolock - opportunistic reentrant allocation from any context
7555+ * @gfp_flags: GFP flags. Only __GFP_ACCOUNT allowed.
7556+ * @nid: node to allocate from
7557+ * @order: allocation order size
7558+ *
7559+ * Allocates pages of a given order from the given node. This is safe to
7560+ * call from any context (from atomic, NMI, and also reentrant
7561+ * allocator -> tracepoint -> alloc_pages_nolock_noprof).
7562+ * Allocation is best effort and to be expected to fail easily so nobody should
7563+ * rely on the success. Failures are not reported via warn_alloc().
7564+ * See always fail conditions below.
7565+ *
7566+ * Return: allocated page or NULL on failure. NULL does not mean EBUSY or EAGAIN.
7567+ * It means ENOMEM. There is no reason to call it again and expect !NULL.
7568+ */
7569+ struct page * alloc_pages_nolock_noprof (gfp_t gfp_flags , int nid , unsigned int order )
7570+ {
7571+ struct page * page ;
7572+
7573+ page = alloc_frozen_pages_nolock_noprof (gfp_flags , nid , order );
7574+ if (page )
7575+ set_page_refcounted (page );
7576+ return page ;
7577+ }
7578+ EXPORT_SYMBOL_GPL (alloc_pages_nolock_noprof );
0 commit comments