linux-5.15/steal_suitable_fallback()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#qea971d4]
#backlinks
*説明 [#ea83ae9b]
-パス: [[linux-5.15/mm/page_alloc.c]]
-FIXME: これは何?
--説明
**引数 [#jdb7bf89]
-struct zone *zone
--
--[[linux-5.15/zone]]
-struct page *page
--
--[[linux-5.15/page]]
-unsigned int alloc_flags
--
-int start_type
--
-bool whole_block
--
**返り値 [#sd84f815]
-なし
**参考 [#t6284162]
*実装 [#g72c5483]
/*
* This function implements actual steal behaviour. If o...
* we can steal whole pageblock. If not, we first move f...
* pageblock to our migratetype and determine how many a...
* are there in the pageblock with a compatible migratet...
* of pages are free or compatible, we can change migrat...
* itself, so pages freed in the future will be put on t...
*/
static void steal_suitable_fallback(struct zone *zone, s...
unsigned int alloc_flags, int start_type, bool whole_b...
{
unsigned int current_order = buddy_order(page);
int free_pages, movable_pages, alike_pages;
int old_block_type;
old_block_type = get_pageblock_migratetype(page);
-
--[[linux-5.15/buddy_order()]]
--[[linux-5.15/get_pageblock_migratetype()]]
/*
* This can happen due to races and we want to prevent ...
* highatomic accounting.
*/
if (is_migrate_highatomic(old_block_type))
goto single_page;
-
--[[linux-5.15/is_migrate_highatomic()]]
/* Take ownership for orders >= pageblock_order */
if (current_order >= pageblock_order) {
change_pageblock_range(page, current_order, start_type);
goto single_page;
}
-
--[[linux-5.15/change_pageblock_range()]]
/*
* Boost watermarks to increase reclaim pressure to red...
* likelihood of future fallbacks. Wake kswapd now as t...
* may be balanced overall and kswapd will not wake nat...
*/
if (boost_watermark(zone) && (alloc_flags & ALLOC_KSWAP...
set_bit(ZONE_BOOSTED_WATERMARK, &zone->flags);
-
--[[linux-5.15/boost_watermark()]]
--[[linux-5.15/set_bit()]]
/* We are not allowed to try stealing from the whole bl...
if (!whole_block)
goto single_page;
free_pages = move_freepages_block(zone, page, start_type,
&movable_pages);
-
--[[linux-5.15/move_freepages_block()]]
/*
* Determine how many pages are compatible with our all...
* For movable allocation, it's the number of movable p...
* we just obtained. For other types it's a bit more tr...
*/
if (start_type == MIGRATE_MOVABLE) {
alike_pages = movable_pages;
} else {
/*
* If we are falling back a RECLAIMABLE or UNMOVABLE a...
* to MOVABLE pageblock, consider all non-movable page...
* compatible. If it's UNMOVABLE falling back to RECLA...
* vice versa, be conservative since we can't distingu...
* exact migratetype of non-movable pages.
*/
if (old_block_type == MIGRATE_MOVABLE)
alike_pages = pageblock_nr_pages
- (free_pages + movable_pages);
else
alike_pages = 0;
}
/* moving whole block can fail due to zone boundary con...
if (!free_pages)
goto single_page;
/*
* If a sufficient number of pages in the block are eit...
* comparable migratability as our allocation, claim th...
*/
if (free_pages + alike_pages >= (1 << (pageblock_order-...
page_group_by_mobility_disabled)
set_pageblock_migratetype(page, start_type);
return;
-
--[[linux-5.15/set_pageblock_migratetype()]]
single_page:
move_to_free_list(page, zone, current_order, start_type);
}
-
--[[linux-5.15/move_to_free_list()]]
*コメント [#o725d1ab]
終了行:
*参照元 [#qea971d4]
#backlinks
*説明 [#ea83ae9b]
-パス: [[linux-5.15/mm/page_alloc.c]]
-FIXME: これは何?
--説明
**引数 [#jdb7bf89]
-struct zone *zone
--
--[[linux-5.15/zone]]
-struct page *page
--
--[[linux-5.15/page]]
-unsigned int alloc_flags
--
-int start_type
--
-bool whole_block
--
**返り値 [#sd84f815]
-なし
**参考 [#t6284162]
*実装 [#g72c5483]
/*
* This function implements actual steal behaviour. If o...
* we can steal whole pageblock. If not, we first move f...
* pageblock to our migratetype and determine how many a...
* are there in the pageblock with a compatible migratet...
* of pages are free or compatible, we can change migrat...
* itself, so pages freed in the future will be put on t...
*/
static void steal_suitable_fallback(struct zone *zone, s...
unsigned int alloc_flags, int start_type, bool whole_b...
{
unsigned int current_order = buddy_order(page);
int free_pages, movable_pages, alike_pages;
int old_block_type;
old_block_type = get_pageblock_migratetype(page);
-
--[[linux-5.15/buddy_order()]]
--[[linux-5.15/get_pageblock_migratetype()]]
/*
* This can happen due to races and we want to prevent ...
* highatomic accounting.
*/
if (is_migrate_highatomic(old_block_type))
goto single_page;
-
--[[linux-5.15/is_migrate_highatomic()]]
/* Take ownership for orders >= pageblock_order */
if (current_order >= pageblock_order) {
change_pageblock_range(page, current_order, start_type);
goto single_page;
}
-
--[[linux-5.15/change_pageblock_range()]]
/*
* Boost watermarks to increase reclaim pressure to red...
* likelihood of future fallbacks. Wake kswapd now as t...
* may be balanced overall and kswapd will not wake nat...
*/
if (boost_watermark(zone) && (alloc_flags & ALLOC_KSWAP...
set_bit(ZONE_BOOSTED_WATERMARK, &zone->flags);
-
--[[linux-5.15/boost_watermark()]]
--[[linux-5.15/set_bit()]]
/* We are not allowed to try stealing from the whole bl...
if (!whole_block)
goto single_page;
free_pages = move_freepages_block(zone, page, start_type,
&movable_pages);
-
--[[linux-5.15/move_freepages_block()]]
/*
* Determine how many pages are compatible with our all...
* For movable allocation, it's the number of movable p...
* we just obtained. For other types it's a bit more tr...
*/
if (start_type == MIGRATE_MOVABLE) {
alike_pages = movable_pages;
} else {
/*
* If we are falling back a RECLAIMABLE or UNMOVABLE a...
* to MOVABLE pageblock, consider all non-movable page...
* compatible. If it's UNMOVABLE falling back to RECLA...
* vice versa, be conservative since we can't distingu...
* exact migratetype of non-movable pages.
*/
if (old_block_type == MIGRATE_MOVABLE)
alike_pages = pageblock_nr_pages
- (free_pages + movable_pages);
else
alike_pages = 0;
}
/* moving whole block can fail due to zone boundary con...
if (!free_pages)
goto single_page;
/*
* If a sufficient number of pages in the block are eit...
* comparable migratability as our allocation, claim th...
*/
if (free_pages + alike_pages >= (1 << (pageblock_order-...
page_group_by_mobility_disabled)
set_pageblock_migratetype(page, start_type);
return;
-
--[[linux-5.15/set_pageblock_migratetype()]]
single_page:
move_to_free_list(page, zone, current_order, start_type);
}
-
--[[linux-5.15/move_to_free_list()]]
*コメント [#o725d1ab]
ページ名: