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 1D074C00140 for ; Mon, 22 Aug 2022 00:25:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9EB368E0002; Sun, 21 Aug 2022 20:25:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 94CB76B0074; Sun, 21 Aug 2022 20:25:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EDDD8E0002; Sun, 21 Aug 2022 20:25:14 -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 686B86B0073 for ; Sun, 21 Aug 2022 20:25:14 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3FA1BC0350 for ; Mon, 22 Aug 2022 00:25:14 +0000 (UTC) X-FDA: 79825334148.02.DDB8AD5 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by imf05.hostedemail.com (Postfix) with ESMTP id E5C72100032 for ; Mon, 22 Aug 2022 00:25:13 +0000 (UTC) Received: by mail-ej1-f42.google.com with SMTP id w19so18274814ejc.7 for ; Sun, 21 Aug 2022 17:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=vOM6Qk7H6503nwlxurWDnApj6tGcPYJKuggwnA4Q7DI=; b=d18GG+Bt516p+zMinyCQn18btHPsTUkM8kPzrVj0qRlWdy2iXgPx5SdfNKsgRcQ5+t OtpT4LYrHOqGSPN6EtuMYhEn51cgY1lIg1cVM4bqJBczwtMS70sLDPg356P2VE3PM9Dh mgRZekRTLn1Ac3RMfhbmkkN+PXDbsIU/PgXaHy/nHlK1uWtZJVQNzXTxZ/9TdY4yv7E7 6YRljr0tzGJfVO75aEh2zLCwUUaQb+K9LDB+6+a6DUjZevqZX+VoHbDggFmctnlqzlJc uJuGiXe1qObFP1Y+nN/gYcpwbAf8zmYaSbZfrL1rUOPvdz8Vng8leg9pLCE7NFHmnv79 eBNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=vOM6Qk7H6503nwlxurWDnApj6tGcPYJKuggwnA4Q7DI=; b=KmSOPi1bjuiUXBikXbmLKE9HayhGofbMqBVvgYy1luZW2pBTT/ZGa5phY5nQILFHsM eYKA5VxIqWFSRJpjZ8MyDprLdY067lq8obAp6DHrx+siW3MV2MaZCRYwJpZ3lS8/AX22 cgpLUNeFIZqBdrVt39XIqEVnHMh93CGu+xAeoUy7ErnEe0a/PgBq8xGQKyn6soLeFKk6 KXuVEX7YefRVxcUgnyxysuLOTeq/wuGtrNvzTuwIDDfX/yE6GpZi5mMCEzIWWtWIMz5F vffRZZgLbhY9O/8fovDqks3YNoPrNvY2UQraYZigHFEIhwnT+hYsRXppwyuvIGIlfsu3 PcjA== X-Gm-Message-State: ACgBeo1KGmdrwlo2ErSWkX+DaXn74eSR9WzgiSGKusWoEuFKM/RI9//n Vk3bNkFmidSdWIs3Iuov+xSXdr0qeyhQIU64OgLmJA== X-Google-Smtp-Source: AA6agR4puzJX0PrJauJDGDb6lfb25cap5PHs14UeMXH8C4YJFfUFZ1L+OkYEALZgFj/wkeiWFQR2zpRpgYIcHjsWDeE= X-Received: by 2002:a17:907:608b:b0:731:8a9d:5a2d with SMTP id ht11-20020a170907608b00b007318a9d5a2dmr11502290ejc.443.1661127912457; Sun, 21 Aug 2022 17:25:12 -0700 (PDT) MIME-Version: 1.0 References: <20220822001737.4120417-1-shakeelb@google.com> <20220822001737.4120417-4-shakeelb@google.com> In-Reply-To: <20220822001737.4120417-4-shakeelb@google.com> From: Soheil Hassas Yeganeh Date: Sun, 21 Aug 2022 20:24:36 -0400 Message-ID: Subject: Re: [PATCH 3/3] memcg: increase MEMCG_CHARGE_BATCH to 64 To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Eric Dumazet , Feng Tang , Oliver Sang , Andrew Morton , lkp@lists.01.org, cgroups@vger.kernel.org, linux-mm , netdev , linux-kernel Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661127913; 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=vOM6Qk7H6503nwlxurWDnApj6tGcPYJKuggwnA4Q7DI=; b=iUMZZZwXV8y3rw/qEQ0TgECoVq7wHN4Z0b4gvyTuzKm6V4gXUxUYu1BNKYeYXaAUuVIGPk ry0C46Vl1ipZIWxDXybcAivcGB1K4zwRyf8h9JL9z3uq9HhpsLRJBtGGvlyAa0As0OxYd+ a2RJl2fv8szctq7z0ofd0cbKwkpZABc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=d18GG+Bt; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of soheil@google.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=soheil@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661127913; a=rsa-sha256; cv=none; b=ZRa2t6yFvq/pQS4LTsXPKRCRrarmJoCGiYf/35j1XX+sdUAxtJgp8+4v9FMSwQUcZfXS+R O2ysvqM2GiM1pmtbk4L8M5bRaom1ud/Ty7KuSVV8or3VjNrKkoRfzpC4rAWEwZRx9ZOlpg GfYGAx10Ddr7XCcyMteEE+dbjpYCnoo= X-Rspamd-Queue-Id: E5C72100032 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=d18GG+Bt; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of soheil@google.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=soheil@google.com X-Rspamd-Server: rspam04 X-Stat-Signature: zgpk1xqz9pz91os6g1uhgc6bd1i1mq8p X-HE-Tag: 1661127913-500670 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 Sun, Aug 21, 2022 at 8:18 PM 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. > > 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 Nice! Acked-by: Soheil Hassas Yeganeh > --- > 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 >