Received: by 10.213.65.68 with SMTP id h4csp786171imn; Fri, 6 Apr 2018 08:54:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49i2ZZ4pGiZTyH7JzPBfWgN7iybP9bwVpxCOziG486PUB/xydl62ze/Hs4IPcF3C/bOC+5t X-Received: by 10.167.130.22 with SMTP id k22mr20991157pfi.73.1523030083169; Fri, 06 Apr 2018 08:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523030083; cv=none; d=google.com; s=arc-20160816; b=Q4f81gMroMUtwkHtBFje/82GdAHNTR0tZD5NeAJJwPOoMKdut96+pLBXgTz6j7d47c aZnJ3tOeaPiq7vYAQAzq6mKb9tWsIg2gr744uDY9SIQATDYvL7graMWUDHRkYIblyrGr 7gDLFuG6+EDlcNAtpIMKnzW1SldI6C48MhLHdrp973hopE85CBjWb+nyshMdlZIl6rYZ wENZOrQRujSv7oXMC5B456yaPEDcARy8n9f/0J6UOztEEnSCYer2qfs75slITbuORQRT 9gMp5DLRbeDEn/ciOnwYocpI3aP9xQawyxZCGLJY82vYIuLfL+YsPOXJ3r8nZZ4isNIn 8HCQ== 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:dkim-signature:arc-authentication-results; bh=0qGX0MnH9hq86FKpBn9yo80l/yEPaLdHsQ6z+vSVAeo=; b=QvnNKDYx2XNJcqSyEybvuy8Dc2+NydsfNlUDuUXvVIuN9TIde4IQeaAOkVuurm5TfL Jz8wRxflfBGbYvvTXP81cxKpIeCaQvDEqhBMSNsYv4w6PozxfznVETiX+fCZzWucPYe3 fR7PS5qkOJ7GRFP9HdiGUQmOh2abwOS6p+OnbmACtMjoVPc2O0rB7L5bpeDinrKjl9OM 9JqSTvTDPBcMM+uiEZha2+HPrYLAH3Zps/9j8VWBcCyCUZChvvOX8J/fPbtnMrsSflS8 7Y0m9rPI05xlIYGRaNE4/nxmiYO2QSGV4VTLR+rkruDc1l7MLNnC14VqgPO/4tTNlm/G uvHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=PMUNJG9W; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4-v6si9120743pll.128.2018.04.06.08.54.29; Fri, 06 Apr 2018 08:54:43 -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; dkim=fail header.i=@cmpxchg.org header.s=x header.b=PMUNJG9W; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbeDFPxS (ORCPT + 99 others); Fri, 6 Apr 2018 11:53:18 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:50350 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbeDFPxR (ORCPT ); Fri, 6 Apr 2018 11:53:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0qGX0MnH9hq86FKpBn9yo80l/yEPaLdHsQ6z+vSVAeo=; b=PMUNJG9WGVdHmkjJaf1RWkzFZx VWzNGNiHYgx6zc2ieyMv4G0e7OkfsfDTcUMziFO+9MKh8mrAeHQ72vhMRnW6f0rjoInVmhTmw7fsi VE8jx9WnG1QDbNOgys0dmbqrrc61+gK7WXwtXZsdeO6EFKDAmf4E+XIQXxrmxPgLXpqg=; Date: Fri, 6 Apr 2018 11:54:41 -0400 From: Johannes Weiner To: Stephen Rothwell Cc: Andrew Morton , Linux-Next Mailing List , Linux Kernel Mailing List Subject: [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix Message-ID: <20180406155441.GA20806@cmpxchg.org> References: <20180406145330.4d166464@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180406145330.4d166464@canb.auug.org.au> 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, 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)); return 0; }