From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 648E5C28D13 for ; Tue, 23 Aug 2022 02:22:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63FB98D0001; Mon, 22 Aug 2022 22:22:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EFE46B0074; Mon, 22 Aug 2022 22:22:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B7AE8D0001; Mon, 22 Aug 2022 22:22:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3C68D6B0073 for ; Mon, 22 Aug 2022 22:22:35 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 037C9C0521 for ; Tue, 23 Aug 2022 02:22:34 +0000 (UTC) X-FDA: 79829258670.11.27C0353 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf06.hostedemail.com (Postfix) with ESMTP id 60ED718003D for ; Tue, 23 Aug 2022 02:22:34 +0000 (UTC) Date: Mon, 22 Aug 2022 19:22:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661221352; 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=TZOqb9ioXhJDay90SUSTe6Atr/mSmzrNsQskOLmcTw4=; b=jI0qftCBqUXZ/ZlfsIX0UQLffYq89HNRsd9OT0MrXYVBD4YWNdLsaPUXLt1Nt8conY9VNu Our9SMBCO6MRU92nM4eMoAvX1Z8XNGtZscdF3oPd/WL6APpO+wU/shrYeBfxkhKV2gs4cB 8Ikj1k7/usuDTGr3ZyOp6n5d4u0jScI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Michal Hocko Cc: Shakeel Butt , Johannes Weiner , Muchun Song , Michal =?iso-8859-1?Q?Koutn=FD?= , Eric Dumazet , Soheil Hassas Yeganeh , Feng Tang , Oliver Sang , Andrew Morton , lkp@lists.01.org, cgroups@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] memcg: increase MEMCG_CHARGE_BATCH to 64 Message-ID: References: <20220822001737.4120417-1-shakeelb@google.com> <20220822001737.4120417-4-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661221354; a=rsa-sha256; cv=none; b=T+jySdLxHsH/CQkDKAMsI/Kh98uuGrN1m3Sey5OONa0wIPnrh1mRXqcCkPANut3Oe7+urG 9rVLr3Mr+tlz3yc6h+cxs27dhaqIZSvpOYCMozgijTuAfdXBXgwF1CG8bBRIdd7fAK4ZrC rJS1YtP87t99SK2F2u0MHLg+l6ACVLY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=jI0qftCB; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf06.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661221354; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TZOqb9ioXhJDay90SUSTe6Atr/mSmzrNsQskOLmcTw4=; b=CGrDl64Rj14ZNPb633hiqk+5ljORyW6b2E9cYPRsKlVqteZcjqVrdSmfClj8jOWLF8PMKe FOR7Iv9jB16lTaAx/s3iAphiOwDnRyF4Ccml7cW+8fe3YNAawrEyuU8M+9VgZPMH8aG328 U8hoxhDEO1laWjHJrcTIffZn/Yw347s= X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=jI0qftCB; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf06.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 60ED718003D X-Stat-Signature: y4qunwyo87ee89niod4m944khgcrkynr X-HE-Tag: 1661221354-323606 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Aug 22, 2022 at 09:34:59PM +0200, Michal Hocko wrote: > On Mon 22-08-22 11:37:30, Roman Gushchin wrote: > [...] > > I wonder only if we want to make it configurable (Idk a sysctl or maybe > > a config option) and close the topic. > > I do not think this is a good idea. We have other examples where we have > outsourced internal tunning to the userspace and it has mostly proven > impractical and long term more problematic than useful (e.g. > lowmem_reserve_ratio, percpu_pagelist_high_fraction, swappiness just to > name some that come to my mind). I have seen more often these to be used > incorrectly than useful. A agree, not a strong opinion here. But I wonder if somebody will complain on Shakeel's change because of the reduced accuracy. I know some users are using memory cgroups to track the size of various workloads (including relatively small) and 32->64 pages per cpu change can be noticeable for them. But we can wait for an actual bug report :) > > In this case, I guess we should consider either moving to per memcg > charge batching and see whether the pcp overhead x memcg_count is worth > that or some automagic tuning of the batch size depending on how > effectively the batch is used. Certainly a lot of room for > experimenting. I'm not a big believer into the automagic tuning here because it's a fundamental trade-off of accuracy vs performance and various users might make a different choice depending on their needs, not on the cpu count or something else. Per-memcg batching sounds interesting though. For example, we can likely batch updates on leaf cgroups and have a single atomic update instead of multiple most of the times. Or do you mean something different? Thanks!