提交 58713685 编写于 作者: X Xu Yu

alinux: mm: fix undefined reference to printk_ratelimit_state

fix #27508738

The variable printk_ratelimit_state is not defined if CONFIG_PRINTK is
not set, but is directly accessed in mm/oom_kill.c without considering
the config.

Consider CONFIG_PRINTK when accessing printk_ratelimit_state in
mm/oom_kill.c.

Fixes: 41a1a935 ("alinux: oom: add ratelimit printk to prevent softlockup")
Reported-by: Nkbuild test robot <lkp@intel.com>
Signed-off-by: NXu Yu <xuyu@linux.alibaba.com>
Reviewed-by: Nzhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 79e7c57a
......@@ -862,8 +862,10 @@ static void __oom_kill_process(struct task_struct *victim, bool is_memcg)
bool can_oom_reap = true;
bool suppress_print = false;
#ifdef CONFIG_PRINTK
if (is_memcg && __ratelimit(&printk_ratelimit_state))
suppress_print = true;
#endif
p = find_lock_task_mm(victim);
if (!p) {
put_task_struct(victim);
......@@ -993,8 +995,10 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
* Meanwhile, Use printk_ratelimit_state rather than oom_memcg_rs to
* not suppress important print message overly.
*/
#ifdef CONFIG_PRINTK
if (is_memcg_oom(oc) && __ratelimit(&printk_ratelimit_state))
suppress_print = true;
#endif
if (!suppress_print)
pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册