提交 a1bdc2e2 编写于 作者: M Ma Wupeng 提交者: Wang Wensheng

mm: Clear GFP_RELIABLE if the conditions are not met

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S
CVE: NA

--------------------------------

Memory reliable only handle memory allocation from movable zone.
GFP_RELIABLE will be removed if the conditions are not met.
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
上级 7023dd3c
......@@ -5148,11 +5148,26 @@ EXPORT_SYMBOL_GPL(__alloc_pages_bulk);
static inline void prepare_before_alloc(gfp_t *gfp_mask)
{
bool zone_movable;
if (!mem_reliable_is_enabled())
return;
goto clear_flag;
/*
* memory reliable only handle memory allocation from movable zone
* (force alloc from non-movable zone or force alloc from movable
* zone) to get total isolation.
*/
zone_movable = gfp_zone(*gfp_mask & ~GFP_RELIABLE) == ZONE_MOVABLE;
if (!zone_movable)
goto clear_flag;
if ((current->flags & PF_RELIABLE) || is_global_init(current))
*gfp_mask |= GFP_RELIABLE;
return;
clear_flag:
*gfp_mask &= ~GFP_RELIABLE;
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册