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 0C0EEC83F12 for ; Mon, 28 Aug 2023 20:03:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23F0E28001D; Mon, 28 Aug 2023 16:03:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF758E001E; Mon, 28 Aug 2023 16:03:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0907428001D; Mon, 28 Aug 2023 16:03:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EA9148E001E for ; Mon, 28 Aug 2023 16:03:54 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C39381A024A for ; Mon, 28 Aug 2023 20:03:54 +0000 (UTC) X-FDA: 81174589188.20.E1FFF65 Received: from mx0a-00190b01.pphosted.com (mx0a-00190b01.pphosted.com [67.231.149.131]) by imf20.hostedemail.com (Postfix) with ESMTP id 1EF111C0020 for ; Mon, 28 Aug 2023 20:03:51 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=akamai.com header.s=jan2016.eng header.b=d4DzzR5o; spf=pass (imf20.hostedemail.com: domain of sjayaram@akamai.com designates 67.231.149.131 as permitted sender) smtp.mailfrom=sjayaram@akamai.com; dmarc=pass (policy=quarantine) header.from=akamai.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693253032; 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: references:dkim-signature; bh=LV3ZDuAygTyD5BmlRtJxrKtQAjsnZ+ziAv8fIZ8jRig=; b=KbzyP/cLzsxwBrjy41MIqZo0gJEvQGwWsC7ZtFun6yiR3g7LKNLTYv6Zhqy0YnA+fo3iiN cGkiwL4M0f7ZhnY+8adSODGGfB01RT/xG1ycAqLFLHNXW5nf5wmEAkeLK/AIBwiiTt6ttV nlhohUzFuNNIU7xAQumM9PRKeEOirZA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=akamai.com header.s=jan2016.eng header.b=d4DzzR5o; spf=pass (imf20.hostedemail.com: domain of sjayaram@akamai.com designates 67.231.149.131 as permitted sender) smtp.mailfrom=sjayaram@akamai.com; dmarc=pass (policy=quarantine) header.from=akamai.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693253032; a=rsa-sha256; cv=none; b=y9fbTyDSIT4SKmE+B+egrMg4QxlEKC11W1s+tz9dS53wM3jKUzXqsE26Jrm0yiyGqnBZuC ErIABCg1e3tWO7qvHsFbqoxS7AmDHOdnIWKCSRbtQF/wN1DAo7EPGV0TTYbZRJX05smVS+ 5LSd0KhIpMRS+IUT130ajvTqVUtiOsM= Received: from pps.filterd (m0122333.ppops.net [127.0.0.1]) by mx0a-00190b01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37SJp4jD017116; Mon, 28 Aug 2023 21:03:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h= from:to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=jan2016.eng; bh=LV3ZD uAygTyD5BmlRtJxrKtQAjsnZ+ziAv8fIZ8jRig=; b=d4DzzR5oc3Y7CrmPdDb9q bmhCM20oPewZOpZQgfTeGTix1PHHwrAg3d8A81PVezRB31Ante0Ko6oy/1BFF+ai 0jyQVfGGopcHd/VjSCOigyZnGcK0wpZOhFZ3VsKGhK1Ni3QtTj3X+TqYBn10vEs2 +QVlI9akBFuSrA4elKh3tOUKE0yEc1jcnQSVvzUO1qf1Xr2nRlxikl6Cr+M59CVI +L8iuDkBXbRQrhMN+2M32SBgO8TOTvuBPuwxukGaS21UU4769p9m1KvE/DD7vU6r rkiylZx87ADEQvYLi/dCfHJhhgXqUQYYbGbSochLXJE4EW96nQAgbB3eGtbQGD0R w== Received: from prod-mail-ppoint1 (prod-mail-ppoint1.akamai.com [184.51.33.18] (may be forged)) by mx0a-00190b01.pphosted.com (PPS) with ESMTPS id 3sq8n8xfxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Aug 2023 21:03:38 +0100 (BST) Received: from pps.filterd (prod-mail-ppoint1.akamai.com [127.0.0.1]) by prod-mail-ppoint1.akamai.com (8.17.1.19/8.17.1.19) with ESMTP id 37SHdwfr007745; Mon, 28 Aug 2023 16:03:37 -0400 Received: from email.msg.corp.akamai.com ([172.27.91.23]) by prod-mail-ppoint1.akamai.com (PPS) with ESMTPS id 3sqcqwj9yx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Aug 2023 16:03:36 -0400 Received: from usma1ex-dag4mb8.msg.corp.akamai.com (172.27.91.27) by usma1ex-dag4mb4.msg.corp.akamai.com (172.27.91.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.16; Mon, 28 Aug 2023 16:03:36 -0400 Received: from usma1ex-dag4mb8.msg.corp.akamai.com ([172.27.91.27]) by usma1ex-dag4mb8.msg.corp.akamai.com ([172.27.91.27]) with mapi id 15.02.1258.016; Mon, 28 Aug 2023 16:03:36 -0400 From: "Jayaramappa, Srilakshmi" To: "linux-mm@kvack.org" , "shy828301@gmail.com" CC: "hannes@cmpxchg.org" , "ktkhai@virtuozzo.com" , "mhocko@suse.com" , "guro@fb.com" , "shakeelb@google.com" , "vbabka@suse.cz" , "akpm@linux-foundation.org" , "Hunt, Joshua" Subject: Performance implications of shrinking deferred objects proportional to priority Thread-Topic: Performance implications of shrinking deferred objects proportional to priority Thread-Index: AQHZ2eoia7K8QOl2skusBgs/14fIwA== Date: Mon, 28 Aug 2023 20:03:36 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.27.164.27] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-28_17,2023-08-28_04,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308280173 X-Proofpoint-ORIG-GUID: Kh7IWjDe0nKiaOQphGZhHf-l693hK1W2 X-Proofpoint-GUID: Kh7IWjDe0nKiaOQphGZhHf-l693hK1W2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-28_17,2023-08-28_04,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 spamscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 clxscore=1011 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2308280173 X-Rspamd-Queue-Id: 1EF111C0020 X-Rspam-User: X-Stat-Signature: ebr5soiekg5er7qrn48dgn1q6wezkg8m X-Rspamd-Server: rspam01 X-HE-Tag: 1693253031-195423 X-HE-Me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MuG+mw6hR8K8jCfZ0CqS4IWZUEVbdGyIMlz3sOPbNCeRebOsLgJRUxj3C7DqtL9gfR+XEsPQCpMrUFeYfhwuDyi5Tr0vHjlsWpcwDhgFY/11nLDPqDJrF+rdd6AW52QyMZCIehkDaRvtrehm4iRdYhga++UnxBO1QfQEHLeatiGjt/NRB8f02ll8jZLBYrNbMO/h4LD/Cs0LCe9MMyzEmEJCMTV7/JEjXS2XGaI1aqP56tzr9tpJwTquS0DVVMQ3lImKnoG5BcIJvE10QAsLcvozyUZIBA== 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: Hi all, While testing a 5.15.x kernel with one of our workloads we noticed a signif= icant drop in performance. We tracked down the cause to the linux commit 18= bb473e5031213ebfa9a622c0b0f8cdcb8a5371 "mm: vmscan: shrink deferred objects= proportional to priority". When=A0 the application enters direct reclaim i= t's not able to free up enough pages, so it enters the reclaim path more an= d more often, yet reclaims very little memory resulting in performance degr= adation. This is because the scan count is significantly scaled down, and w= ill not satisfy the condition to call the shrinker.=A0 static unsigned long do_shrink_slab(...) { ... total_scan =3D nr >> priority; ... while (total_scan >=3D batch_size || =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0total_scan >=3D freeable) { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned long ret; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 unsigned long nr_to_scan =3D min(batch_size= , total_scan); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 shrinkctl->nr_to_scan =3D nr_to_scan; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 shrinkctl->nr_scanned =3D nr_to_scan; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D shrinker->scan_objects(shrinker, sh= rinkctl); ... } } https://github.com/torvalds/linux/blob/8bb7eca972ad531c9b149c0a51ab43a41738= 5813/mm/vmscan.c#L692 Perf profile with the commit: Here we can see that the very high number of calls to page reclaim lead to = severe lock contention. Samples: 19K of event 'cycles', Event count (approx.): 574013142825 =A0 Overhead=A0 =A0 =A0 =A0Samples=A0 Symbol -=A0 =A015.10%=A0 =A0 =A0 =A0 =A0 3008=A0 [k] native_queued_spin_lock_slowp= ath=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0- native_queued_spin_lock_slowpath=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 - 12.20% __lock_text_start=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 =A0 =A0 =A0 =A0 =A0- 7.54% shrink_inactive_list=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 shrink_lruvec=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0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A0 =A0 =A0 =A0 =A0 =A0=A0 =A0 =A0 =A0 + 1.41% _raw_spin_lock_irqsave=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 +=A0 =A0 8.97%=A0 =A0 =A0 =A0 =A0 1722=A0 [k] copy_user_enhanced_fast_strin= g=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 +=A0 =A0 4.21%=A0 =A0 =A0 =A0 =A0 =A0823=A0 [.] tc_deletearray_aligned_noth= row=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 +=A0 =A0 3.35%=A0 =A0 =A0 =A0 =A0 =A0673=A0 [k] intel_idle Reverting the commit from the kernel resolved our issue. Here is the profil= e that looks good with the same test and the kernel sans the commit: +=A0 =A013.51%=A0 =A0 =A0 =A0 =A0 2721=A0 [k] intel_idle +=A0 =A0 7.93%=A0 =A0 =A0 =A0 =A0 1579=A0 [k] copy_user_enhanced_fast_strin= g +=A0 =A0 6.20%=A0 =A0 =A0 =A0 =A0 1165=A0 [.] tc_deletearray_aligned_nothro= w +=A0 =A0 3.21%=A0 =A0 =A0 =A0 =A0 =A0626=A0 [.] tc_calloc +=A0 =A0 2.94%=A0 =A0 =A0 =A0 =A0 =A0617=A0 [k] poll_idle +=A0 =A0 2.66%=A0 =A0 =A0 =A0 =A0 =A0501=A0 [k] native_queued_spin_lock_slo= wpath We added perf probes to do_shrink_slab() and obtained a record to get a pic= ture of the kind of numbers involved. An example from one of the traces : =A0 =A0 =A0 =A0kswapd0=A0 =A0530 [000] 55811.133435:=A0 =A0 =A0 =A0 =A0 =A0= vmscan:mm_shrink_slab_start: super_cache_scan 0xffff96be8cac6c10: nid: 0 ob= jects to shrink 592560 gfp_flags GFP_KERNEL cache items 332984 delta 650 to= tal_scan 1228 priority 10 =A0 =A0 =A0 =A0 =A0kswapd0=A0 =A0530 [000] 55811.133436:=A0 =A0 =A0 =A0 =A0= =A0 =A0probe:do_shrink_slab_59_0: (ffffffff86208fc0) shrinkctl=3D0xffff9e6= 0c172fcb8 shrinker=3D0xffff96be8cac6c10 priority=3D10 delta=3D0x28a total_s= can=3D1228 freeable=3D332984 nr=3D592560 batch_size=3D1024 =A0 =A0 =A0 =A0 =A0kswapd0=A0 =A0530 [000] 55811.133437:=A0 =A0 =A0 =A0 =A0= =A0 =A0probe:do_shrink_slab_59_1: (ffffffff86208fc7) shrinkctl=3D0xffff9e6= 0c172fcb8 shrinker=3D0xffff96be8cac6c10 priority=3D10 delta=3D0x28a total_s= can=3D1228 nr=3D592560 batch_size=3D1024 =A0 =A0 =A0 =A0 =A0kswapd0=A0 =A0530 [000] 55811.133438:=A0 =A0 =A0 =A0 =A0= =A0 =A0probe:do_shrink_slab_59_2: (ffffffff86208fca) shrinkctl=3D0xffff9e6= 0c172fcb8 shrinker=3D0xffff96be8cac6c10 delta=3D0x28a total_scan=3D1228 nr= =3D592560 batch_size=3D1024 nr =3D 592560 freeable =3D 332984 total_scan =3D 1228 priority 10 650 is the delta value coming from 332984 >> 10 =3D 325 325 * 4 =3D 1300 1300 /2 =3D 650 =3D 0x28a (if (shrinker->seeks) { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 delta =3D freeable >> priority; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 delta *=3D 4; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 do_div(delta, shrinker->seeks); ) 592560 >> 10 =3D 578 578 + 650 =3D 1228 So in this case 1228 is just barely above the batch_size of 1024. I had see= n kswapd run with priority 12 too, but it wasn't able to reclaim memory, so= its priority was bumped in balance_pgdat () { ... if (raise_priority || !nr_reclaimed) =A0 =A0 =A0 =A0 sc.priority--; ...=A0 } Our application's priority was constant at 12, so it rarely met the conditi= ons to be able to call the shrinker. I understand that the commit in question was made when Yang Shi was working= with trillions of deferred objects, but wonder if we should have a range o= f scaling, say a scale factor proportional to nr_deferred? We could perhaps= not scale the smaller numbers at=A0 all so that nr_deferred is not brought= down so low that it doesn't even let the process reclaim anything? I am no= t an expert in this area, so thought of sending you details of what we foun= d in our testing in case this is relevant to anyone. We will be happy to test any changes you suggest and collect data. Please l= et us know if there is any other information you'd like us to collect that = will help better understand the problem. Thanks Sri =A0 =A0=A0