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 0C153C2BD09 for ; Fri, 12 Jul 2024 06:18:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 776B46B0089; Fri, 12 Jul 2024 02:18:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FF656B0092; Fri, 12 Jul 2024 02:18:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 578956B0095; Fri, 12 Jul 2024 02:18:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 348E86B0089 for ; Fri, 12 Jul 2024 02:18:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D32841407B2 for ; Fri, 12 Jul 2024 06:18:40 +0000 (UTC) X-FDA: 82330096800.25.5015F6E Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by imf06.hostedemail.com (Postfix) with ESMTP id 50CB5180014 for ; Fri, 12 Jul 2024 06:18:38 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=S8stf53E; spf=pass (imf06.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.10 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=1720765084; 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=g9m+qdPmLDicGU/8/HIZiRP0e1aT4Jl139mRjNYQjQc=; b=N66i3baX57+RP4QYG1pJ5aPq1qXFOSvqViubakluM7XytbHiu2Okps9yI7C60ZzyFq+2i/ RdRccHLP/ZSP1cFy8nheFzqbO7z3LbhUKgW3Rbru4TTL0hwoSwT9I34qd7jO9FmcgzQ4Tj /W/md4xDAXi3gm06SkVAf/EWiuw5VCw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720765084; a=rsa-sha256; cv=none; b=7thv8P1TimEdEhwupZnOviyfgePujarl2IiCEgaAX3+4V4Z75eGQoNe9q7de4LSY2gzzLH kb/RxC7ImsZOUpRP8aUjn8gA8X0NfxVwCxGsEfQDxTsXEwdEvSUdYgBy9HJH1QpKlRImsX DCEbxicnrTY+Ulg7ncFPd7Cmog4ThIw= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=S8stf53E; spf=pass (imf06.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720765119; x=1752301119; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=Oi/FYY+IWw3gRTikxKgJSU421lfC2/Tmz2QeAmFtpTo=; b=S8stf53Eb4Z2TvwoMI0RL4diZZxqcSff1fOe98z7jn7+CrJkt1jkB9za mwLXI27NSVWCW7nRva+qcQ0z71qw2lnXodA3GAWfgyFvMoTik1Djczj/g ef74Bu9jsOH9nYsJcpkXGlV03o0AGr6fxTwysbAcDXP53Qj4F/gWNGjBN DWnKxCOmIAc/i1Y/r59mrhe3jtL+NOT9WRgjrGS5d1UTrzFzuHg2Gg8FN KFFBeK5XnQHZhDUHK5ds9jKqTYu+LqDrRFa01tfLY6wV6SWjBcTLUXT0j WxuKtduQLJ0lVLRkqWYMx453HauukwLxZeDME3j9DYmhd2B+gPGM54Z/w g==; X-CSE-ConnectionGUID: OwLJObUhR3CtBOtSyd0g4Q== X-CSE-MsgGUID: JO4p/7uaTcKnqrJ3VweKuw== X-IronPort-AV: E=McAfee;i="6700,10204,11130"; a="35621581" X-IronPort-AV: E=Sophos;i="6.09,202,1716274800"; d="scan'208";a="35621581" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2024 23:18:37 -0700 X-CSE-ConnectionGUID: K9QdavFhT++W2WYz1Ih1SA== X-CSE-MsgGUID: 0iBP0LW+QkW4/hkn9rPNzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,202,1716274800"; d="scan'208";a="53733077" Received: from unknown (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2024 23:18:35 -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 13:41:26 +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> <87h6cv89n4.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Fri, 12 Jul 2024 14:16:44 +0800 Message-ID: <87cynj878z.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-Stat-Signature: se5mhkwg1et5kwt9w84s7kd4fdmbi71o X-Rspamd-Queue-Id: 50CB5180014 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1720765118-755682 X-HE-Meta: U2FsdGVkX199UrKEGDrXepLtPe5qHW9wb1Bc3t2Ntr61lyCnj2FR7AZsFsnai2Pk/oenSGYRkGP8LpoVDzjeLgeUyMusMsZVAL6asyP2DmhpMgJx44Vu4OpyGBwF9QPgCUJw7oQ4Za5/r4/RCjk1Ef1m5GW0WXdKYj2hYyhUy2CQ54XV/q7KJdFT/uTyeHKJS2oNNWNsSa0OWsDZeWUzySYee4K0zC3Ku94TnWV2Ogthzv+D3SXGdFV4QSJSwKJHMx4lv8wx0pRKGQs0Rv6hRgZwVzLkLRue/a5SyEsnrh6BsgasQahiW4XQE/0hgbn50EnSD4AId8AgW7mbXjji4zPKgrmSs1M8OlulXhUwST9eTam0FmfmNCm2K7oq2spBAHP3ISjQhtsmm2vlXrB79SZH+NNhW2gX75klBODTxczKtyRow3KNJR4wzSChybZL2i1CW3/EG86jxt1QvzrA2X08RYDoSRGYF1jqGPvrJ/iWA4nxWgWcC8g2vH3M5HkbWvF/QZPLzB2fNnTbyr5DDraPtyivoJZJIAf8UZEVw9dtUCRsx+xVSfnxFmwg9Oy7lHPtSpvZm1q35l/0hLJn3s+r/IkWWixr9cIxQbm8S9tdIUmJl5WgtCkC0JglG25sAZQL8FPwliHFVfemD/utfp18Pw6Ya1naQRTJZeGokV++IQVTDhbIA4ohhrGhwH3pVBoX5DXmCIJGHoUFKjqIKkg67wNMME0B4nfxvX8P6AEv0h8z38MvTr0eY/yiWPZ7AVBl340aSamRzlZL+7XwDE+a+GGrA8FEsfIgbWpB/6MT92O775QgFPLkBEbopSJeFwTLnH9NsiH+4ZLzmDcWrwcWp1KCbMq0EIZCA4fDQuwq18tEx7UqJfO94q/yDsiSCoMu3v8Qt3qGGuePvwg68Gjp+IR0MzfEVF+cWApOFkC81vhCum3n1GDu1KVIFrFE54GIfizbeSfHzrvkS2P PRiTH/jR OijUL8nVtq/6BB0S8xtVQo69+B4Hx4r9AKJoKTNlePclFE98u5IL5H8PFfwUKDi82pLdshH7q9iud2eiAtkqejDTvD8i34ltjmGi94OvVSFbL8mt4QtZzrpQzn4ADleMcyJUAtlqFqC+2OyNbzeySfEZg9rVZfofZ7bTeGlQEUIUmcTX127S5FrYjuitGR+COSjLwGhI1uPu0K1/H+mOiNaGtdW5IvyDJkmkDbu/8TV6VkFhDp1PgBjHbbJUaBe1O2Lonu9ma/NZs8drLSrzyDZgwdW2M6iAGFjDtmsqk5xXlZzZZ90IB343fqg== 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: List-Subscribe: List-Unsubscribe: Yafang Shao writes: > On Fri, Jul 12, 2024 at 1:26=E2=80=AFPM Huang, Ying wrote: >> >> 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 pose= s challenges for >> >> >> >> >> >> >> > quickly experimenting with specific workloads in a p= roduction environment, >> >> >> >> >> >> >> > particularly when monitoring latency spikes caused b= y contention 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 understa= nd that kernel >> >> >> >> >> >> >> configuration isn't as flexible as sysctl knob. But, = sysctl knob is ABI >> >> >> >> >> >> >> too. >> >> >> >> >> >> >> >> >> >> >> >> >> >> > To ultimately mitigate the zone->lock contention iss= ue, several suggestions >> >> >> >> >> >> >> > have been proposed. One approach involves dividing l= arge zones into multi >> >> >> >> >> >> >> > smaller zones, as suggested by Matthew[0], while ano= ther entails splitting >> >> >> >> >> >> >> > the zone->lock using a mechanism similar to memory a= renas and shifting away >> >> >> >> >> >> >> > from relying solely on zone_id to identify the range= of free lists a >> >> >> >> >> >> >> > particular page belongs to[1]. However, implementing= these solutions is >> >> >> >> >> >> >> > likely to necessitate a more extended development ef= fort. >> >> >> >> >> >> >> >> >> >> >> >> >> >> Per my understanding, the change will hurt instead of = improve zone->lock >> >> >> >> >> >> >> contention. Instead, it will reduce page allocation/f= reeing latency. >> >> >> >> >> >> > >> >> >> >> >> >> > I'm quite perplexed by your recent comment. You introdu= ced a >> >> >> >> >> >> > configuration that has proven to be difficult to use, a= nd you have >> >> >> >> >> >> > been resistant to suggestions for modifying it to a mor= e user-friendly >> >> >> >> >> >> > and practical tuning approach. May I inquire about the = rationale >> >> >> >> >> >> > behind introducing this configuration in the beginning? >> >> >> >> >> >> >> >> >> >> >> >> Sorry, I don't understand your words. Do you need me to = explain what is >> >> >> >> >> >> "neutral"? >> >> >> >> >> > >> >> >> >> >> > No, thanks. >> >> >> >> >> > After consulting with ChatGPT, I received a clear and comp= rehensive >> >> >> >> >> > explanation of what "neutral" means, providing me with a b= etter >> >> >> >> >> > understanding of the concept. >> >> >> >> >> > >> >> >> >> >> > So, can you explain why you introduced it as a config in t= he beginning ? >> >> >> >> >> >> >> >> >> >> I think that I have explained it in the commit log of commit >> >> >> >> >> 52166607ecc9 ("mm: restrict the pcp batch scale factor to av= oid too long >> >> >> >> >> latency"). Which introduces the config. >> >> >> >> > >> >> >> >> > What specifically are your expectations for how users should = utilize >> >> >> >> > this config in real production workload? >> >> >> >> > >> >> >> >> >> >> >> >> >> >> Sysctl knob is ABI, which needs to be maintained forever. C= an you >> >> >> >> >> explain why you need it? Why cannot you use a fixed value a= fter initial >> >> >> >> >> experiments. >> >> >> >> > >> >> >> >> > Given the extensive scale of our production environment, with= hundreds >> >> >> >> > of thousands of servers, it begs the question: how do you pro= pose we >> >> >> >> > efficiently manage the various workloads that remain unaffect= ed by the >> >> >> >> > sysctl change implemented on just a few thousand servers? Is = it >> >> >> >> > feasible to expect us to recompile and release a new kernel f= or every >> >> >> >> > instance where the default value falls short? Surely, there m= ust be >> >> >> >> > more practical and efficient approaches we can explore togeth= er to >> >> >> >> > ensure optimal performance across all workloads. >> >> >> >> > >> >> >> >> > When making improvements or modifications, kindly ensure that= they are >> >> >> >> > not solely confined to a test or lab environment. It's vital = to also >> >> >> >> > consider the needs and requirements of our actual users, alon= g with >> >> >> >> > the diverse workloads they encounter in their daily operation= s. >> >> >> >> >> >> >> >> 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 tha= t the >> >> >> > default value is also suboptimal. What is the issue with this >> >> >> > approach? >> >> >> >> >> >> Firstly, this is a system wide configuration, not workload specifi= c. >> >> >> 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 producti= on >> >> > 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. F= or >> >> >> example, we need to use different configuration on different syste= ms >> >> >> otherwise some workloads will be hurt. Can you provide some evide= nces >> >> >> to support your change? IMHO, it's not good enough to say I don't= know >> >> >> 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 the= ir >> >> > 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 differ= ent >> >> 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? > > 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 :-) > > That is not how the real world works. > > In the real world: > > - No one knows what may happen in the future. > Therefore, if possible, we should make systems flexible, unless > there is a strong justification for using a hard-coded value. > > - Minimize changes whenever possible. > These systems have been working fine in the past, even if with lower > performance. Why make changes just for the sake of improving > performance? Does the key metric of your performance data truly matter > for their workload? These are good policy in your organization and business. But, it's not necessary the policy that Linux kernel upstream should take. Community needs to consider long-term maintenance overhead, so it adds new ABI (such as sysfs knob) to kernel with the necessary justification. In general, it prefer to use a good default value or an automatic algorithm that works for everyone. Community tries avoiding (or fixing) regressions as much as possible, but this will not stop kernel from changing, even if it's big. IIUC, because of the different requirements, there are upstream and downstream kernels. -- Best Regards, Huang, Ying