Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2200831rwa; Mon, 22 Aug 2022 04:06:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR4skyn+wB210hRHEAndzT8KjQ9v/OvceK9sweuv/uY29w3IubitD6ki2qm9Wih1F6CAiizD X-Received: by 2002:a17:902:7e8b:b0:172:c2f2:e595 with SMTP id z11-20020a1709027e8b00b00172c2f2e595mr14280935pla.48.1661166390977; Mon, 22 Aug 2022 04:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661166390; cv=none; d=google.com; s=arc-20160816; b=tpXSBP6VrFLDYtfuXkAejltRcAFdttqmZmiGCBmhzK8S3Huo32VQmSRKn/FDpHXvyk /U9m/ca9hTBCj3aZXEyVxYAn86FVfgVhNWLEdz4ZNH3pS7PRovyHhW7rIlU1RnN6sSb7 WoquZYxUZhe1nzTLfz0ErrBxOLl2jlw78KNlDNULS7R0bmCMnkKMWDNlDVttC5ILnbPt MO1SLFSabBfFfEDjZSZ8ctacF3rotN3CSEdDA/CqZyCghRHaBX5QPykfvrYxRsID/Gc7 8UzA2MxV4SPB832PEuJKcAm/yX7B045Sbxcri3neELeZecP/InAPp+09UAJpEtsfHoxF cGQQ== 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:date:dkim-signature; bh=1M/Zuyl600zh5OmjL3aP6WKCrt6KbCa7RpzoykruBZw=; b=aQ4/qmDIUyhevU1JdCE0mdJcpZ6VAtlNQ+F+rmZ7IXyADqlrotUKY4JIXOKJyze4Az dRalx09d6tinweGlPAQkoTGuI4NMj2Divq+zv+sO4+gobPHiwa1+72ehf+oSQjJNS4OI RBeqIuC8CbnBwbHW3OE0UTwCpZWWuxD141VQwJLuSMugnaIbBjLswmnEkR/nvrwn9kgF Jan2jLXgnM/cqqS74vHzAR+nE3YH3aEf9/z2jmNKNM9b6hGTFrw0Ld0Gjv4LU8DX9Nnu /VtlC1FQZwBjyxFrXAE0kfD49JE1VFASyIvoYVlhxekP4BKkXAXQMTNpMG5GcFGv2owh +TnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=CkwIN1GE; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 202-20020a6302d3000000b0041db9f07695si12868572pgc.753.2022.08.22.04.06.19; Mon, 22 Aug 2022 04:06:30 -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=@suse.com header.s=susede1 header.b=CkwIN1GE; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233332AbiHVKsC (ORCPT + 99 others); Mon, 22 Aug 2022 06:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbiHVKr7 (ORCPT ); Mon, 22 Aug 2022 06:47:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56C72F644; Mon, 22 Aug 2022 03:47:58 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 52FA31FA1F; Mon, 22 Aug 2022 10:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661165277; h=from:from:reply-to: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=1M/Zuyl600zh5OmjL3aP6WKCrt6KbCa7RpzoykruBZw=; b=CkwIN1GEx3GNBlcdPWCiBCFdLpTLxcdkjLWaTODElEHE6mTTBhiKC+1N97hT5Gz7LlqnCH 9mMMdfZ0twoTWASkE/SJ3FgnBurhvYRkyqd0DI3+quAaHB4mw7f7mtFJzsVjB8LW2Bdx9C YwCnI1D7ziUWN9oC2VhGGm3yZP3sBJw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 343901332D; Mon, 22 Aug 2022 10:47:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sEDfCd1eA2OTFwAAMHmgww (envelope-from ); Mon, 22 Aug 2022 10:47:57 +0000 Date: Mon, 22 Aug 2022 12:47:56 +0200 From: Michal Hocko To: Shakeel Butt Cc: Johannes Weiner , Roman Gushchin , 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: <20220822001737.4120417-4-shakeelb@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,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 22-08-22 00:17:37, Shakeel Butt wrote: > 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. Yes, the batch size has always been an arbitrary number. I do not think there have ever been any solid grounds for the value we have now except we need something and SWAP_CLUSTER_MAX was a good enough template. Increasing it to 64 sounds like a reasonable step. It would be great to have it scale based on the number of CPUs and potentially other factors but that would be hard to get right and actually hard to evaluate because it will depend on the specific workload. > Please note that the memcg charge path drain the per-cpu memcg charge > stock, so there should not be any oom behavior change. It will have an effect on other stuff as well like high limit reclaim backoff and stast flushing. > 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. a similar feedback to the test case description as with other patches. > > $ 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 Anyway Acked-by: Michal Hocko Thanks! > --- > 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; > > -- > 2.37.1.595.g718a3a8f04-goog -- Michal Hocko SUSE Labs