#author("2025-10-24T12:37:35+09:00","default:guest","guest")

*参照元 [#uc4473c9]
#backlinks

*説明 [#fca910a8]
-パス: [[linux-5.15/mm/page_alloc.c]]

-FIXME: これは何?
--説明


**引数 [#s967a4d9]
-gfp_t gfp_mask
--
--[[linux-5.15/gfp_t]]
-unsigned int order
--
-int preferred_nid
--
-nodemask_t *nodemask
--
--[[linux-5.15/nodemask_t]]
-struct alloc_context *ac
--
--[[linux-5.15/alloc_context]]
-gfp_t *alloc_gfp
--
--[[linux-5.15/gfp_t]]
-unsigned int *alloc_flags
--


**返り値 [#gc24da19]
-bool
--


**参考 [#la9ce997]


*実装 [#h2a0f258]

 static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
 		int preferred_nid, nodemask_t *nodemask,
 		struct alloc_context *ac, gfp_t *alloc_gfp,
 		unsigned int *alloc_flags)
 {
 	ac->highest_zoneidx = gfp_zone(gfp_mask);
 	ac->zonelist = node_zonelist(preferred_nid, gfp_mask);
 	ac->nodemask = nodemask;
 	ac->migratetype = gfp_migratetype(gfp_mask);
 
 	if (cpusets_enabled()) {
 		*alloc_gfp |= __GFP_HARDWALL;
 		/*
 		 * When we are in the interrupt context, it is irrelevant
 		 * to the current task context. It means that any node ok.
 		 */
 		if (in_task() && !ac->nodemask)
 			ac->nodemask = &cpuset_current_mems_allowed;
 		else
 			*alloc_flags |= ALLOC_CPUSET;
 	}
 
-
--[[linux-5.15/gfp_zone()]]
--[[linux-5.15/node_zonelist()]]
--[[linux-5.15/gfp_migratetype()]]
--[[linux-5.15/cpusets_enabled()]]
--[[linux-5.15/in_task()]]

 	fs_reclaim_acquire(gfp_mask);
 	fs_reclaim_release(gfp_mask);
 
 	might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM);
 
 	if (should_fail_alloc_page(gfp_mask, order))
 		return false;
 
 	*alloc_flags = gfp_to_alloc_flags_cma(gfp_mask, *alloc_flags);
 
-
--[[linux-5.15/fs_reclaim_acquire()]]
--[[linux-5.15/fs_reclaim_release()]]
--[[linux-5.15/might_sleep_if()]]
--[[linux-5.15/should_fail_alloc_page()]]
--[[linux-5.15/gfp_to_alloc_flags_cma()]]

 	/* Dirty zone balancing only done in the fast path */
 	ac->spread_dirty_pages = (gfp_mask & __GFP_WRITE);
 
 	/*
 	 * The preferred zone is used for statistics but crucially it is
 	 * also used as the starting point for the zonelist iterator. It
 	 * may get reset for allocations that ignore memory policies.
 	 */
 	ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
 					ac->highest_zoneidx, ac->nodemask);
 
 	return true;
 }

-
--[[linux-5.15/first_zones_zonelist()]]


*コメント [#ief6188b]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS