Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1227417rwn; Thu, 8 Sep 2022 15:54:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR6CiIrmk7cI1nSWkGQ34ZDDWbcJYKCuYq00UzLqpppEdRfGjQiXPVlw3fH04NznsQ3N3zGH X-Received: by 2002:a17:90b:38cc:b0:201:f60a:ec15 with SMTP id nn12-20020a17090b38cc00b00201f60aec15mr6734200pjb.28.1662677669827; Thu, 08 Sep 2022 15:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662677669; cv=none; d=google.com; s=arc-20160816; b=JmC8kTyxUE8lFh00sdANqO0coyZ2eaz8hxNN/SmuuicmvUzCcYbQkgtNbzdeNPBfV2 rcreWYhVfpK6OG3YE9zOzK+IBhieJ2Oq2kfhWKhL5N+3N+HKLINznUoJA4xdRzOcDwFQ sm0QOTPJm8IZoLrVwKdZqUP0LB8z5/qb/sY5ZX5ggjDrG9Co+W7SSGAdlHhgrUgKVy7V KQk5nXUYddaXsc4lUYdwjRTCoS8ClOBMtgf5X3zscPYCb/U5QgEGN89zUAwcH5ABmWqN HaUKvqOP7surWR+nvm4Oy/UFBBPWo9PITbvl2+9d2V27I7aRLIY6IAU1IWtIcfrkGg2v cPFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jjIi22j077WmjWx1uhw6kP/NewKpNuGmB7jwDeB0KcY=; b=CBJSBbxCUvs4lMGaO+A+xm1sptt5PyvuFKeplwBWMBiXvHP12FrEOBp/34DkjCY7hn itVAxvbCNEEU3n1sL1Pdt814AgpdFQHiL4YWUYVJzpFL2X5u9i/1iJ9pYSRfHXV7bsSt Od8+18JaQeOp6mK6WgM1Ooz2LbVxxB/NuJCa8NHv9Jn21mrnDQr4kCF4ZaD3tTV1gnbK RqxIw/vav6yYQSjyQJluBeK/d3Lste12n3jq3tp8P2YkyLeAEp+EAIUyKjGDyEbbV87P iVeOwE3fKOQ5aPwnAcZOk2O89utKwhr0MyYkS5zuOjHMZsY17CUqxC+6+6eSZ/xK5Q4G OHMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=kEGJQpMH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a170902c94e00b001714352fc5asi146783pla.404.2022.09.08.15.54.18; Thu, 08 Sep 2022 15:54:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=kEGJQpMH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbiIHWhh (ORCPT + 99 others); Thu, 8 Sep 2022 18:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbiIHWhf (ORCPT ); Thu, 8 Sep 2022 18:37:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F5D5071E; Thu, 8 Sep 2022 15:37:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 68DB961E57; Thu, 8 Sep 2022 22:37:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79958C433D7; Thu, 8 Sep 2022 22:37:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1662676652; bh=RXI/S2LYORA9kdbqhda/3YzOj4NudTqOLXCZh8OTpgA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kEGJQpMHSP1rHh5cA53z/rhx151d3iEmV8c26u8Jrn1nf4Kgqkaa6XyFChHpEBi1o d43NY62xfwL1k6fVhmHe4a2c33akdSyIzFagezUlm27G68VxZa5J3sRBmijWQ2aOQb khq3koVe/u7B5k3QTDiG97mC9VF1/RwV+PrikHkA= Date: Thu, 8 Sep 2022 15:37:31 -0700 From: Andrew Morton To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Cgroups , Linux MM , LKML Subject: Re: [PATCH 3/3] memcg: reduce size of memcg vmstats structures Message-Id: <20220908153731.d6ec2095c9d1f42ff5e8ec5c@linux-foundation.org> In-Reply-To: References: <20220907043537.3457014-1-shakeelb@google.com> <20220907043537.3457014-4-shakeelb@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Sep 2022 19:35:10 -0700 Shakeel Butt wrote: > On Tue, Sep 6, 2022 at 9:36 PM Shakeel Butt wrote: > > > [...] > > > > static unsigned long memcg_events_local(struct mem_cgroup *memcg, int event) > > { > > long x = 0; > > int cpu; > > + int index = memcg_events_index(event); > > + > > + if (index < 0) > > + return 0; > > > > for_each_possible_cpu(cpu) > > x += per_cpu(memcg->vmstats_percpu->events[event], cpu); > > Andrew, can you please replace 'event' in the above line with 'index'? > I had this correct in the original single patch but messed up while > breaking up that patch into three patches for easier review. No probs. From: Andrew Morton Subject: memcg-reduce-size-of-memcg-vmstats-structures-fix Date: Thu Sep 8 03:35:53 PM PDT 2022 fix memcg_events_local() array index, per Shakeel Link: https://lkml.kernel.org/r/CALvZod70Mvxr+Nzb6k0yiU2RFYjTD=0NFhKK-Eyp+5ejd1PSFw@mail.gmail.com Cc: Johannes Weiner Cc: Michal Hocko Cc: Muchun Song Cc: Roman Gushchin Cc: Shakeel Butt Signed-off-by: Andrew Morton --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memcontrol.c~memcg-reduce-size-of-memcg-vmstats-structures-fix +++ a/mm/memcontrol.c @@ -921,7 +921,7 @@ static unsigned long memcg_events_local( return 0; for_each_possible_cpu(cpu) - x += per_cpu(memcg->vmstats_percpu->events[event], cpu); + x += per_cpu(memcg->vmstats_percpu->events[index], cpu); return x; } _