Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3031289rwa; Mon, 22 Aug 2022 19:42:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5E394mrnKyqNQkYdqf7dZmvYwrFc9iQK9C1IadGQSNpviyPanLk+bQ8zknKFf7m3T6+Njq X-Received: by 2002:a17:902:d2d1:b0:172:f000:e4a5 with SMTP id n17-20020a170902d2d100b00172f000e4a5mr6397013plc.37.1661222573748; Mon, 22 Aug 2022 19:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661222573; cv=none; d=google.com; s=arc-20160816; b=VOxrQcFn9qNNdBtyZ6zLKqRz9UiDqhbQAYKO0hbLNMKLQj/dlCgd9c36uk/NHPAdFD 5dxcKIiqN6nFMVTCzrvoeugp9yN4XqMQGRKfMxWxU2Y5S7SwM4SZ3kC8CUffSGOqNe2Q GqHwY1fGv+JPlVB/Pq/LNtTorHWcCM8RFMsPp43XU9LkqBpMoZ6CTG5bnshiHTNYmq7j YLHMFb7g7jDGKqugdS9sQQoHXN5hF1onaOQypQ6AAXmmmARrZ5uL9OoSs1HHD6kQPoEs ylfMTU8EClx9rsRkq05pIaN29js0w+vAnxb6YCEE3jGgoilV9ps6kXkAkJjIoybpmD8P Lrmw== 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=TZOqb9ioXhJDay90SUSTe6Atr/mSmzrNsQskOLmcTw4=; b=jmrtkUfZyIpf3HqtvMfpigZsS8frVa236Yx3a/c77c7jhYm2HE9iCKUS7VN9wtN2BA F3WbVR+YttIb9khuvsIGgaIPXw/MgfGKc1vhW5oes3NNma6e6csORfTKkhVuprLwVhYC BR08O1AeOo7k1Sgb9Drv7V+7wYQmdfoh5mChCho6CESnE5kGI5XaHXUPgTBGxk9paXAw zcSrLSVJPAurrn6GJRJJW92AqRNQpZ/D9Yo0SkiAd+kXvotqPEsEnx89ei4VQDA9UweR EDQNnwiq5rDcvjTm3WEtNzJXeHo6SZRS5NmltkL2YuqKh9pdXFG0aaUojPMLHajoaKrB doCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jI0qftCB; 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 y18-20020a634952000000b0041b72fda9b5si14647165pgk.311.2022.08.22.19.42.43; Mon, 22 Aug 2022 19:42:53 -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=jI0qftCB; 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 S239414AbiHWCWm (ORCPT + 99 others); Mon, 22 Aug 2022 22:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239350AbiHWCWf (ORCPT ); Mon, 22 Aug 2022 22:22:35 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E5655B044; Mon, 22 Aug 2022 19:22:34 -0700 (PDT) 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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!