From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C66D606A336 for ; Fri, 4 Dec 2026 11:00:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=AVEo01rE Received: by kanga.kvack.org (Postfix) id 289CD6B05B7; Fri, 4 Dec 2026 06:00:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 213546B05B9; Fri, 4 Dec 2026 06:00:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 101EE6B05BC; Fri, 4 Dec 2026 06:00:24 -0500 (EST) 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 974B36B05B7 for ; Fri, 4 Dec 2026 06:00:23 -0500 (EST) Received: from smtpin01.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D6A34A7CAC for ; Fri, 4 Dec 2026 11:00:22 +0000 (UTC) X-FDA: 85506006684.01.0ABC0CF Received: from mta1.migadu.com (out-35.mta1.migadu.com [95.215.58.35]) by imf18.hostedemail.com (Postfix) with ESMTP id 58C341C0015 for ; Fri, 4 Dec 2026 11:00:20 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=AVEo01rE; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf18.hostedemail.com: domain of ridong.chen@linux.dev designates 95.215.58.35 as permitted sender) smtp.mailfrom=ridong.chen@linux.dev ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796382021; b=vhonYDMl1xso7jai+aYCQSYPHi9NmOqocBi95Lz7Bl1eXVHwO7Hi1PHlBlnV36k3qDMI4A d2/3jjbtgspUs5TodzsxUq2OQk84Rt1mLjBrOoR8inTKvLjcNDHn0zs9xdvegHpVLTn/cP 1lmfsRJGGvEM8LM1T3K7mM03NoZfiCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796382021; 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=jbWw2gGoR2MT1oN1bwIhriG+7EZGblBCUb4/RYJHG6Y=; b=2hsLzFeDy3ymBJJjcAISb8YHXTnbpUizeEMzzMjrhh6kTFhXTl1RfbROsOoFlM5tembVkx dsO1OfdDdmLBVwv5mBZsyIUlBxylDxG8FWXcIXjxvoMkoL4BSivlSgBQILwgNBT+Aqah9C HeDC47SQoQuvKK2BnDkfJuXQmW/aAcs= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=AVEo01rE; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf18.hostedemail.com: domain of ridong.chen@linux.dev designates 95.215.58.35 as permitted sender) smtp.mailfrom=ridong.chen@linux.dev X-Envelope-To: linux-mm@kvack.org DKIM-Signature: a=rsa-sha256; bh=/o0h1vH5mynApsLWbCSnc7EAnxQjVsgXctryldBkLsQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796382015; v=1; x=1796986815; b=AVEo01rE07TqPfl6I+8d/y/Oe74Sh5m/G6Ow7TWAXaAVQkXqcOwGHZiJosqH8Bt3xWesoc7W CPh8RL3ozEL909eJx2ha9x5yGh5v1FhvhdDIEaZWxAz2Rc5mrBFVt6k+eMaZStLam/o0VZPHTqs +TJFG8vSg6/dl/M8ow4F0Zjo= X-Envelope-To: linux-mm@kvack.org Received: by smtp.migadu.com with ESMTPS id 2abd01b9599f7b44; Fri, 04 Dec 2026 11:00:12 +0000 X-Mizu-Trace-ID: 2abd01b9599f7b44 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Fri, 4 Dec 2026 19:00:04 +0800 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/2] mm/mglru: shorten the lru_lock hold time in scan_folios() To: Barry Song Cc: Kairui Song , Andrew Morton , David Hildenbrand , Johannes Weiner , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , "open list:MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU)" , Ridong Chen References: <20261127060315.1119672-1-ridong.chen@linux.dev> <42195463-c50b-4f80-ad2c-ecc106e4c2ae@linux.dev> From: Ridong Chen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Stat-Signature: w5ajiem5eibjw88edsg1cg1prxczcg8y X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_PASS,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 58C341C0015 X-HE-Tag: 1796382020-950032 X-HE-Meta: U2FsdGVkX1/jDWBKeZwI2zuCS2KyrqN7MZEE6oBsZJp5Le9kNVYFlrHe6g/p1gxs5Tp1ibOK9/pryq9TUSSaYOnZejZLwCq5e3IFl2Flyoed8C7SepunHnwUW440SfZeYe8OlyhbIeqdyNycEqZi0P1+IIBL9fyXfQ1jM/5pBbRhYNQ87Fy+fT6S5YuKyo9EmNBIhpFHUKA5lJ7CeLsu1/M9mARjSwlzVEWH2uICSIwYDIXk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jDmsfs1SOb4pqMbrPnNqHngoR6ZfV1+LglXIo70D5HCcC1/fT8C1p/bOVa1e1ufp5zaYE5JLFtAcWbHesGXtqWGbhkNM+q8MshSey8L78G0mMYXpF/EgfvoRT80goJpUTV1elDVAjAqR/ncyakahtjAw3JVYPLIjaBqZxQIS7SaWASfCBEJpbPoFmm6AbufZMgARC7V2ZpNmOZCrroqon2zJPT/8sldUH1RLLb8hDcGGETYOA2KXXJGG8jsy5+qA/oW5oOdBGYRbGB2SE= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 12/4/2026 6:51 PM, Barry Song wrote: > On Fri, Dec 4, 2026 at 6:36 PM Ridong Chen wrote: > [...] >>> >> >> Hi Kairui, >> >> Sorry for the late reply. >> >> I've been looking at MGLRU direct reclaim tail latency on Android. >> When many tasks enter direct reclaim at the same time they pile up on >> the same memcgs and slow each other down [1], so the time spent under >> lru_lock matters there. >> >> To check the prefetch on arm64, I ran the same kind of microbenchmark >> on an 8-CPU tablet: random 4K pread() on files 3x the memcg limit, >> one thread per CPU, all threads in one memcg, base and patched >> interleaved in one boot, 5 rounds each. Reads per second per thread: >> >> threads base prefetch >> 1 180688 +1.5% >> 2 189663 +2.0% >> 4 181787 +3.2% >> 6 168018 +3.8% >> 8 146523 +6.1% >> >> From 4 threads on, every round was faster, and there was no regression >> with 1 thread. > > I think this one-line change is fine if the data supports it. > Usually, though, this kind of optimization warrants an explanation > at the microarchitectural level, for example, using the top-down > analysis model to identify where the CPU stalls. > > I assume prefetching reduces memory-bound stalls, but what I don't > quite understand is why it provides a greater benefit in > multithreaded workloads. Could this be due to increased cache > contention and more frequent cache evictions? > The benchmark is concurrent reclaim on one memcg: all threads reclaim from the same lruvec and serialize on lruvec_lock_irq(). The prefetch shortens the critical section in scan_folios(), so the gain is in how long the other reclaimers wait for the lock, not in the reclaimer itself. With one thread nobody waits, so there is no change. With more threads, the more of them wait, the bigger the gain. > Would it be possible to perform a top-down analysis [1], at least > on x86 if that's easier, to gain a deeper understanding of the > performance improvement? > > [1] https://github.com/andikleen/pmu-tools > > Thanks, > Barry -- Best regards Ridong