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 BBA05C2BD09 for ; Fri, 12 Jul 2024 07:06:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FA4E6B0089; Fri, 12 Jul 2024 03:06:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AA086B008A; Fri, 12 Jul 2024 03:06:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 072336B0092; Fri, 12 Jul 2024 03:06:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D911A6B0089 for ; Fri, 12 Jul 2024 03:06:31 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 85785A13CD for ; Fri, 12 Jul 2024 07:06:31 +0000 (UTC) X-FDA: 82330217382.07.0927DFD Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by imf14.hostedemail.com (Postfix) with ESMTP id 018AF100018 for ; Fri, 12 Jul 2024 07:06:27 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="jYwWcJr/"; spf=pass (imf14.hostedemail.com: domain of ying.huang@intel.com designates 192.198.163.16 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=1720767944; 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=ljkiluVCjHQKE/Dzk5ZR+5FsDTWJrw/fNlGNOGslBpI=; b=l/pEB/FLmsw+YGozGLB3Z8I2q2cBYpQ2uCcfm+mOxobLYz2W9ni5dzEqL9IGvqITnswQWU Byezfy2l907WWZ2f0XCV7UFwsVIk+kmMN6F6kNutTuNnL9lZ6Wgz7DlkgodcB59c73wFPc 5zwXmnUiCddw0dHqmBbLHWBkHkKPEbo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="jYwWcJr/"; spf=pass (imf14.hostedemail.com: domain of ying.huang@intel.com designates 192.198.163.16 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=1720767944; a=rsa-sha256; cv=none; b=vG8rvXOQPrZxn8aczhxKHIsAWcG1YwcbRKS8nBCpxCtLnGf9TKwpan5L5Ia/lg0+ewyO9e whMvwOeS7aM/Z+ZKWphKO7iNvPqSgQgMOEnD4rCd9yB1FqkUX1lKlvVMDK3rKJxCh4UzJa Gr7nC0+9Hxyt9CLd+y8wygE42mvh/w0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720767988; x=1752303988; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=3MsseWmOvEZV7X+5kdU3Qjk0RANQHlZEzeI06U5JxVA=; b=jYwWcJr/HF1s/4t1+HgeUPlAPXKbAAHAUAqelP4oBWCjSwqV1Rjgaw8O x5UytP689KeOCfaLJd1rH3amn3XyixQ8/7i/2uuu5kZ44Umvl36cGAtF+ BFB2O7yG3SWlNIqPcE0IOpLtwCzxkTUkfBU7vgwkgXUgcUtwdLK0Dbw6Z ZYAKrnl3NcqTMPzbGSfxRo7NON7tN0X/0V+IhPQOH7RXLjl0M1I87fRRe QWklObZJV+G7SQAqjYP2cPI2e0Xa1+2Kmcpq+NUZzU9aSVx8xAObW0T0A v4Emn/Bqql8TJ2uEYownO0N8cFLLBD3BQ/ZMhT2ERbqxZOTxtzga2j+c/ w==; X-CSE-ConnectionGUID: ErDJNepsQmy/wLg6FCAO4A== X-CSE-MsgGUID: s09WiUnNQs2JQDJoro6PrQ== X-IronPort-AV: E=McAfee;i="6700,10204,11130"; a="12515655" X-IronPort-AV: E=Sophos;i="6.09,202,1716274800"; d="scan'208";a="12515655" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2024 00:06:27 -0700 X-CSE-ConnectionGUID: /UZwpl9OS/SoYg12OFjYbA== X-CSE-MsgGUID: KJLlNslfRLKWdkZPuhaPiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,202,1716274800"; d="scan'208";a="79936082" Received: from unknown (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2024 00:06:25 -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 14:41:17 +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> <87cynj878z.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Fri, 12 Jul 2024 15:04:33 +0800 Message-ID: <874j8v851a.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: 018AF100018 X-Stat-Signature: 6mabsy43tdhjpp63o4o1jf6a8tqjzaec X-Rspam-User: X-HE-Tag: 1720767987-176261 X-HE-Meta: U2FsdGVkX18REc1O8C57278SBEln/BX9sVUPwBtlfa2bw0BHuh/1Um0B+Jw8sbTyVLBm/ZpAsvo2iXErspvvs0Je5xW0Wkp/H1F1W+ESVa4qmPYTSskmfyvgnmolEya8FJgwGqdbfWxmFiwxF/p/pJzMfADPHZSzEQVsu3L2qehnGw7XXVXCQ+PD/4oDmND0g7RPjz5un06kdQ0lis9zvkpc8SyuGEmndT66NpsqAHqANb+c04jESZbvxsBaRsIxdYRTNkGfazbmEyFX02sK4PozHjCAaifXJtWc7SjwQ2s+wrTWJ14+gYhrpZxRvrBoUT3s9iGzbAx5Pr/2LmC/g3EJ3W3M1lSYUx0UnKmg2DlAB4oA+YdojUhRBXOP7qjdRb4x5hT/bQUm7ubRR9KcGhTKDYzCboayuLScw0zP1PKfgE44XHHQEuSWETiSaaFrEEz+kbP+S01xTJuSrD5/40/iqAZRGTyub3kY1d+1LTU3ZwnlGsV5Q4/dbDSq6fwGiGudcWXtLy9myKacx6gvVev5b3jgAOFKstE+yj4+vPMj7PIBcY7rY9mscBsfY1QC+ViCBm5AMEzDb+iAcwMLjbCW25xZbA7o/VseHkAKCs5rG19ll5Pl6pvABTZlob/XBOCgyDH+bdEtx56BH+y/qQk98sgel26TKBu8TQx5LQQQfUB/YBcbXRP4vqzd+i1ZpZpzc7aG2Svy/Obn9R3MCj/uMogklP8pYxFz2cJ2e5hDkpQPFR8gQtCx+AvOvVyMblx5uVBLUcrU2Dp+UVkzhE1cLLTsJSWcRqqv4MSbKEl44w8s6SjVcNkZJeF/bV9EDEPbS2RTlU4h59gthtETUlEPYTcTXTogoKU93nYtYefGdWcIdqSDpdnIZOXtmYkf+UhyhhR9+TkYa7vy+vb9zslIHo0ayKSd+rKPFzvadvaU7qbwmvnJ0BF704jqM1wCIhgwKnKM8ZAQzv1oYx/ 9qaS4rTx b2HrsS8s4uC+8E4zPfQBOXZ5N16mmhd6+PWjFgotoeeQNo3SO4s18zLsRyDJzZ5CnaZxVgVyk7V5JrD4cssG+X8aLLlkPqg4KsA1ZmHLz/3ajFyYjowOR2IGJ/PU02tKA4zUduAAG1FMuVZrY/wVtA+TlID6xLsHUx/Mr+7iAaF/F+EdJ8gARQYLv+LHig6Vf9vkNDWn2v4jZtj79LaVdz1io3+dQPZWme3mxkCS+q5C+ez0rYPGZv0A3oj2TWjTFHGqQ+l1JKd2EUYWst9/ehnrDJQG4UpA7QCmVyyHvQEx6ENkWi2OQ9iooPw== 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 2:18=E2=80=AFPM Huang, Ying wrote: >> >> 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 p= oses challenges for >> >> >> >> >> >> >> >> > quickly experimenting with specific workloads in = a production environment, >> >> >> >> >> >> >> >> > particularly when monitoring latency spikes cause= d by contention on the >> >> >> >> >> >> >> >> > zone->lock. To address this, a new sysctl paramet= er vm.pcp_batch_scale_max >> >> >> >> >> >> >> >> > is introduced as a more practical alternative. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> In general, I'm neutral to the change. I can under= stand that kernel >> >> >> >> >> >> >> >> configuration isn't as flexible as sysctl knob. Bu= t, sysctl knob is ABI >> >> >> >> >> >> >> >> too. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > To ultimately mitigate the zone->lock contention = issue, several suggestions >> >> >> >> >> >> >> >> > have been proposed. One approach involves dividin= g large zones into multi >> >> >> >> >> >> >> >> > smaller zones, as suggested by Matthew[0], while = another entails splitting >> >> >> >> >> >> >> >> > the zone->lock using a mechanism similar to memor= y arenas and shifting away >> >> >> >> >> >> >> >> > from relying solely on zone_id to identify the ra= nge of free lists a >> >> >> >> >> >> >> >> > particular page belongs to[1]. However, implement= ing these solutions is >> >> >> >> >> >> >> >> > likely to necessitate a more extended development= effort. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Per my understanding, the change will hurt instead = of improve zone->lock >> >> >> >> >> >> >> >> contention. Instead, it will reduce page allocatio= n/freeing latency. >> >> >> >> >> >> >> > >> >> >> >> >> >> >> > I'm quite perplexed by your recent comment. You intr= oduced a >> >> >> >> >> >> >> > configuration that has proven to be difficult to use= , and you have >> >> >> >> >> >> >> > been resistant to suggestions for modifying it to a = more user-friendly >> >> >> >> >> >> >> > and practical tuning approach. May I inquire about t= he rationale >> >> >> >> >> >> >> > behind introducing this configuration in the beginni= ng? >> >> >> >> >> >> >> >> >> >> >> >> >> >> 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 c= omprehensive >> >> >> >> >> >> > explanation of what "neutral" means, providing me with = a better >> >> >> >> >> >> > understanding of the concept. >> >> >> >> >> >> > >> >> >> >> >> >> > So, can you explain why you introduced it as a config i= n the beginning ? >> >> >> >> >> >> >> >> >> >> >> >> I think that I have explained it in the commit log of com= mit >> >> >> >> >> >> 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 shou= ld utilize >> >> >> >> >> > 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 valu= e after initial >> >> >> >> >> >> experiments. >> >> >> >> >> > >> >> >> >> >> > Given the extensive scale of our production environment, w= ith hundreds >> >> >> >> >> > of thousands of servers, it begs the question: how do you = propose we >> >> >> >> >> > efficiently manage the various workloads that remain unaff= ected by the >> >> >> >> >> > sysctl change implemented on just a few thousand servers? = Is it >> >> >> >> >> > feasible to expect us to recompile and release a new kerne= l for every >> >> >> >> >> > instance where the default value falls short? Surely, ther= e must be >> >> >> >> >> > more practical and efficient approaches we can explore tog= ether to >> >> >> >> >> > ensure optimal performance across all workloads. >> >> >> >> >> > >> >> >> >> >> > When making improvements or modifications, kindly ensure t= hat they are >> >> >> >> >> > not solely confined to a test or lab environment. It's vit= al to also >> >> >> >> >> > consider the needs and requirements of our actual users, a= long with >> >> >> >> >> > the diverse workloads they encounter in their daily operat= ions. >> >> >> >> >> >> >> >> >> >> 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 val= ue to 0. >> >> >> >> > For other workloads, we keep it unchanged until we determine = that the >> >> >> >> > default value is also suboptimal. What is the issue with this >> >> >> >> > approach? >> >> >> >> >> >> >> >> Firstly, this is a system wide configuration, not workload spec= ific. >> >> >> >> 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 worki= ng in >> >> >> > your lab environment, while I'm struggling with real-world produ= ction >> >> >> > 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 sy= stems >> >> >> >> otherwise some workloads will be hurt. Can you provide some ev= idences >> >> >> >> to support your change? IMHO, it's not good enough to say I do= n't know >> >> >> >> why I just don't want to change existing systems. If so, it ma= y 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 dif= ferent >> >> >> batch number and how in your production environment? If you canno= t, how >> >> >> do you decide which workload deploys on which system (with differe= nt >> >> >> 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.TCPSlowStartRetra= ns, >> >> > TcpExt.TCPFastRetrans, TcpExt.TCPOFOQueue, and more. >> >> > >> >> > In instances where a problematic container terminates, we've notice= d 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 optimizati= on >> >> > 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 unforese= en >> >> > 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 expa= nd >> >> > 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 fo= r 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 mak= e 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. > > You mean the Upstream Linux kernel only designed for the lab ? > >> >> 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. > > Please explain to me why the kernel config is not ABI, but the sysctl is = ABI. Linux kernel will not break ABI until the last users stop using it. This usually means tens years if not forever. Kernel config options aren't considered ABI, they are used by developers and distributions. They come and go from version to version. >> >> IIUC, because of the different requirements, there are upstream and >> downstream kernels. > > The downstream developer backport features from the upsteam kernel, > and if they find issues in the upstream kernel, they should contribute > it back. That is how the Linux Community works, right ? Yes. If they are issues for upstream kernel too. -- Best Regards, Huang, Ying