Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp317613rwn; Wed, 7 Sep 2022 17:28:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR5DEeRA9gkPf7N28kxpIiOkZuhRtv7VHpgWYJc8XHAFXR9L3F4a9su8gAJh0DvKtbrsX14v X-Received: by 2002:a17:903:22d0:b0:177:e5b2:c598 with SMTP id y16-20020a17090322d000b00177e5b2c598mr3840416plg.56.1662596892466; Wed, 07 Sep 2022 17:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662596892; cv=none; d=google.com; s=arc-20160816; b=cTOLEO55UOSh2HA5d0V/Ooq9wE4WGgj5e+VNvmn+9V6sZf0tyVqLbzhAAoH6OM9559 AyU3rPsBKe57AU3P4eRzyzZby1C5GQPXK+MQJF7ve228hfLurTWlccbzEaudPXFi4HT0 QtOLt7hQIi+UEAhLnev0+3LwxniMXca+O6jokBL0fWayI6djoND2hWqIKbtdvQtRr4sJ 0kyWT5BqgGhWhZUqxvyaG87pVhkXRIqpy7ne1Vq0MpqolcL2r+L41j3XfS5pY4ESv++/ 2PK8LNW5rhPV5cASeW+GDAn8+Vmtnw1pdqP7jTBPN6/SbJXJfevLRaI42wFaqpLlQWIY /TUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=TaKcAPnW1Rv+P8V2WVmdtPwTsnlpyaGaJZ+gn5WE91Y=; b=HDm7Bkxiik9ST7+1exgdWGwcBIke7ISlsX8S6cDk5vE3aeOkghmv0h688+XKDNEG8o xIjc00hznCkI6CIPZle8JX/8wiwIcZV7H2SbaZ91ZarImMgOExhxO5qgeHrMcH1Lb9EY Edb92svkJiSi4x0I7IisNLlrvsSDZgrCv/NPZ4+WlP4dtOYM8Y9zwaksue19j7wkpshO 17I0ytGlUqprZx1naMLt2/O2bBjkI9HjHajnfLtUnegmYiXYiznrn0x5Jwq5JcGJAtq6 8uXbgzNGEDNyhu86ZSmAT1L9XhxG/Een8aIFSp0OnQ2W3NAvc4t67dnYJRZWFQPQN5OQ dpTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ccqnbVj+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a635146000000b0042aff6e2846si17692934pgl.251.2022.09.07.17.28.00; Wed, 07 Sep 2022 17:28:12 -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.dev header.s=key1 header.b=ccqnbVj+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbiIGX1i (ORCPT + 99 others); Wed, 7 Sep 2022 19:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbiIGX1h (ORCPT ); Wed, 7 Sep 2022 19:27:37 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2644A95AD3; Wed, 7 Sep 2022 16:27:33 -0700 (PDT) Date: Wed, 7 Sep 2022 16:27:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1662593251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TaKcAPnW1Rv+P8V2WVmdtPwTsnlpyaGaJZ+gn5WE91Y=; b=ccqnbVj+QPPasLxHBGE6AFu8Yoq671MiQPkkyRGJgyLs7qpb2LL2u4wMhuPhWCx2es0Ow0 vm2SBlmaYjH8gKdhHyNdc9jnyC4Ik2/2sgdVZTnqm7dxc35nofvltU0Mtl84Fx2WLrNhIZ DL6do2sxzUEfuACz0QOFL05zurqThbg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Muchun Song , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] memcg: reduce size of memcg vmstats structures Message-ID: References: <20220907043537.3457014-1-shakeelb@google.com> <20220907043537.3457014-4-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220907043537.3457014-4-shakeelb@google.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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, Sep 07, 2022 at 04:35:37AM +0000, Shakeel Butt wrote: > The struct memcg_vmstats and struct memcg_vmstats_percpu contains two > arrays each for events of size NR_VM_EVENT_ITEMS which can be as large > as 110. However the memcg v1 only uses 4 of those while memcg v2 uses > 15. The union of both is 17. On a 64 bit system, we are wasting > approximately ((110 - 17) * 8 * 2) * (nr_cpus + 1) bytes which is > significant on large machines. > > This patch reduces the size of the given structures by adding one > indirection and only stores array of events which are actually used by > the memcg code. With this patch, the size of memcg_vmstats has reduced > from 2544 bytes to 1056 bytes while the size of memcg_vmstats_percpu has > reduced from 2568 bytes to 1080 bytes. This is pretty impressive! Thank you, Shakeel! Acked-by: Roman Gushchin for the series. Thanks!