linux-5.15/__alloc_pages()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#s763da5f]
#backlinks
*説明 [#m9bed659]
-パス: [[linux-5.15/mm/page_alloc.c]]
-FIXME: これは何?
--説明
**引数 [#j02f0876]
-gfp_t gfp
--
-unsigned int order
--
-int preferred_nid
--
-nodemask_t *nodemask
--
--[[linux-5.15/nodemask_t]]
**返り値 [#yc175a6b]
-struct page *
--
--[[linux-5.15/page]]
**参考 [#rbe7a4c6]
*実装 [#t5db9103]
/*
* This is the 'heart' of the zoned buddy allocator.
*/
struct page *__alloc_pages(gfp_t gfp, unsigned int order...
nodemask_t *nodemask)
{
struct page *page;
unsigned int alloc_flags = ALLOC_WMARK_LOW;
gfp_t alloc_gfp; /* The gfp_t that was actually used fo...
struct alloc_context ac = { };
/*
* There are several places where we assume that the or...
* so bail out early if the request is out of bound.
*/
if (unlikely(order >= MAX_ORDER)) {
WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
return NULL;
}
-
--[[linux-5.15/page]]
--[[linux-5.15/gfp_t]]
--[[linux-5.15/alloc_context]]
--[[linux-5.15/unlikely()]]
--[[linux-5.15/WARN_ON_ONCE()]]
gfp &= gfp_allowed_mask;
/*
* Apply scoped allocation constraints. This is mainly ...
* resp. GFP_NOIO which has to be inherited for all all...
* from a particular context which has been marked by
* memalloc_no{fs,io}_{save,restore}. And PF_MEMALLOC_P...
* movable zones are not used during allocation.
*/
gfp = current_gfp_context(gfp);
alloc_gfp = gfp;
if (!prepare_alloc_pages(gfp, order, preferred_nid, nod...
&alloc_gfp, &alloc_flags))
return NULL;
-
--[[linux-5.15/current_gfp_context()]]
--[[linux-5.15/prepare_alloc_pages()]]
/*
* Forbid the first pass from falling back to types tha...
* memory until all local zones are considered.
*/
alloc_flags |= alloc_flags_nofragment(ac.preferred_zone...
/* First allocation attempt */
page = get_page_from_freelist(alloc_gfp, order, alloc_f...
if (likely(page))
goto out;
alloc_gfp = gfp;
ac.spread_dirty_pages = false;
-
--[[linux-5.15/alloc_flags_nofragment()]]
--[[linux-5.15/get_page_from_freelist()]]
--[[linux-5.15/likely()]]
/*
* Restore the original nodemask if it was potentially ...
* &cpuset_current_mems_allowed to optimize the fast-pa...
*/
ac.nodemask = nodemask;
page = __alloc_pages_slowpath(alloc_gfp, order, &ac);
out:
if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT) && pa...
unlikely(__memcg_kmem_charge_page(page, gfp, order)...
__free_pages(page, order);
page = NULL;
}
-
--[[linux-5.15/__alloc_pages_slowpath()]]
--[[linux-5.15/memcg_kmem_enabled()]]
--[[linux-5.15/unlikely()]]
--[[linux-5.15/__memcg_kmem_charge_page()]]
--[[linux-5.15/__free_pages()]]
trace_mm_page_alloc(page, order, alloc_gfp, ac.migratet...
return page;
}
EXPORT_SYMBOL(__alloc_pages);
-
--[[linux-5.15/trace_mm_page_alloc()]]
--[[linux-5.15/EXPORT_SYMBOL()]]
*コメント [#g1472970]
終了行:
*参照元 [#s763da5f]
#backlinks
*説明 [#m9bed659]
-パス: [[linux-5.15/mm/page_alloc.c]]
-FIXME: これは何?
--説明
**引数 [#j02f0876]
-gfp_t gfp
--
-unsigned int order
--
-int preferred_nid
--
-nodemask_t *nodemask
--
--[[linux-5.15/nodemask_t]]
**返り値 [#yc175a6b]
-struct page *
--
--[[linux-5.15/page]]
**参考 [#rbe7a4c6]
*実装 [#t5db9103]
/*
* This is the 'heart' of the zoned buddy allocator.
*/
struct page *__alloc_pages(gfp_t gfp, unsigned int order...
nodemask_t *nodemask)
{
struct page *page;
unsigned int alloc_flags = ALLOC_WMARK_LOW;
gfp_t alloc_gfp; /* The gfp_t that was actually used fo...
struct alloc_context ac = { };
/*
* There are several places where we assume that the or...
* so bail out early if the request is out of bound.
*/
if (unlikely(order >= MAX_ORDER)) {
WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
return NULL;
}
-
--[[linux-5.15/page]]
--[[linux-5.15/gfp_t]]
--[[linux-5.15/alloc_context]]
--[[linux-5.15/unlikely()]]
--[[linux-5.15/WARN_ON_ONCE()]]
gfp &= gfp_allowed_mask;
/*
* Apply scoped allocation constraints. This is mainly ...
* resp. GFP_NOIO which has to be inherited for all all...
* from a particular context which has been marked by
* memalloc_no{fs,io}_{save,restore}. And PF_MEMALLOC_P...
* movable zones are not used during allocation.
*/
gfp = current_gfp_context(gfp);
alloc_gfp = gfp;
if (!prepare_alloc_pages(gfp, order, preferred_nid, nod...
&alloc_gfp, &alloc_flags))
return NULL;
-
--[[linux-5.15/current_gfp_context()]]
--[[linux-5.15/prepare_alloc_pages()]]
/*
* Forbid the first pass from falling back to types tha...
* memory until all local zones are considered.
*/
alloc_flags |= alloc_flags_nofragment(ac.preferred_zone...
/* First allocation attempt */
page = get_page_from_freelist(alloc_gfp, order, alloc_f...
if (likely(page))
goto out;
alloc_gfp = gfp;
ac.spread_dirty_pages = false;
-
--[[linux-5.15/alloc_flags_nofragment()]]
--[[linux-5.15/get_page_from_freelist()]]
--[[linux-5.15/likely()]]
/*
* Restore the original nodemask if it was potentially ...
* &cpuset_current_mems_allowed to optimize the fast-pa...
*/
ac.nodemask = nodemask;
page = __alloc_pages_slowpath(alloc_gfp, order, &ac);
out:
if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT) && pa...
unlikely(__memcg_kmem_charge_page(page, gfp, order)...
__free_pages(page, order);
page = NULL;
}
-
--[[linux-5.15/__alloc_pages_slowpath()]]
--[[linux-5.15/memcg_kmem_enabled()]]
--[[linux-5.15/unlikely()]]
--[[linux-5.15/__memcg_kmem_charge_page()]]
--[[linux-5.15/__free_pages()]]
trace_mm_page_alloc(page, order, alloc_gfp, ac.migratet...
return page;
}
EXPORT_SYMBOL(__alloc_pages);
-
--[[linux-5.15/trace_mm_page_alloc()]]
--[[linux-5.15/EXPORT_SYMBOL()]]
*コメント [#g1472970]
ページ名: