linux-4.4.1/get_page_from_freelist()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#y828066b]
#backlinks
*説明 [#if59a339]
-パス: [[linux-4.4.1/mm/page_alloc.c]]
-FIXME: これは何?
--説明
**引数 [#e4dc89bd]
-gfp_t gfp_mask
--
--[[linux-4.4.1/gfp_t]]
-unsigned int order
--
-int alloc_flags
--
-const struct alloc_context *ac
--
--[[linux-4.4.1/alloc_context]]
**返り値 [#za072cae]
-struct page *
--
--[[linux-4.4.1/page]]
**参考 [#db247b38]
*実装 [#ld7c75b4]
/*
* get_page_from_freelist goes through the zonelist tryi...
* a page.
*/
static struct page *
get_page_from_freelist(gfp_t gfp_mask, unsigned int orde...
const st...
{
struct zonelist *zonelist = ac->zonelist;
struct zoneref *z;
struct page *page = NULL;
struct zone *zone;
int nr_fair_skipped = 0;
bool zonelist_rescan;
-
--[[linux-4.4.1/zonelist]]
--[[linux-4.4.1/zoneref]]
--[[linux-4.4.1/zone]]
zonelist_scan:
zonelist_rescan = false;
/*
* Scan zonelist, looking for a zone with enough...
* See also __cpuset_node_allowed() comment in k...
*/
for_each_zone_zonelist_nodemask(zone, z, zonelis...
...
unsigned long mark;
-
--[[linux-4.4.1/for_each_zone_zonelist_nodemask()]]
if (cpusets_enabled() &&
(alloc_flags & ALLOC_CPUSET) &&
!cpuset_zone_allowed(zone, gfp_m...
continue;
-
--[[linux-4.4.1/cpusets_enabled()]]
--[[linux-4.4.1/ALLOC_CPUSET]]
--[[linux-4.4.1/cpuset_zone_allowed()]]
/*
* Distribute pages in proportion to the...
* zone size to ensure fair page aging. ...
* page was allocated in should have no ...
* time the page has in memory before be...
*/
if (alloc_flags & ALLOC_FAIR) {
if (!zone_local(ac->preferred_zo...
break;
if (test_bit(ZONE_FAIR_DEPLETED,...
nr_fair_skipped++;
continue;
}
}
-
--[[linux-4.4.1/ALLOC_FAIR]]
--[[linux-4.4.1/zone_local()]]
--[[linux-4.4.1/test_bit()]]
--[[linux-4.4.1/ZONE_FAIR_DEPELETED]]
/*
* When allocating a page cache page for...
* want to get it from a zone that is wi...
* limit, such that no single zone holds...
* proportional share of globally allowe...
* The dirty limits take into account th...
* lowmem reserves and high watermark so...
* should be able to balance it without ...
* write pages from its LRU list.
*
* This may look like it could increase ...
* lower zones by failing allocations in...
* before they are full. But the pages ...
* over are limited as the lower zones a...
* by this very same mechanism. It shou...
* a practical burden to them.
*
* XXX: For now, allow allocations to po...
* exceed the per-zone dirty limit in th...
* (spread_dirty_pages unset) before goi...
* which is important when on a NUMA set...
* zones are together not big enough to ...
* global limit. The proper fix for the...
* will require awareness of zones in the
* dirty-throttling and the flusher thre...
*/
if (ac->spread_dirty_pages && !zone_dirt...
continue;
-
--[[linux-4.4.1/zone_dirty_ok()]]
mark = zone->watermark[alloc_flags & ALL...
if (!zone_watermark_ok(zone, order, mark,
ac->classzone_idx...
int ret;
-
--[[linux-4.4.1/ALLOC_WMARK_MASK]]
--[[linux-4.4.1/zone_watermark_ok()]]
/* Checked here to keep the fast...
BUILD_BUG_ON(ALLOC_NO_WATERMARKS...
if (alloc_flags & ALLOC_NO_WATER...
goto try_this_zone;
-
--[[linux-4.4.1/BUILD_BUG_ON()]]
--[[linux-4.4.1/ALLOC_NO_WATERMARKS]]
--[[linux-4.4.1/NR_WMARK]]
if (zone_reclaim_mode == 0 ||
!zone_allows_reclaim(ac->pre...
continue;
-
--[[linux-4.4.1/zone_allows_reclaim()]]
ret = zone_reclaim(zone, gfp_mas...
switch (ret) {
case ZONE_RECLAIM_NOSCAN:
/* did not scan */
continue;
case ZONE_RECLAIM_FULL:
/* scanned but unreclaim...
continue;
default:
/* did we reclaim enough...
if (zone_watermark_ok(zo...
ac->clas...
goto try_this_zo...
continue;
}
-
--[[linux-4.4.1/zone_reclaim()]]
--[[linux-4.4.1/ZONE_RECLAIM_NOSCAN]]
--[[linux-4.4.1/ZONE_RECLAIM_FULL]]
--[[linux-4.4.1/zone_watermark_ok()]]
}
try_this_zone:
page = buffered_rmqueue(ac->preferred_zo...
gfp_mask, alloc_flags, a...
if (page) {
if (prep_new_page(page, order, g...
goto try_this_zone;
/*
* If this is a high-order atomi...
* if the pageblock should be re...
*/
if (unlikely(order && (alloc_fla...
reserve_highatomic_pageb...
return page;
}
-
--[[linux-4.4.1/buffered_rmqueue()]]
--[[linux-4.4.1/prep_new_page()]]
--[[linux-4.4.1/unlikely()]]
--[[linux-4.4.1/ALLOC_HARDER]]
--[[linux-4.4.1/reserve_highatomic_pageblock()]]
}
/*
* The first pass makes sure allocations are spr...
* local node. However, the local node might ha...
* after the fairness batches are exhausted, and...
* even been considered yet. Try once more with...
* include remote zones now, before entering the...
* kswapd: prefer spilling to a remote zone over...
*/
if (alloc_flags & ALLOC_FAIR) {
alloc_flags &= ~ALLOC_FAIR;
if (nr_fair_skipped) {
zonelist_rescan = true;
reset_alloc_batches(ac->preferre...
}
if (nr_online_nodes > 1)
zonelist_rescan = true;
}
-
--[[linux-4.4.1/reset_alloc_batches()]]
if (zonelist_rescan)
goto zonelist_scan;
return NULL;
}
*コメント [#b01ed5dd]
終了行:
*参照元 [#y828066b]
#backlinks
*説明 [#if59a339]
-パス: [[linux-4.4.1/mm/page_alloc.c]]
-FIXME: これは何?
--説明
**引数 [#e4dc89bd]
-gfp_t gfp_mask
--
--[[linux-4.4.1/gfp_t]]
-unsigned int order
--
-int alloc_flags
--
-const struct alloc_context *ac
--
--[[linux-4.4.1/alloc_context]]
**返り値 [#za072cae]
-struct page *
--
--[[linux-4.4.1/page]]
**参考 [#db247b38]
*実装 [#ld7c75b4]
/*
* get_page_from_freelist goes through the zonelist tryi...
* a page.
*/
static struct page *
get_page_from_freelist(gfp_t gfp_mask, unsigned int orde...
const st...
{
struct zonelist *zonelist = ac->zonelist;
struct zoneref *z;
struct page *page = NULL;
struct zone *zone;
int nr_fair_skipped = 0;
bool zonelist_rescan;
-
--[[linux-4.4.1/zonelist]]
--[[linux-4.4.1/zoneref]]
--[[linux-4.4.1/zone]]
zonelist_scan:
zonelist_rescan = false;
/*
* Scan zonelist, looking for a zone with enough...
* See also __cpuset_node_allowed() comment in k...
*/
for_each_zone_zonelist_nodemask(zone, z, zonelis...
...
unsigned long mark;
-
--[[linux-4.4.1/for_each_zone_zonelist_nodemask()]]
if (cpusets_enabled() &&
(alloc_flags & ALLOC_CPUSET) &&
!cpuset_zone_allowed(zone, gfp_m...
continue;
-
--[[linux-4.4.1/cpusets_enabled()]]
--[[linux-4.4.1/ALLOC_CPUSET]]
--[[linux-4.4.1/cpuset_zone_allowed()]]
/*
* Distribute pages in proportion to the...
* zone size to ensure fair page aging. ...
* page was allocated in should have no ...
* time the page has in memory before be...
*/
if (alloc_flags & ALLOC_FAIR) {
if (!zone_local(ac->preferred_zo...
break;
if (test_bit(ZONE_FAIR_DEPLETED,...
nr_fair_skipped++;
continue;
}
}
-
--[[linux-4.4.1/ALLOC_FAIR]]
--[[linux-4.4.1/zone_local()]]
--[[linux-4.4.1/test_bit()]]
--[[linux-4.4.1/ZONE_FAIR_DEPELETED]]
/*
* When allocating a page cache page for...
* want to get it from a zone that is wi...
* limit, such that no single zone holds...
* proportional share of globally allowe...
* The dirty limits take into account th...
* lowmem reserves and high watermark so...
* should be able to balance it without ...
* write pages from its LRU list.
*
* This may look like it could increase ...
* lower zones by failing allocations in...
* before they are full. But the pages ...
* over are limited as the lower zones a...
* by this very same mechanism. It shou...
* a practical burden to them.
*
* XXX: For now, allow allocations to po...
* exceed the per-zone dirty limit in th...
* (spread_dirty_pages unset) before goi...
* which is important when on a NUMA set...
* zones are together not big enough to ...
* global limit. The proper fix for the...
* will require awareness of zones in the
* dirty-throttling and the flusher thre...
*/
if (ac->spread_dirty_pages && !zone_dirt...
continue;
-
--[[linux-4.4.1/zone_dirty_ok()]]
mark = zone->watermark[alloc_flags & ALL...
if (!zone_watermark_ok(zone, order, mark,
ac->classzone_idx...
int ret;
-
--[[linux-4.4.1/ALLOC_WMARK_MASK]]
--[[linux-4.4.1/zone_watermark_ok()]]
/* Checked here to keep the fast...
BUILD_BUG_ON(ALLOC_NO_WATERMARKS...
if (alloc_flags & ALLOC_NO_WATER...
goto try_this_zone;
-
--[[linux-4.4.1/BUILD_BUG_ON()]]
--[[linux-4.4.1/ALLOC_NO_WATERMARKS]]
--[[linux-4.4.1/NR_WMARK]]
if (zone_reclaim_mode == 0 ||
!zone_allows_reclaim(ac->pre...
continue;
-
--[[linux-4.4.1/zone_allows_reclaim()]]
ret = zone_reclaim(zone, gfp_mas...
switch (ret) {
case ZONE_RECLAIM_NOSCAN:
/* did not scan */
continue;
case ZONE_RECLAIM_FULL:
/* scanned but unreclaim...
continue;
default:
/* did we reclaim enough...
if (zone_watermark_ok(zo...
ac->clas...
goto try_this_zo...
continue;
}
-
--[[linux-4.4.1/zone_reclaim()]]
--[[linux-4.4.1/ZONE_RECLAIM_NOSCAN]]
--[[linux-4.4.1/ZONE_RECLAIM_FULL]]
--[[linux-4.4.1/zone_watermark_ok()]]
}
try_this_zone:
page = buffered_rmqueue(ac->preferred_zo...
gfp_mask, alloc_flags, a...
if (page) {
if (prep_new_page(page, order, g...
goto try_this_zone;
/*
* If this is a high-order atomi...
* if the pageblock should be re...
*/
if (unlikely(order && (alloc_fla...
reserve_highatomic_pageb...
return page;
}
-
--[[linux-4.4.1/buffered_rmqueue()]]
--[[linux-4.4.1/prep_new_page()]]
--[[linux-4.4.1/unlikely()]]
--[[linux-4.4.1/ALLOC_HARDER]]
--[[linux-4.4.1/reserve_highatomic_pageblock()]]
}
/*
* The first pass makes sure allocations are spr...
* local node. However, the local node might ha...
* after the fairness batches are exhausted, and...
* even been considered yet. Try once more with...
* include remote zones now, before entering the...
* kswapd: prefer spilling to a remote zone over...
*/
if (alloc_flags & ALLOC_FAIR) {
alloc_flags &= ~ALLOC_FAIR;
if (nr_fair_skipped) {
zonelist_rescan = true;
reset_alloc_batches(ac->preferre...
}
if (nr_online_nodes > 1)
zonelist_rescan = true;
}
-
--[[linux-4.4.1/reset_alloc_batches()]]
if (zonelist_rescan)
goto zonelist_scan;
return NULL;
}
*コメント [#b01ed5dd]
ページ名: