“a748384bba1754409383ba9f0738bffdfa3fd431”上不存在“drivers/rtc/rtc-twl.c”
提交 f8f0da00 编写于 作者: M Ma Wupeng 提交者: Yongqiang Liu

mm: mem_reliable: Start fallback if no suitable zone found

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

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

For reliable memory allocation bind to nodes which do not hvve any
reliable zones, its memory allocation will fail and then warn message
will be produced at the end of __alloc_pages_slowpath().

Though this memory allocation can fallback to movable zone in
check_after_alloc() if fallback is enabled, something should be done to
prevent this pointless warn log.

To solve this problem, fallback to movable zone if no suitable zone found.
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 788ab096
...@@ -4272,6 +4272,25 @@ check_retry_cpuset(int cpuset_mems_cookie, struct alloc_context *ac) ...@@ -4272,6 +4272,25 @@ check_retry_cpuset(int cpuset_mems_cookie, struct alloc_context *ac)
} }
#ifdef CONFIG_MEMORY_RELIABLE #ifdef CONFIG_MEMORY_RELIABLE
/*
* if fallback is enabled, fallback to movable zone if no dma/normal zone
* found
*/
static inline struct zone *mem_reliable_fallback_zone(gfp_t gfp_mask,
struct alloc_context *ac)
{
if (!reliable_allow_fb_enabled())
return NULL;
if (!(gfp_mask & ___GFP_RELIABILITY))
return NULL;
ac->high_zoneidx = gfp_zone(gfp_mask & ~___GFP_RELIABILITY);
ac->preferred_zoneref = first_zones_zonelist(
ac->zonelist, ac->high_zoneidx, ac->nodemask);
return ac->preferred_zoneref->zone;
}
static inline void mem_reliable_fallback_slowpath(gfp_t gfp_mask, static inline void mem_reliable_fallback_slowpath(gfp_t gfp_mask,
struct alloc_context *ac) struct alloc_context *ac)
{ {
...@@ -4290,6 +4309,11 @@ static inline void mem_reliable_fallback_slowpath(gfp_t gfp_mask, ...@@ -4290,6 +4309,11 @@ static inline void mem_reliable_fallback_slowpath(gfp_t gfp_mask,
} }
} }
#else #else
static inline struct zone *mem_reliable_fallback_zone(gfp_t gfp_mask,
struct alloc_context *ac)
{
return NULL;
}
static inline void mem_reliable_fallback_slowpath(gfp_t gfp_mask, static inline void mem_reliable_fallback_slowpath(gfp_t gfp_mask,
struct alloc_context *ac) {} struct alloc_context *ac) {}
#endif #endif
...@@ -4339,8 +4363,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, ...@@ -4339,8 +4363,10 @@ __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) {
goto nopage; if (!mem_reliable_fallback_zone(gfp_mask, ac))
goto nopage;
}
if (gfp_mask & __GFP_KSWAPD_RECLAIM) if (gfp_mask & __GFP_KSWAPD_RECLAIM)
wake_all_kswapds(order, gfp_mask, ac); wake_all_kswapds(order, gfp_mask, ac);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册