Received: by 2002:ab2:1984:0:b0:1f7:886a:16b6 with SMTP id y4csp245586lqf; Tue, 30 Apr 2024 10:46:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV729v814RxFWxgoXBdBL1K+JK/uLdjV12/tklIL7LcYxqHBGTDSjHPQRCz1OV0jj96xONjisOTHZ5om03hvmmDFqx0ablx7wc0oVo5mw== X-Google-Smtp-Source: AGHT+IE95z8xcOp0W0zQbUSyFpTio0THy2C77VOzZZFJgdbv8i4lc5SVnX0nrTzDI3hdQdOfZA4O X-Received: by 2002:a05:6358:52c7:b0:17f:565c:8db2 with SMTP id z7-20020a05635852c700b0017f565c8db2mr687305rwz.12.1714499204789; Tue, 30 Apr 2024 10:46:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714499204; cv=pass; d=google.com; s=arc-20160816; b=TLECDVvt+PRUoL04yttqznPcIMawnVcnqGQfkdStqCQvW7QdfZYv+hRIdlMZR35bbF xyg2OfIREub/fr4JJNQUeI0FKUk+YGRGzWg0y8UdUjaGTBAeWSDFtYg39vUwNNIdy+Pt 2P58SKLsl27DfNdlnB933HDAjx5fu10DmPI8OhZXEYEgU29wOKMMeNzYEA/AE3wgqELc NFbVMpaEOZeuUov9hTF8PYw3s698Fm45oC8O8UcUe+oci6z1Qw9cqRFG4FpJOOavbnId Vfh3wf3PmP2i07wS6KBaFYnpZXlieXNlnO3JDMU1mvLWu9NtqgaRVRvf3HfjDMSXf1zM sSZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=pybzdGcdEs63Bij7DWZmHPl3clx+Ov+QZxJvlEZLe1g=; fh=Zk0kh3yAwB9GawTJ6z6YfVxKV+MpJ4Q3ZM+4LqbRWak=; b=A308tX+Ysl4yUV/1JgpsgsKfaqmIf7sPplyaTaSeqPk4OroL/iNK1krBI1+lr45DVw 6VY+mOoemMX7Fv9BJQk1672Zsio2jjMVjKvPlLWg4sHgEqzdZmVn15Fgamo3QXZ8ITWi 8RJVW8KT3M8TKA5F5YFw8w++QsX0cmQZtkQI5no9V8ROu/b7b+S94L/5baevnwU1PhsA SxLDDV0K/jW5yOd/xrh0SCHKDrHY+RqSrjt3fSHt0GDUIM2AzHZP9jyRWfsus2uVHlR3 Cd2VC6sGxSCDNQDN1FVNHD4+YVU4t5AoB3qPtjQBmD9dcnsFEtKTX1egSdogq+EihCiK l0jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=C5MCou+I; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-164548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164548-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cb11-20020a056a02070b00b005fcac46da4csi19165978pgb.731.2024.04.30.10.46.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 10:46:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=C5MCou+I; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-164548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164548-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 02DB1286627 for ; Tue, 30 Apr 2024 17:45:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9486C18131F; Tue, 30 Apr 2024 17:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="C5MCou+I" Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA147180A70 for ; Tue, 30 Apr 2024 17:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714499113; cv=none; b=qqQqIHYxFUQ/USempieTAg59sITvub34DcIKsJcrUd7njNjJF//f3MLE/ud+/h49bDeCkLancCf+0zG0zMBcM6D1orUXINjEXDGE175b6Bn8ezgekmU6337X3SaxGMhq4T998Euud3Zmx0GtalBCjYWSCHtuMVr1MMg2tjY3RoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714499113; c=relaxed/simple; bh=jqF1Nk/S7NILrmXQBSBZ/M0xVtd86KHGbUgyPhMIe4I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BDbtApFaZU3fq3e5yeBA4FFJHoZF/7YPoaNtFnkJuvQw9ggYHHa1HDkMNOtF2r3xnCD00JmnEO1rAqko0+iBf0jlcq92Q+6hkdnhzbuNEBzuwNfELr2e2SrOGK/C+Xyr7eqtKMuY9yw6+NRClE0XJqLl8S6MOJhcmZaCAIIUwTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=C5MCou+I; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Tue, 30 Apr 2024 10:45:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714499110; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pybzdGcdEs63Bij7DWZmHPl3clx+Ov+QZxJvlEZLe1g=; b=C5MCou+Ib5hMMFkCmrDrgwVBFWJbmii5S72vI/X86+3XIb/SCBgGBWAn6Dbs4KQkBB7hbp DqHW8ACmPg7WVtGNqRJJwRHuXiqsbM8rZtmMDV4r3j3aCMIhEq6Mm/0RZ2lZB3J42ZL1CM lc7Gzxh3xMJ/g/TdeH0eWMYsBrTlAv0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: "T.J. Mercier" Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Yosry Ahmed , kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/8] memcg: reduce memory for the lruvec and memcg stats Message-ID: References: <20240430060612.2171650-1-shakeel.butt@linux.dev> <20240430060612.2171650-5-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Tue, Apr 30, 2024 at 10:30:51AM -0700, T.J. Mercier wrote: > On Mon, Apr 29, 2024 at 11:06 PM Shakeel Butt wrote: > > > > + > > +static inline int memcg_stats_index(int idx) > > +{ > > + return mem_cgroup_stats_index[idx] - 1; > > Could this just be: return mem_cgroup_stats_index[idx]; > with a postfix increment of j in init_memcg_stats instead of prefix increment? > The -1 is basically for error checking but I will do a followup patch to initialize the array/indirection-table with -1 and remove the subtraction from the fast path. Thanks for the review.