From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131485; b=lheiYI+yZjuDy/J1zxb0oFd4ThwfK8EQ0kjW8/ullGb1GoUdIPP+vM6foP1fwC6P5pIF uYGcitT2/Rf4D7bEIiDBJnHdFBTE5abVC/vua2ApI4C3tMpLPfmmCOwpAlYuVfBzKPzNJ GtBtqiTNVL2JROi4r1Gwr3PAMFIlP93N4FErGP8SCIu+3KRtfChcf4TtyZRQv63awa6Ky ebZ1e7/M9fd2LbpeVEAs6GIEgDmhAfQtgkfCRq0l1RROySEcHIwwpGsI9G7DSI0hgsbRR 5CTEKFWcAraGPNCvVDzKjZcL7FuhYkjgYQL/0X4Ihf1lMvIBFAn7aqfyI1dcsxm+WYQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131485; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=i4ZKueFcjEPZMihAbe5n6ouVPP4fZwO1xDJZY345UDw=; b=uvVSWepuP700RCeAyp0wFI0hV1nNVrKpk2vDcOqJSLY2q41d+z17bLq2AsAWn9V91l66 Tqzuf+SNNm3bTTyp9tFLAj2hXErbwnEHYtbxCp5aE+IPpDHZqZKO88/IsLOgBpz0Pehk6 M4jmouuq7WMvxZti25XM6WEW1K35CqBxwlDtxMwNzgY7wAi+4iO0zTYf83WTcTmC8jjjq lcEuDrHc3A2anlptaujvY17CqDnBS5snJ4EBoAElYcTj0sT3OdTxC7bpAnaoUv15XXGvQ U+f88i8WQUxxJ22dz9pZ9nmDpB19UeM4lXj+hQWhScu8aIzSOtQE4QP8JULNpA8A0aQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ebbKIyN3; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DDE2606A325; Tue, 1 Dec 2026 13:24:45 +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=ebbKIyN3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB6201F0089F; Tue, 1 Dec 2026 13:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796131485; bh=i4ZKueFcjEPZMihAbe5n6ouVPP4fZwO1xDJZY345UDw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ebbKIyN32DBq+vuMVz+CoHXUWQU04RM0ynrcgObfFkMU4afqC3wJmhoouubwXtIcD mYMOLxY5w59363AfEmeYcl5d5A0OzSF5xPn1DvG4Q9zJsj3IQl0advp3lb19guCnCK 8czpA/bU3qPumGijYlPjqRXIRWAkb9xRlrAdcjTjcIqPYgpdBn+sEDy/FO/ct8ms6Y P/XvQMkBSL3vm8uANVMWVmxrlRPMuw169En09Z/TvHR8Bmg4GxTb0PvI4cOPb7A4CR dSiPf8ctvyngepEO6xbMC+7ZSB5ehsZBMZcmc0fRCcV5KQsonQvzgf1qm4G5CJmg6k 0i7xWRX03aOHA== Date: Tue, 1 Dec 2026 13:24:34 +0000 From: "Lorenzo Stoakes (ARM)" To: Chuanhua Han Cc: Andrew Morton , linux-mm@kvack.org, Kairui Song , Barry Song , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Suren Baghdasaryan , Pedro Falcato , Jann Horn , Johannes Weiner , Jonathan Corbet , Shuah Khan , Randy Dunlap , linux-doc@vger.kernel.org, Michal Hocko , Matthew Wilcox , Yu Zhao , Kalesh Singh , Hugh Dickins , Ridong Chen , linux-kernel@vger.kernel.org, Chuanhua Han Subject: Re: [RFC PATCH 1/5] mm/mmap_lock: add vma_start_read_rcu() helper Message-ID: References: <20261201131135.2914944-1-hanchuanhua@xiaomi.com> <20261201131135.2914944-2-hanchuanhua@xiaomi.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201131135.2914944-2-hanchuanhua@xiaomi.com> NAK. You're not doing this. Any of it, sorry. On Tue, Dec 01, 2026 at 09:11:31PM +0800, Chuanhua Han wrote: > A later patch makes the MGLRU aging walk lock VMAs one at a time instead > of holding mmap_lock for the whole mm. The walk only tries to read-lock > each VMA it finds under RCU, and skips the VMA if its lock is held for > write, rather than waiting for the writer. It does so in two places: No. > > - While iterating the VMA tree under RCU. > > - While holding a PTE lock, inside the RCU read side critical section > of pte_offset_map(), to hand the VMA lock off to the next VMA in > the same PTE table without dropping the PTE lock. Waiting there > could deadlock: a writer such as mprotect() takes the PTE lock > after the VMA write lock. > No. > vma_start_read() does not fit the second place, and is awkward in the > first. When it fails, it leaves the RCU read side critical section, > which the PTE table mapped by pte_offset_map() depends on, and the > iteration has to look the next VMA up again. If the VMA has been > recycled for another mm, it also mmdrop()s that mm, and __mmdrop() is > heavy enough that vma_start_read() already defers it until after RCU; > it should not run under a PTE lock either. lock_vma_under_rcu() and > lock_next_vma() build on vma_start_read() and, on failure, retry or > fall back to mmap_lock. The walk cannot open code the locking, which > relies on helpers private to mm/mmap_lock.c. NO. > > Move the body of vma_start_read() into __vma_start_read(), which stays > in the RCU read side critical section and returns the other mm through > @drop_mm instead of dropping it, and rebuild vma_start_read() on top > of it with the same behavior. No. > > Add vma_start_read_rcu() on top of __vma_start_read(). It returns NULL > both when the VMA cannot be locked and when it is detached, since the > walk skips it either way. The caller mmdrop()s the mm returned in > @drop_mm after dropping its spinlocks and leaving RCU, and, as with > any VMA found under RCU, checks that the locked VMA still covers the > range it expects. No. > > No functional change. Not true, you're creating a brand new API and expecting VMA maintainers to maintain it indefinitely. Also to give you free review time. > > Signed-off-by: Chuanhua Han No thanks. As VMA co-maintainer let me just make this simple - I am not interested in changes like this from unknown people, at all. Sorry. LLMs have changed the landscape. Do smaller changes first. I have no confidence you understand any of it. -- Cheers, Lorenzo