Received: by 10.213.65.68 with SMTP id h4csp806887imn; Fri, 6 Apr 2018 09:13:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx49blGms5qK6XynQmiVKLSfedOvJ7FDO4DrjN11evt+Wzt6AdCBakghI5vzMj1aMug/56Kox X-Received: by 2002:a17:902:9a86:: with SMTP id w6-v6mr27717269plp.168.1523031189970; Fri, 06 Apr 2018 09:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523031189; cv=none; d=google.com; s=arc-20160816; b=shd27H4y1je3ik/VZvD1aWMntOyhUSxOylYraY9qs2dI7d56M9pp0+7eug0jFYY/Hd ijcmx37WvHUVUVekH6N8mChilJf9VkPqzKOWA+vKyHUpTU2sSRTZ/R2RI5QR5Q5XmXt6 4GJlxvCCmKwrl8wfc/7HM3rQCbi4RbzZSbK7MXS0Un2wIEzVXJAWIHXFAAyFMYFxentC hGjlNh8TXFbrwVnTMNWkRisrmlbqlCAPdFw2Dr+gfcxxa5k6s0qQjIxVocJ60u+jbKSo 3W+is7MjUSA3YzxUUKmvXLIK7P6wKgNyZNIlwRFP29B+GUuuyRE1SPbaWS3x6bHXhRXx HR/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=TixkpVrzMzsiIzsJWlLJWdL220iX8pSQERSMV98D3N4=; b=RwpOm/RBrcU26JXKbIQa7TydVthU0s9rJjsaIR+3+8vnKhcs79nyVhn2mwkhiYAP3l W7gasQJ9a5bGliZXhdmdKOf0TL46cOEiN2HBpbF6WrWQ2G7nCp0GxVJUbQxk27JcKEuW kSWHAlOm18qLlf+GvUxJZyEEk5t2+anFwwqnmRq9E/SYva57iWmUROJzwLxmYjsGt72e vyAlBp18JOTUKMIbY1p9QY/XYzIr3uVpK5PKSe8DBHcibj2k1VDaByJBKK8npbnOMAaH jnKcZtuiNtV+Hbnz2+affHk0RD3E1J1n7f9YXxkPIuiK5o6oJ0kuUhCwt3QHb5URCNZE iJmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91-v6si9058536plf.78.2018.04.06.09.12.55; Fri, 06 Apr 2018 09:13:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752081AbeDFQLu (ORCPT + 99 others); Fri, 6 Apr 2018 12:11:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:35845 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751754AbeDFQLt (ORCPT ); Fri, 6 Apr 2018 12:11:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 898F6AF87; Fri, 6 Apr 2018 16:11:47 +0000 (UTC) Date: Fri, 6 Apr 2018 18:11:46 +0200 From: Michal Hocko To: Johannes Weiner Cc: Stephen Rothwell , Andrew Morton , Linux-Next Mailing List , Linux Kernel Mailing List Subject: Re: [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix Message-ID: <20180406161146.GN8286@dhcp22.suse.cz> References: <20180406145330.4d166464@canb.auug.org.au> <20180406155441.GA20806@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180406155441.GA20806@cmpxchg.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 06-04-18 11:54:41, Johannes Weiner wrote: > 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 memory.events 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) > atomic_long_read(&memcg->memory_events[MEMCG_MAX])); > seq_printf(m, "oom %lu\n", > atomic_long_read(&memcg->memory_events[MEMCG_OOM])); > - 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)); Ohh, this is so easy to miss. -- Michal Hocko SUSE Labs