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 D46D5C2BD09 for ; Fri, 12 Jul 2024 05:27:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E32F96B0088; Fri, 12 Jul 2024 01:27:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBC286B0089; Fri, 12 Jul 2024 01:27:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0F4F6B008A; Fri, 12 Jul 2024 01:27:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9F77A6B0088 for ; Fri, 12 Jul 2024 01:27:01 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3C59E16092E for ; Fri, 12 Jul 2024 05:27:01 +0000 (UTC) X-FDA: 82329966642.17.D7DBBC8 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by imf09.hostedemail.com (Postfix) with ESMTP id 5879814001F for ; Fri, 12 Jul 2024 05:26:58 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Zj7WdmNA; spf=pass (imf09.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.9 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720761974; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=B0gPpG21k2plwKYkKOHInO0Y5nTMD5+18dViKVlWCz4=; b=j6NP4603AmAGUmyNAErcY3DMLc08WXrwW8D8z42AduHg7vp2yyN5UXf0B8hxJOxfONsaPJ s5gqDScwAE4SJcIsD9zp5ez6Jzj5gZyuXtqdY/kaj9CLNXex2vXAh9Yta7asEUvrf1/bpc 0khhL+602GhXcO4ZsXp+DCoLwvosZN8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Zj7WdmNA; spf=pass (imf09.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.9 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720761974; a=rsa-sha256; cv=none; b=erWvh2eq9MJoWoPTK5H/8VPGFSF4APdXChGlRKvznDk4u5arhV85yTYhps+JdTfO12Ta+Q wLuLn6othJWzGmSt5rsr8AF8zQbzaIAszbme4GLeraQbR38YUdx7U+WLmWyKsErHjF1cqP AB5g7XXpuvXmACY9dLB0xx+KvA72FcQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720762019; x=1752298019; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=9U9Gf8Hi0MYblGenZBvRfhjQ1evkaewDUljGi9ZqX7U=; b=Zj7WdmNAPn25OsX5is4u7DOP8Yfuxxenn9Yy3MVAYXYqu89DWem8cloc DCa2fiq5Kde2NiuGyn2KAXHK5NVaYDReugowFabkOBOlp/V+2CHtO+PAU i8IxXdHbaxgUkHwMqTMQOl1cX0pckEzj1fshuA2oBFFWWzMKitK8trsEs h4NQn7nHlX7NVWkXApgS84FPzVkslpgoLCNG5P2zrd2YRc9J0fbZYOU2E cg3AvwXp3YDa0Kz4HEhA4ejDBeNOd9OZPNgx52XeiIiG5+pGiTw4mfONC opHA/HTNGxvYso1yqaNQc30aoYcxsdTT1LyrYpqLZEf9a6X/qy0NRrnhE Q==; X-CSE-ConnectionGUID: 0Uu5A9DlRbGXgugxZcxbNA== X-CSE-MsgGUID: QEWRib9CQQuKZXOnl71bSA== X-IronPort-AV: E=McAfee;i="6700,10204,11130"; a="40710119" X-IronPort-AV: E=Sophos;i="6.09,202,1716274800"; d="scan'208";a="40710119" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2024 22:26:57 -0700 X-CSE-ConnectionGUID: RSNz855WTqquRazqNQqydQ== X-CSE-MsgGUID: jZv0QLdiRBOZQ9ISMchNJg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,202,1716274800"; d="scan'208";a="49560386" Received: from unknown (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2024 22:26:55 -0700 From: "Huang, Ying" To: Yafang Shao Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, linux-mm@kvack.org, Matthew Wilcox , David Rientjes Subject: Re: [PATCH 3/3] mm/page_alloc: Introduce a new sysctl knob vm.pcp_batch_scale_max In-Reply-To: (Yafang Shao's message of "Fri, 12 Jul 2024 11:44:16 +0800") References: <20240707094956.94654-1-laoar.shao@gmail.com> <20240707094956.94654-4-laoar.shao@gmail.com> <878qyaarm6.fsf@yhuang6-desk2.ccr.corp.intel.com> <87o774a0pv.fsf@yhuang6-desk2.ccr.corp.intel.com> <87frsg9waa.fsf@yhuang6-desk2.ccr.corp.intel.com> <877cds9pa2.fsf@yhuang6-desk2.ccr.corp.intel.com> <87y1678l0f.fsf@yhuang6-desk2.ccr.corp.intel.com> <87plrj8g42.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Fri, 12 Jul 2024 13:25:03 +0800 Message-ID: <87h6cv89n4.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5879814001F X-Stat-Signature: xzugz84h3b5mtuckow7djdg7buccx4oa X-Rspam-User: X-HE-Tag: 1720762018-998705 X-HE-Meta: U2FsdGVkX1+/CKdxleLsauEYEdb/aRPSCnNutMQtAAHWXKhofiIbquaS8hv7cQPWUshAFUaxSzhG2rWyd+h8GwyoRWpyII9Gs0YGoaw3rGGsDW3rvwkPHEzpotf1+uB0rTt3XJuWUPjwPQRmkahlFKHnMlTjHEaQaEL2SShwKIBGWpNmE8M0slqXv3crhq1Usa81XflxsAboZisVoSdvDJo4XGU8zE7pRQFkg+605Dt3FpLJf/v00ksPl7F2SnAzPT91UIjjvqbW09j4/SNHa6tpoGWxD6FOHOrjb+bVDKYHSsO03vQU3mqqp1M2kiT5HJAw4hfVr5QNF3ojLSgzRc2fKIQ3QYMvjkcaQDjwmnmXVSpesLQwTjmk4l7GqSrkKyn1lbKUY0+4ma8NkWapCPwgsfaikvEwezXBLlHRzWHXM6bxdHJWGsFPFrtG7JxgNrkCLv1e3Ow4H1n+xf3HTTXSHbt1y3qAVeIJL28FnnjC4qOdoWcdS3yAlcf6kqcj77SMfVH18RVEmA5V+Xt7ay/tDT5Vn5VssHTJ3HT3tlrdp504iQwZR1/yWz78J8l9G6ufuyGwqJ8YrRm6ekKYmc76NcAMVOofSkFBOSriNyl8rl4Q9QrQa+BUcXqhRxA7PLTmXMXMQGZAUIyeG0fIdtobiCz3x8pxNQd5GywaKXVeXHt0Y8vjPA8spWFyqd10iw+cvRYBKUXXgASzsp824sLbrrjVz0vXyO8HLthKuAKWjsP5fFY5LJ73JWk8prRRbv5EYOjl7c6aAjo3aqftbXLTw+QcPbXtPcyEt4kZCsCzlmtctcz7/oKCGopgUe6VwathYAz8i8RiVMHDAvE9B48Z3n8xAHS7LYN0c9mZKOOOeP5QpxCQts2LXKZnMChpFVVejVDTOb3caRS6nfdpWCwO8k7mNzACa9wG+M3Ar8fvhq28Zq9JqwMozgCJjHJbMMo6Pdn1aNugsnZrd78 pW7MUWMD xDwcSQyF3E4yYgAcWSLE0ZxBfQ2cDPKjB8YuDhvaHCnqeasGIFXjw3IHiS74mhLW3v3lUEQwdeBorPmyJ/0E8W8/61miwmRZQJRzMn6qEYWZuoEZE/ItEhuzr3DInNaMWhbhOnOF3OIyQaS+Aw+/HAcHTiAI1UZK3XbCESWtg9Zxgcr6w2F45lvIQtLvm+wwT1OJRqz7U171AjkuO0/4rrjADrExnZjlYrO+/KoZ2CrGcQeuCpcIA4pao5BYiOQJLaQTn5bi1TdQuy6Zx1aNJ6UIhyt6Zq0FimuhpqRUOoDRvKfeh0I+96Ewzag== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Yafang Shao writes: > On Fri, Jul 12, 2024 at 11:07=E2=80=AFAM Huang, Ying wrote: >> >> Yafang Shao writes: >> >> > On Fri, Jul 12, 2024 at 9:21=E2=80=AFAM Huang, Ying wrote: >> >> >> >> Yafang Shao writes: >> >> >> >> > On Thu, Jul 11, 2024 at 6:51=E2=80=AFPM Huang, Ying wrote: >> >> >> >> >> >> Yafang Shao writes: >> >> >> >> >> >> > On Thu, Jul 11, 2024 at 4:20=E2=80=AFPM Huang, Ying wrote: >> >> >> >> >> >> >> >> Yafang Shao writes: >> >> >> >> >> >> >> >> > On Thu, Jul 11, 2024 at 2:44=E2=80=AFPM Huang, Ying wrote: >> >> >> >> >> >> >> >> >> >> Yafang Shao writes: >> >> >> >> >> >> >> >> >> >> > On Wed, Jul 10, 2024 at 10:51=E2=80=AFAM Huang, Ying wrote: >> >> >> >> >> >> >> >> >> >> >> >> Yafang Shao writes: >> >> >> >> >> >> >> >> >> >> >> >> > The configuration parameter PCP_BATCH_SCALE_MAX poses c= hallenges for >> >> >> >> >> >> > quickly experimenting with specific workloads in a prod= uction environment, >> >> >> >> >> >> > particularly when monitoring latency spikes caused by c= ontention on the >> >> >> >> >> >> > zone->lock. To address this, a new sysctl parameter vm.= pcp_batch_scale_max >> >> >> >> >> >> > is introduced as a more practical alternative. >> >> >> >> >> >> >> >> >> >> >> >> In general, I'm neutral to the change. I can understand = that kernel >> >> >> >> >> >> configuration isn't as flexible as sysctl knob. But, sys= ctl knob is ABI >> >> >> >> >> >> too. >> >> >> >> >> >> >> >> >> >> >> >> > To ultimately mitigate the zone->lock contention issue,= several suggestions >> >> >> >> >> >> > have been proposed. One approach involves dividing larg= e zones into multi >> >> >> >> >> >> > smaller zones, as suggested by Matthew[0], while anothe= r entails splitting >> >> >> >> >> >> > the zone->lock using a mechanism similar to memory aren= as and shifting away >> >> >> >> >> >> > from relying solely on zone_id to identify the range of= free lists a >> >> >> >> >> >> > particular page belongs to[1]. However, implementing th= ese solutions is >> >> >> >> >> >> > likely to necessitate a more extended development effor= t. >> >> >> >> >> >> >> >> >> >> >> >> Per my understanding, the change will hurt instead of imp= rove zone->lock >> >> >> >> >> >> contention. Instead, it will reduce page allocation/free= ing latency. >> >> >> >> >> > >> >> >> >> >> > I'm quite perplexed by your recent comment. You introduced= a >> >> >> >> >> > configuration that has proven to be difficult to use, and = you have >> >> >> >> >> > been resistant to suggestions for modifying it to a more u= ser-friendly >> >> >> >> >> > and practical tuning approach. May I inquire about the rat= ionale >> >> >> >> >> > behind introducing this configuration in the beginning? >> >> >> >> >> >> >> >> >> >> Sorry, I don't understand your words. Do you need me to exp= lain what is >> >> >> >> >> "neutral"? >> >> >> >> > >> >> >> >> > No, thanks. >> >> >> >> > After consulting with ChatGPT, I received a clear and compreh= ensive >> >> >> >> > explanation of what "neutral" means, providing me with a bett= er >> >> >> >> > understanding of the concept. >> >> >> >> > >> >> >> >> > So, can you explain why you introduced it as a config in the = beginning ? >> >> >> >> >> >> >> >> I think that I have explained it in the commit log of commit >> >> >> >> 52166607ecc9 ("mm: restrict the pcp batch scale factor to avoid= too long >> >> >> >> latency"). Which introduces the config. >> >> >> > >> >> >> > What specifically are your expectations for how users should uti= lize >> >> >> > this config in real production workload? >> >> >> > >> >> >> >> >> >> >> >> Sysctl knob is ABI, which needs to be maintained forever. Can = you >> >> >> >> explain why you need it? Why cannot you use a fixed value afte= r initial >> >> >> >> experiments. >> >> >> > >> >> >> > Given the extensive scale of our production environment, with hu= ndreds >> >> >> > of thousands of servers, it begs the question: how do you propos= e we >> >> >> > efficiently manage the various workloads that remain unaffected = by the >> >> >> > sysctl change implemented on just a few thousand servers? Is it >> >> >> > feasible to expect us to recompile and release a new kernel for = every >> >> >> > instance where the default value falls short? Surely, there must= be >> >> >> > more practical and efficient approaches we can explore together = to >> >> >> > ensure optimal performance across all workloads. >> >> >> > >> >> >> > When making improvements or modifications, kindly ensure that th= ey are >> >> >> > not solely confined to a test or lab environment. It's vital to = also >> >> >> > consider the needs and requirements of our actual users, along w= ith >> >> >> > the diverse workloads they encounter in their daily operations. >> >> >> >> >> >> Have you found that your different systems requires different >> >> >> CONFIG_PCP_BATCH_SCALE_MAX value already? >> >> > >> >> > For specific workloads that introduce latency, we set the value to = 0. >> >> > For other workloads, we keep it unchanged until we determine that t= he >> >> > default value is also suboptimal. What is the issue with this >> >> > approach? >> >> >> >> Firstly, this is a system wide configuration, not workload specific. >> >> So, other workloads run on the same system will be impacted too. Will >> >> you run one workload only on one system? >> > >> > It seems we're living on different planets. You're happily working in >> > your lab environment, while I'm struggling with real-world production >> > issues. >> > >> > For servers: >> > >> > Server 1 to 10,000: vm.pcp_batch_scale_max =3D 0 >> > Server 10,001 to 1,000,000: vm.pcp_batch_scale_max =3D 5 >> > Server 1,000,001 and beyond: Happy with all values >> > >> > Is this hard to understand? >> > >> > In other words: >> > >> > For applications: >> > >> > Application 1 to 10,000: vm.pcp_batch_scale_max =3D 0 >> > Application 10,001 to 1,000,000: vm.pcp_batch_scale_max =3D 5 >> > Application 1,000,001 and beyond: Happy with all values >> >> Good to know this. Thanks! >> >> >> >> >> Secondly, we need some evidences to introduce a new system ABI. For >> >> example, we need to use different configuration on different systems >> >> otherwise some workloads will be hurt. Can you provide some evidences >> >> to support your change? IMHO, it's not good enough to say I don't kn= ow >> >> why I just don't want to change existing systems. If so, it may be >> >> better to wait until you have more evidences. >> > >> > It seems the community encourages developers to experiment with their >> > improvements in lab environments using meticulously designed test >> > cases A, B, C, and as many others as they can imagine, ultimately >> > obtaining perfect data. However, it discourages developers from >> > directly addressing real-world workloads. Sigh. >> >> You cannot know whether your workloads benefit or hurt for the different >> batch number and how in your production environment? If you cannot, how >> do you decide which workload deploys on which system (with different >> batch number configuration). If you can, can you provide such >> information to support your patch? > > We leverage a meticulous selection of network metrics, particularly > focusing on TcpExt indicators, to keep a close eye on application > latency. This includes metrics such as TcpExt.TCPTimeouts, > TcpExt.RetransSegs, TcpExt.DelayedACKLost, TcpExt.TCPSlowStartRetrans, > TcpExt.TCPFastRetrans, TcpExt.TCPOFOQueue, and more. > > In instances where a problematic container terminates, we've noticed a > sharp spike in TcpExt.TCPTimeouts, reaching over 40 occurrences per > second, which serves as a clear indication that other applications are > experiencing latency issues. By fine-tuning the vm.pcp_batch_scale_max > parameter to 0, we've been able to drastically reduce the maximum > frequency of these timeouts to less than one per second. Thanks a lot for sharing this. I learned much from it! > At present, we're selectively applying this adjustment to clusters > that exclusively host the identified problematic applications, and > we're closely monitoring their performance to ensure stability. To > date, we've observed no network latency issues as a result of this > change. However, we remain cautious about extending this optimization > to other clusters, as the decision ultimately depends on a variety of > factors. > > It's important to note that we're not eager to implement this change > across our entire fleet, as we recognize the potential for unforeseen > consequences. Instead, we're taking a cautious approach by initially > applying it to a limited number of servers. This allows us to assess > its impact and make informed decisions about whether or not to expand > its use in the future. So, you haven't observed any performance hurt yet. Right? If you haven't, I suggest you to keep the patch in your downstream kernel for a while. In the future, if you find the performance of some workloads hurts because of the new batch number, you can repost the patch with the supporting data. If in the end, the performance of more and more workloads is good with the new batch number. You may consider to make 0 the default value :-) > [0] 'Cluster' refers to a Kubernetes concept, where a single cluster > comprises a specific group of servers designed to work in unison. -- Best Regards, Huang, Ying