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 BE371C531DF for ; Fri, 23 Aug 2024 02:05:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E163180076; Thu, 22 Aug 2024 22:05:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC4BB80073; Thu, 22 Aug 2024 22:05:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C655380076; Thu, 22 Aug 2024 22:05:31 -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 A1D8080073 for ; Thu, 22 Aug 2024 22:05:31 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1F62380925 for ; Fri, 23 Aug 2024 02:05:31 +0000 (UTC) X-FDA: 82481868462.18.B6A3B4C Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by imf14.hostedemail.com (Postfix) with ESMTP id DBEF1100002 for ; Fri, 23 Aug 2024 02:05:27 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf14.hostedemail.com: domain of liuye@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=liuye@kylinos.cn ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724378668; a=rsa-sha256; cv=none; b=Yym8zHQnAlApeanbyc3b55LMZfSqguJvfbBdnrgHKDZ6Ujofxhd1UEs26MXSBGi+SN7GV9 4iS1QJvHBoaXptJq2fuxnp9oplRIeuKDR8clGFRn2p8IhpMWwW7QHIkXgRAvckx9U9J+wb EUwdh/edby5+FAixNwgBp/EnFvaPFZc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf14.hostedemail.com: domain of liuye@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=liuye@kylinos.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724378668; 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; bh=gawdFD03VAKym227Tn2fweZmbKncU8SNO5ltdy2csMI=; b=U4YgIgRpJTTDinHbIDm7WYsj1gg2daTsefmwpFbFoXD0i/8+gJnh0c4laDOQqJ3Zujq1VJ xctJcLD1TmLuMWy9AdeqniGizSYDSNB5SQ2RyJhPraXydt9UTOJMLjqHepcEy3j1/IHGZt nEshZMnHTOUzOOdZdk4TVdhwb7reFB4= X-UUID: 2479d9a660f411efa216b1d71e6e1362-20240823 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NO_NAME, HR_CTE_8B, HR_CTT_TXT HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME, HR_SJ_LANG HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM, HR_SJ_PHRASE, HR_SJ_PHRASE_LEN HR_SJ_PRE_RE, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT, HR_TO_NO_NAME IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_EXISTED, SN_EXISTED SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS, CIE_BAD, CIE_GOOD_SPF GTI_FG_BS, GTI_RG_INFO, GTI_C_BU, AMN_T1, AMN_GOOD AMN_C_TI, AMN_C_BU, ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38,REQID:5c323620-3870-4129-9d0e-6f41e4f965dc,IP:25, URL:0,TC:0,Content:0,EDM:0,RT:12,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:22 X-CID-INFO: VERSION:1.1.38,REQID:5c323620-3870-4129-9d0e-6f41e4f965dc,IP:25,UR L:0,TC:0,Content:0,EDM:0,RT:12,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:22 X-CID-META: VersionHash:82c5f88,CLOUDID:7e5ed1af1bca4fb18767e347eb49b346,BulkI D:240823100231TLMFDBFW,BulkQuantity:1,Recheck:0,SF:64|66|24|17|19|44|102,T C:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:40,QS:nil,BEC:nil, COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: 2479d9a660f411efa216b1d71e6e1362-20240823 X-User: liuye@kylinos.cn Received: from localhost.localdomain [(39.156.73.13)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 493916128; Fri, 23 Aug 2024 10:05:17 +0800 From: liuye To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, liuye@kylinos.cn Subject: Re: Re: Re: [PATCH] mm/vmscan: Fix hard LOCKUP in function isolate_lru_folios Date: Fri, 23 Aug 2024 10:04:43 +0800 Message-Id: <20240823020443.7379-1-liuye@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240815025226.8973-1-liuye@kylinos.cn> References: <20240815025226.8973-1-liuye@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D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Qfd6OeLvuO1PH7QZwf/+ DKetFbgX x//u9ns0BsCbZSeRMC1GlA/8js+mj6XQ5Tvs+G4VBEB3UwvAIevwYqANKoucZJDtyzI0WmG3In9vJsRSFlz4k4b0eOfU+YqkYRNDF 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: I'm sorry to bother you about that, but it looks like the following email send 7 days ago, did not receive a response from you. Do you mind having a look at this when you have a bit of free time please? > > > Fixes: b2e18757f2c9 ("mm, vmscan: begin reclaiming pages on a per-node basis") > > > > Merged in 2016. > > > > Under what circumstances does it occur? > > User processe are requesting a large amount of memory and keep page active. > Then a module continuously requests memory from ZONE_DMA32 area. > Memory reclaim will be triggered due to ZONE_DMA32 watermark alarm reached. > However pages in the LRU(active_anon) list are mostly from > the ZONE_NORMAL area. > > > Can you please describe how to reproduce this? > > Terminal 1: Construct to continuously increase pages active(anon). > mkdir /tmp/memory > mount -t tmpfs -o size=1024000M tmpfs /tmp/memory > dd if=/dev/zero of=/tmp/memory/block bs=4M > tail /tmp/memory/block > > Terminal 2: > vmstat -a 1 > active will increase. > procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu------- > r b swpd free inact active si so bi bo in cs us sy id wa st gu > 1 0 0 1445623076 45898836 83646008 0 0 0 0 1807 1682 0 0 100 0 0 0 > 1 0 0 1445623076 43450228 86094616 0 0 0 0 1677 1468 0 0 100 0 0 0 > 1 0 0 1445623076 41003480 88541364 0 0 0 0 1985 2022 0 0 100 0 0 0 > 1 0 0 1445623076 38557088 90987756 0 0 0 4 1731 1544 0 0 100 0 0 0 > 1 0 0 1445623076 36109688 93435156 0 0 0 0 1755 1501 0 0 100 0 0 0 > 1 0 0 1445619552 33663256 95881632 0 0 0 0 2015 1678 0 0 100 0 0 0 > 1 0 0 1445619804 31217140 98327792 0 0 0 0 2058 2212 0 0 100 0 0 0 > 1 0 0 1445619804 28769988 100774944 0 0 0 0 1729 1585 0 0 100 0 0 0 > 1 0 0 1445619804 26322348 103222584 0 0 0 0 1774 1575 0 0 100 0 0 0 > 1 0 0 1445619804 23875592 105669340 0 0 0 4 1738 1604 0 0 100 0 0 0 > > cat /proc/meminfo | head > Active(anon) increase. > MemTotal: 1579941036 kB > MemFree: 1445618500 kB > MemAvailable: 1453013224 kB > Buffers: 6516 kB > Cached: 128653956 kB > SwapCached: 0 kB > Active: 118110812 kB > Inactive: 11436620 kB > Active(anon): 115345744 kB > Inactive(anon): 945292 kB > > When the Active(anon) is 115345744 kB, insmod module triggers the ZONE_DMA32 watermark. > > perf show nr_scanned=28835844. > 28835844 * 4k = 115343376KB approximately equal to 115345744 kB. > > perf record -e vmscan:mm_vmscan_lru_isolate -aR > perf script > isolate_mode=0 classzone=1 order=1 nr_requested=32 nr_scanned=2 nr_skipped=2 nr_taken=0 lru=active_anon > isolate_mode=0 classzone=1 order=1 nr_requested=32 nr_scanned=0 nr_skipped=0 nr_taken=0 lru=active_anon > isolate_mode=0 classzone=1 order=0 nr_requested=32 nr_scanned=28835844 nr_skipped=28835844 nr_taken=0 lru=active_anon > isolate_mode=0 classzone=1 order=1 nr_requested=32 nr_scanned=28835844 nr_skipped=28835844 nr_taken=0 lru=active_anon > isolate_mode=0 classzone=1 order=0 nr_requested=32 nr_scanned=29 nr_skipped=29 nr_taken=0 lru=active_anon > isolate_mode=0 classzone=1 order=0 nr_requested=32 nr_scanned=0 nr_skipped=0 nr_taken=0 lru=active_anon > > If increase Active(anon) to 1000G then insmod module triggers the ZONE_DMA32 watermark. hard lockup will occur. > > In my device nr_scanned = 0000000003e3e937 when hard lockup. Convert to memory size 0x0000000003e3e937 * 4KB = 261072092 KB. > > #5 [ffffc90006fb7c28] isolate_lru_folios at ffffffffa597df53 > ffffc90006fb7c30: 0000000000000020 0000000000000000 > ffffc90006fb7c40: ffffc90006fb7d40 ffff88812cbd3000 > ffffc90006fb7c50: ffffc90006fb7d30 0000000106fb7de8 > ffffc90006fb7c60: ffffea04a2197008 ffffea0006ed4a48 > ffffc90006fb7c70: 0000000000000000 0000000000000000 > ffffc90006fb7c80: 0000000000000000 0000000000000000 > ffffc90006fb7c90: 0000000000000000 0000000000000000 > ffffc90006fb7ca0: 0000000000000000 0000000003e3e937 > ffffc90006fb7cb0: 0000000000000000 0000000000000000 > ffffc90006fb7cc0: 8d7c0b56b7874b00 ffff88812cbd3000 > > > Why do you think it took eight years to be discovered? > > The problem requires the following conditions to occur: > 1. The device memory should be large enough. > 2. Pages in the LRU(active_anon) list are mostly from the ZONE_NORMAL area. > 3. The memory in ZONE_DMA32 needs to reach the watermark. > > If the memory is not large enough, or if the usage design of ZONE_DMA32 area memory is reasonable, this problem is difficult to detect. > > notes: > The problem is most likely to occur in ZONE_DMA32 and ZONE_NORMAL, but other suitable scenarios may also trigger the problem. > > > It looks like that will fix, but perhaps something more fundamental > > needs to be done - we're doing a tremendous amount of pretty pointless > > work here. Answers to my above questions will help us resolve this. > > > > Thanks. > > Please refer to the above explanation for details. > > Thanks. Thanks.