“386f2ed9e00cd2b7e7a7f4c934bd8752999f7252”上不存在“src/git@gitcode.net:u014301111/VueJS.git”
提交 461c96c6 编写于 作者: M Ma Wupeng 提交者: Yongqiang Liu

mm: fix zoneref mapping problem in memory reliable

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

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

The mapping between zoneref and zone will be updated if __GFP_THISNODE is
defined and memory reliable fallback is enabled. This will put ZONE_MOVABLE
in a wrong zonerefs slot and lead to the origin zone unselectable.

With this patch, high_zoneidx is updated via gfp_zone() which
___GFP_RELIABILITY is removed from the origin gfp_mask. Perferred zoneref
is recalculated after.

Fixes: 3023a4b3 ("mm: Introduce fallback mechanism for memory reliable")
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 813f361c
...@@ -3672,21 +3672,21 @@ __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order, ...@@ -3672,21 +3672,21 @@ __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order,
} }
#ifdef CONFIG_MEMORY_RELIABLE #ifdef CONFIG_MEMORY_RELIABLE
static inline struct zone *reliable_fb_find_zone(gfp_t gfp_mask, static inline void reliable_fb_find_zone(gfp_t gfp_mask,
struct alloc_context *ac) struct alloc_context *ac)
{ {
if (!reliable_allow_fb_enabled()) if (!reliable_allow_fb_enabled())
return NULL; return;
/* dst nodemask may don't have zone we want, fallback here */ /* dst node don't have zone we want, fallback here */
if ((gfp_mask & __GFP_THISNODE) && (ac->high_zoneidx == ZONE_NORMAL) && if ((gfp_mask & __GFP_THISNODE) && (ac->high_zoneidx == ZONE_NORMAL) &&
(gfp_mask & ___GFP_RELIABILITY)) { (gfp_mask & ___GFP_RELIABILITY)) {
struct zoneref *ref = first_zones_zonelist( ac->high_zoneidx = gfp_zone(gfp_mask & ~___GFP_RELIABILITY);
ac->zonelist, ZONE_MOVABLE, ac->nodemask); ac->preferred_zoneref = first_zones_zonelist(
return ref->zone; ac->zonelist, ac->high_zoneidx, ac->nodemask);
} }
return NULL; return;
} }
static inline struct page * static inline struct page *
...@@ -3712,10 +3712,10 @@ reliable_fb_before_oom(gfp_t gfp_mask, int order, ...@@ -3712,10 +3712,10 @@ reliable_fb_before_oom(gfp_t gfp_mask, int order,
return NULL; return NULL;
} }
#else #else
static inline struct zone *reliable_fb_find_zone(gfp_t gfp_mask, static inline void reliable_fb_find_zone(gfp_t gfp_mask,
struct alloc_context *ac) struct alloc_context *ac)
{ {
return NULL; return;
} }
static inline struct page *reliable_fb_before_oom(gfp_t gfp_mask, int order, static inline struct page *reliable_fb_before_oom(gfp_t gfp_mask, int order,
...@@ -4375,8 +4375,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, ...@@ -4375,8 +4375,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
ac->preferred_zoneref = first_zones_zonelist(ac->zonelist, ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
ac->high_zoneidx, ac->nodemask); ac->high_zoneidx, ac->nodemask);
if (!ac->preferred_zoneref->zone) { if (!ac->preferred_zoneref->zone) {
ac->preferred_zoneref->zone = reliable_fb_find_zone(gfp_mask, ac);
reliable_fb_find_zone(gfp_mask, ac);
if (!ac->preferred_zoneref->zone) if (!ac->preferred_zoneref->zone)
goto nopage; goto nopage;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册