From patchwork Thu Aug 25 00:05:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12954104 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 12647C04AA5 for ; Thu, 25 Aug 2022 00:05:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A947094000A; Wed, 24 Aug 2022 20:05:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A1D0D6B0075; Wed, 24 Aug 2022 20:05:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BE3F94000A; Wed, 24 Aug 2022 20:05:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7B2D96B0074 for ; Wed, 24 Aug 2022 20:05:40 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 53B161C7123 for ; Thu, 25 Aug 2022 00:05:40 +0000 (UTC) X-FDA: 79836171240.25.B8F9F10 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf22.hostedemail.com (Postfix) with ESMTP id 11712C0044 for ; Thu, 25 Aug 2022 00:05:39 +0000 (UTC) Received: by mail-pj1-f73.google.com with SMTP id b5-20020a17090a12c500b001faa33a11dbso1540148pjg.1 for ; Wed, 24 Aug 2022 17:05:39 -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=3ANOEI0BBXDszhHsMjNjVkJxW2dSCbobxCznkiQMg0M=; b=M8tSmqMgyZLVy2Ldt7OEwatTGNnYnfDpQ69BuMQNcXOyVDB1zOG1S5rA/96I/PJKxE 4+npbWP3pWJ08Qbrxcia+8i6j7Gu69xnnOJNpGf1qEh/CTh6F27WQ4nVQLW4A9J5Lhh9 wZHGTsioVx7toZiUJ8cHixmiZOFP7E6zdyNZLONxSLuMdImMycE2Fyt+XuqZ+8IhLHsR C6dFsjW4r02bqFmtyRS3Kq6G3VP5sgtlfNBMT7ztQEx6AL13xu9pwUVXfdMd6YEAnByA YGozttZzHIvY64hF0IBSZ5RbI4tZvRxI5hd9vrRa+K0+Wr8X++i6Jrnvoe/mNBWb+0ko v09Q== 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=3ANOEI0BBXDszhHsMjNjVkJxW2dSCbobxCznkiQMg0M=; b=3debY8phhaVOegr9l7XyetWhYoC0+gvngoVKcFwycpkQ1GJOfGVxnxtoxcCk8oFN2w 2bRF6UiP2DYEiVP0RBCdaJiDCoAbPBrDDzncYUPtbZZHmJIIreDWF+F47l7s5sYwqai7 4ijxFWJwgSWhk71SALHi1Df6Xd41urj6GpOzIJiN9sno4LJHUSub4x9/OgMlyFOkULtN /WqS0XJ5zT7Rds14kfrmHryfb7pjJOh4akD4l9v0FnUtjGZubTsXzPYMD2n7DUlZTPKH CckFnXwA3qtQwdgL2KOr8e1s4eDfewAkwMGiyiaf6LxML3NyNXsgGIrfViN7wBqzLZnZ 6hvA== X-Gm-Message-State: ACgBeo2FSMMsxATvx0cBe5rmaochQfQZzgE/MwMsYUPOcbGutOew386J b1MDHsST4y/cAbAbBC4W4yElRiOirlJo+w== X-Google-Smtp-Source: AA6agR4pbPM00Y2dhBDzDYXIyyPDDsgaDbSO1VcMlYVbQBY5g87vni0ByGdo33smXqzxyN0vznInx5Zn2YarNQ== X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:262e]) (user=shakeelb job=sendgmr) by 2002:a05:6a00:1803:b0:536:e9a4:89d4 with SMTP id y3-20020a056a00180300b00536e9a489d4mr1451224pfa.28.1661385939060; Wed, 24 Aug 2022 17:05:39 -0700 (PDT) Date: Thu, 25 Aug 2022 00:05:06 +0000 In-Reply-To: <20220825000506.239406-1-shakeelb@google.com> Message-Id: <20220825000506.239406-4-shakeelb@google.com> Mime-Version: 1.0 References: <20220825000506.239406-1-shakeelb@google.com> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog Subject: [PATCH v2 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661385940; 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=3ANOEI0BBXDszhHsMjNjVkJxW2dSCbobxCznkiQMg0M=; b=R6nF2m1XOUp5IoGdH99rS9PXqLmFewCOZ0ErOuz0ibGPpEic+qj2puoImXf/QI4JEDCc5l xyq+oBpzvCd+dyiaatpUmXehe98/4uel1vNnkcRBM1BqeKPOpPRJCFNr+A4u9+U0knqW+g Kh08afwt1Qv6ziizf5hvyFLZcVYXe0c= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=M8tSmqMg; spf=pass (imf22.hostedemail.com: domain of 307wGYwgKCIY2rkuoovlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--shakeelb.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=307wGYwgKCIY2rkuoovlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661385940; a=rsa-sha256; cv=none; b=RXRbIFn+IqTELozHxfYBSGWdjO+C30Z1J4ZPtX7UK95FiGD6NDuZ1uqRrpiP80+2bVh4uy V5peeGvzIGAggyCnQLTXW/iKJBq59Wc3hfE6TDBP5p8YZT34HiDMZyQu74urFhQTJu3Idt HlKuGy9AQYv0xJmZ4RHWhPnyI/HCJbs= X-Rspamd-Queue-Id: 11712C0044 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=M8tSmqMg; spf=pass (imf22.hostedemail.com: domain of 307wGYwgKCIY2rkuoovlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--shakeelb.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=307wGYwgKCIY2rkuoovlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: c6dwagd7b3o9k6h8brhdp1msbf4m1mxj X-HE-Tag: 1661385939-451902 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. Though it does have impact on rstat flushing and high limit reclaim backoff. To evaluate the impact of this optimization, on a 72 CPUs machine, we ran the following workload in a three level of cgroup hierarchy. $ 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: Roman Gushchin Acked-by: Michal Hocko Acked-by: Muchun Song --- Changes since v1: - Updated commit message 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;