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 C1923606A322 for ; Fri, 4 Dec 2026 11:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e91ljy/Y Received: by kanga.kvack.org (Postfix) id EC78A6B05B5; Fri, 4 Dec 2026 06:22:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E9EAE6B05B6; Fri, 4 Dec 2026 06:22:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB50E6B05B7; Fri, 4 Dec 2026 06:22:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BD7CD6B05B5 for ; Fri, 4 Dec 2026 06:22:13 -0500 (EST) Received: from smtpin03.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 57D661A032B for ; Fri, 4 Dec 2026 11:22:13 +0000 (UTC) X-FDA: 85506061746.03.515ECED Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf07.hostedemail.com (Postfix) with ESMTP id 9411640007 for ; Fri, 4 Dec 2026 11:22:11 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b="e91ljy/Y"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of ljs@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=ljs@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796383331; b=BQ192wQxrgCi2uuXxTR4WWabN9LpoOpiVIMkt1AldDZhtHw7DCJJPuAYdgP2JAtJuCB71W PavsMgP6ri7Drxkr2NjXjrld1jUimhbThL19ePwxJtq9XWvqVDxMN0jLLxA8EgNwmcnufu Ef/pYAPJHguc8vNSBJTA2elMfIilNAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796383331; 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=T5mlCcYR2P9c+Eaoea59WiT5hE4mxxwkCvVQHOBtC58=; b=rqguxQKDL+V0l9FfKTY0/ctuqTT1+g4Hv33QTuPjLb66v+TLWWVxUlhwzFpFIepJ5jKzvS 70pzSm3xAFvWNZ0rCvbUZ8m15i8UrdTDnDByGC4yN1Mj2AGQhNxYyGNRuvnAtgmdapoQHE XwYPHGydDlqgXmeFgySTIrXZeT12YNI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b="e91ljy/Y"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of ljs@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=ljs@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id F052942000; Fri, 4 Dec 2026 11:22:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F3B41F000C2; Fri, 4 Dec 2026 11:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796383329; bh=T5mlCcYR2P9c+Eaoea59WiT5hE4mxxwkCvVQHOBtC58=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=e91ljy/YhY6FXQiFJuoeqWFcnqgFSNCbAiLRgNcYIZpdwmp3NHxBJfpVAE983PZjD 6hq4m240ndFVch+AnMziSq1J+dsr8n9jbjeIzixpg2lxUG31RzBLdnEUTdjnLNQuUK /+/iqR7NCrMJkgnc04wvu6f4jwZmF3P6Fr74c5jKlZfAD/tAgSWjnTWGfFMirfsL+l 7rOT66hpvkiiefTmWC3yQ4iDFSsKEOcFnbFY7B1WLlLglXl1Itn9yQAbdD/i8NB1+4 7/8kKG4xJQEXY6m3IQrPMrEGmwOwsQFB0wRCW37+cKKsNEguTJdhoyNu7McuJoWfLA jJxCMs55NZWAQ== Date: Fri, 4 Dec 2026 11:21:59 +0000 From: "Lorenzo Stoakes (ARM)" To: Barry Song Cc: Zicheng Wang , Chuanhua Han , Suren Baghdasaryan , Andrew Morton , linux-mm@kvack.org, tao.wangtao@honor.com, zhangji1@honor.com, Yu Zhao , Kalesh Singh , Kairui Song , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , David Hildenbrand , liam@infradead.org, Vlastimil Babka , Mike Rapoport , Michal Hocko , Pedro Falcato , Jann Horn , Johannes Weiner , Jonathan Corbet , Shuah Khan , Randy Dunlap , linux-doc@vger.kernel.org, Matthew Wilcox , Hugh Dickins , Ridong Chen , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/5] mm/mglru: walk page tables under per-VMA locks Message-ID: References: <20261201131135.2914944-1-hanchuanhua@xiaomi.com> <20261204103856.71027-1-wangzicheng@honor.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam02 X-Rspam-User: X-Spam-Status: No, score=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Stat-Signature: 8e6rejn9ruhmq87g1xau1miw4xt7nofq X-Rspamd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F88dTJIR6mnA5kA2kZudHeKYQEJhrNx1ynefvUQEWk0rYrwsmtvlGY8uxUMh/9xGdEHttUgDc7wwlzMbol6WOb+2W4iiusUguoJi6mEFIGLchEWGhzI38OuPR7BClZttHTBmYNAydXWiySjePx/fWKgJ8C0Amh+B/ao/GURhaw4rQpTHN29Impmj0KSfrmszXUNc3XFTbTSit95+gyKIuVPlkmklsJ/uFk+YIYOVmXQ/1BCPhiHRBgB14rxbBNUkzzUVSUOjDy0cAdsKkecbjXcACIJ94gRyYsuK4aVr+4Pwkv3knynCE/six104YGJ/u6qOm6dOpKlL3vpRkGRHqAnO2ZGniW5dr6SYe0COjXXLm8je2RX7d09uEmsynU/dKYmknmm6Ddu1L8m3BS0lbjCzka/FW1zx5qmr/wkRzEkX6QP753IgIOG3jUUgmA32lrYQTV1LOiatS1t8GGNDtRQUeZ1DvCkbPcr9b3QUBQLosc7fhf6QtdvFW9p4FG4sJ0GrF2lFIwDS6341dQ== 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 Fri, Dec 04, 2026 at 06:43:33PM +0800, Barry Song wrote: > On Fri, Dec 4, 2026 at 6:39 PM Zicheng Wang wrote: > > > > Hi Suren, Chuanhua, Lorenzo, > > > > We hit the same stalls (140-250ms mmap/munmap/mprotect waits on > > SurfaceFlinger and Launcher) and have a measurement that may be > > relevant to the try_lock_next_vma() direction. > > > > In 3 dogfood user traces we picked for this problem, each with janky > > frames over 500ms, a direct reclaim task doing the aging walk holds > > mmap_lock for 140-250ms. Over 99% of that hold is spent runnable, > > waiting to be scheduled; the aging walk itself runs for less than 1ms. > > Each trace has thousands of direct reclaim events inside the jank window. > > > > A finer lock narrows who waits, but not how long. The walker runs with > > preemption enabled while holding the lock, so a round can be preempted > > mid-way and the lock is then held for the whole scheduling delay. > > > > Since the aging walk itself is already fast (<1ms), could we simply > > disable preemption during the walk's lock-hold window instead of > > changing the lock? We are testing a ~60-line prototype (no new lock or API) > > and will send the patch and data separately—mainly wondering whether > > you would prefer bounding that non-preemptible window at PUD or PMD > > granularity. > > Hi Zicheng, > > Disabling preemption for 1 ms is unlikely to fly upstream, as > that's simply too long. Now imagine 200 threads doing direct > reclaim, each in a different memcg. That could result in a > cumulative preemption-disabled time of 200 ms. Yup :) In general we don't disable preemption unless we have to, and in general I think when you look to a solution like this it's typically indicative that the abstraction level of the proposed fix is wrong, i.e. you're asking the wrong question :) IOW this suggests that holding the VMA lock is the right solution. Since (as I gather) Suren is looking to provide try_lock_next_vma() and update the BPF code to reflect this (Suren - let me know if this is accurate), I suggest you wait for this work. Another point to be cautious of here is that a pure-VMA lock walk of VMAs is very fiddly - you control nothing about what the _other_ VMAs are doing i.e. have no stability on that, so you may observe unexpected things in a traversal. Suren has written a lot about this into the VMA lock work around /proc/$pid/maps (in both comments and commit msgs and what is asserted in self tests) so I suggest having a look at that code in the meantime to assess what would need to be taken into account in this approach. -- Cheers, Lorenzo