From patchwork Mon Aug 22 00:17:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12950093 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 9A4F6C32772 for ; Mon, 22 Aug 2022 00:18:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E4E38E0002; Sun, 21 Aug 2022 20:18:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 293CA6B0074; Sun, 21 Aug 2022 20:18:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15BEB8E0002; Sun, 21 Aug 2022 20:18:11 -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 08A806B0073 for ; Sun, 21 Aug 2022 20:18:11 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D21441C5D44 for ; Mon, 22 Aug 2022 00:18:10 +0000 (UTC) X-FDA: 79825316340.11.8653EC2 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf24.hostedemail.com (Postfix) with ESMTP id 7D3A3180051 for ; Mon, 22 Aug 2022 00:18:10 +0000 (UTC) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-333f0d49585so159567387b3.9 for ; Sun, 21 Aug 2022 17:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=DTW77A/Vjl+d5bcQDIprq1tGD6UgniZYOTpaR8iNZIc=; b=Dg9yytO9IkPtQr0hKr1opAsmaHFl6Ti0qmk9dgNkQKa6EeZnhuamJ8wFuDDpvnSucO 3jnI66hn0RZluaprAxAC9vZCxkQXXdYA0KwOtMgEey7a9lQkqmoQ767sSys3ES+TUduk 8r9futG6QW922rVpAUoBuyvHCBDkXpj6Z6uIr5bt4pi4JjwABrXPfF7E2R9JF1EvrU3W 3HTuZx9jrCVbRGBo1EjBv/Hu+VbfEktqbj+TpV4cjusZQtsDY5OAzcQ1W3tgUYcjFPCH ebqBDDU8/54Qiztpi0pJPbzqNXn5hxGVXBNshftViCKjFt6eCv7LnIrPsIrM9eVLCdKl WwwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=DTW77A/Vjl+d5bcQDIprq1tGD6UgniZYOTpaR8iNZIc=; b=D/3rikxLvmpuwkR+2pT8egIcWyg67GAAenWb1TrQQtfszUMmUwlsfpEz86R8OZb4pE YsAb2pdFe1uzCpmQtclDdv7hgVKsSxhuy2UmmMIjkesULNEQxi/nsVGFfoctUP2kBg8O clfqOvIsLAgeWLrc42OoyoRo54RE91IS01X7x0E5Kw2M8ASOiS8jwVVccWW80NZTw0br IEXbniX1AdTZPLGyD0gaPr+pzgMBgK22xiY/+tB7BOmFw/58zOB88jvQghSlzGDh1fc4 raKEOZU9wOTU0Bp+TD+ugO02oiJFuybyMmYzfZKWCWeUpJbZqxA/ZaTyv3Hq5yGbQytt hLoA== X-Gm-Message-State: ACgBeo08FEUPM6bprL3Zzkpy9LHq8hgmLHvFndqQZtuzmUi8v2NXDB2X qnq1zb6AIAuaOzKDP7A2oh9llRsrECbiGw== X-Google-Smtp-Source: AA6agR6tW1MO8bdpOOCAdPjlI2KgLdp2empQdKN2rFu+N7JEzRBKSYp9P+zG59MACSGNvPbZ7uCstsPP+839Yw== X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:28b]) (user=shakeelb job=sendgmr) by 2002:a25:9f8d:0:b0:686:9a3d:6f85 with SMTP id u13-20020a259f8d000000b006869a3d6f85mr16587811ybq.400.1661127489865; Sun, 21 Aug 2022 17:18:09 -0700 (PDT) Date: Mon, 22 Aug 2022 00:17:37 +0000 In-Reply-To: <20220822001737.4120417-1-shakeelb@google.com> Message-Id: <20220822001737.4120417-4-shakeelb@google.com> Mime-Version: 1.0 References: <20220822001737.4120417-1-shakeelb@google.com> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog Subject: [PATCH 3/3] memcg: increase MEMCG_CHARGE_BATCH to 64 From: Shakeel Butt To: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song Cc: " =?utf-8?q?Michal_Koutn=C3=BD?= " , 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, Shakeel Butt ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661127490; a=rsa-sha256; cv=none; b=H6V/hD66mM1vQUiS67zOGiTrpF2iMckgvPbKDR+hYw7lj33/4A377Ysg/5+Oy3APD3G6Dh AaTl9rW4jtD49V5LsvV4xGLC6FikRNuW1HPZiQOVYCOflNylT0VmWV5QrcRMshWj141ZVt 7CDOHycEhZnvu1Z5ql7g7OQi90+eysI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Dg9yytO9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3QcsCYwgKCAIujcmggndiqqing.eqonkpwz-oomxcem.qti@flex--shakeelb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3QcsCYwgKCAIujcmggndiqqing.eqonkpwz-oomxcem.qti@flex--shakeelb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661127490; 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=DTW77A/Vjl+d5bcQDIprq1tGD6UgniZYOTpaR8iNZIc=; b=stF0efqVU8BvBhEpR1vPQdzMusAxM0dBAkg+aLMj2i05NotbIPis6kdNRYV7Pvd6Yrj17a stwkFfqlYnCITSgJPNwuK4MtXdZR2Wa92FhvDKtjBn9Mtjeohf7SoDpTMi3m6Xrxgwg+r/ agSLtWv/GmgstMYhQYDlFyeXJOW6u1s= X-Stat-Signature: uf7ahomqqzj9i89qx4hckqfxsbpoqb9c Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Dg9yytO9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3QcsCYwgKCAIujcmggndiqqing.eqonkpwz-oomxcem.qti@flex--shakeelb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3QcsCYwgKCAIujcmggndiqqing.eqonkpwz-oomxcem.qti@flex--shakeelb.bounces.google.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7D3A3180051 X-HE-Tag: 1661127490-613066 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: For several years, MEMCG_CHARGE_BATCH was kept at 32 but with bigger machines and the network intensive workloads requiring througput in Gbps, 32 is too small and makes the memcg charging path a bottleneck. For now, increase it to 64 for easy acceptance to 6.0. We will need to revisit this in future for ever increasing demand of higher performance. Please note that the memcg charge path drain the per-cpu memcg charge stock, so there should not be any oom behavior change. To evaluate the impact of this optimization, on a 72 CPUs machine, we ran the following workload in a three level of cgroup hierarchy with top level having min and low setup appropriately. More specifically memory.min equal to size of netperf binary and memory.low double of that. $ netserver -6 # 36 instances of netperf with following params $ netperf -6 -H ::1 -l 60 -t TCP_SENDFILE -- -m 10K Results (average throughput of netperf): Without (6.0-rc1) 10482.7 Mbps With patch 17064.7 Mbps (62.7% improvement) With the patch, the throughput improved by 62.7%. Signed-off-by: Shakeel Butt Reported-by: kernel test robot Acked-by: Soheil Hassas Yeganeh Reviewed-by: Feng Tang Acked-by: Michal Hocko Acked-by: Roman Gushchin --- include/linux/memcontrol.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 4d31ce55b1c0..70ae91188e16 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -354,10 +354,11 @@ struct mem_cgroup { }; /* - * size of first charge trial. "32" comes from vmscan.c's magic value. - * TODO: maybe necessary to use big numbers in big irons. + * size of first charge trial. + * TODO: maybe necessary to use big numbers in big irons or dynamic based of the + * workload. */ -#define MEMCG_CHARGE_BATCH 32U +#define MEMCG_CHARGE_BATCH 64U extern struct mem_cgroup *root_mem_cgroup;