提交 f7664d01 编写于 作者: M Ma Wupeng 提交者: Yang Yingliang

mm: Add more gfp flag check in prepare_before_alloc()

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

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

Memory allocation from buddy system will fallback to unmirrored memory if
mirrored memory is not enough and reliable memory fallback is closed.
___GFP_NOFAIL flag will be checked in prepare_before_alloc().

Fixes: 45bd608e ("mm: Introduce watermark check for memory reliable")
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 4c480319
...@@ -4651,7 +4651,13 @@ static inline bool prepare_before_alloc(gfp_t *gfp_mask, unsigned int order) ...@@ -4651,7 +4651,13 @@ static inline bool prepare_before_alloc(gfp_t *gfp_mask, unsigned int order)
if (!mem_reliable_is_enabled()) if (!mem_reliable_is_enabled())
return true; return true;
if (*gfp_mask & __GFP_NOFAIL)
return true;
if (gfp_ori & ___GFP_RELIABILITY) { if (gfp_ori & ___GFP_RELIABILITY) {
if (!(gfp_ori & __GFP_HIGHMEM) || !(gfp_ori & __GFP_MOVABLE))
return true;
if (mem_reliable_watermark_ok(1 << order)) { if (mem_reliable_watermark_ok(1 << order)) {
*gfp_mask |= ___GFP_RELIABILITY; *gfp_mask |= ___GFP_RELIABILITY;
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册