Linux-Next Archive on
 help / color / Atom feed
From: Johannes Weiner <>
To: Stephen Rothwell <>
Cc: Andrew Morton <>,
	Linux-Next Mailing List <>,
	Linux Kernel Mailing List <>
Subject: [patch] mm: memcg: make sure is uptodate when waking pollers fix
Date: Fri, 6 Apr 2018 11:54:41 -0400
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Apr 06, 2018 at 02:53:30PM +1000, Stephen Rothwell wrote:
> Hi Andrew,
> After merging the akpm-current tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
> mm/memcontrol.c: In function 'memory_events_show':
> mm/memcontrol.c:5453:23: warning: array subscript is above array bounds [-Warray-bounds]
>       atomic_long_read(&memcg->memory_events[OOM_KILL]));
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Introduced by commit
>   725844c87a0d ("mm: memcg: make sure is uptodate when waking pollers")

Ah, silly, I missed that warning. The below fixes it.

Signed-off-by: Johannes Weiner <>

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 04ea2b104ee2..9bac6dc26e09 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5199,8 +5199,7 @@ static int memory_events_show(struct seq_file *m, void *v)
 	seq_printf(m, "oom %lu\n",
-	seq_printf(m, "oom_kill %lu\n",
-		   atomic_long_read(&memcg->memory_events[OOM_KILL]));
+	seq_printf(m, "oom_kill %lu\n", memcg_sum_events(memcg, OOM_KILL));
 	return 0;

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06  4:53 linux-next: build warning after merge of the akpm-current tree Stephen Rothwell
2018-04-06 15:54 ` Johannes Weiner [this message]
2018-04-06 16:11   ` [patch] mm: memcg: make sure is uptodate when waking pollers fix Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Next Archive on

Archives are clonable:
	git clone --mirror linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ \
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone