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=1796202616; b=fR60bnT3py76IXV+aPyGlCmuK30bFKG+j9btYAlnFJsfZjYA1XN/UqdJHkex0zO6em0+ w/yJZNzXJMV0CUff5nmwUbiIG6wXRwuqEi6uy/wbsl/bnmNQlFJdm7gvef3xrt3Hp8fkH 9+Fllfvdkqlb15Hl/mV2OsGF91VLys8WB2XK2PfHjedFF46VuZGXrPh7cdae/YV/Eox+E V8RcHhOkYe9llN2bhXFFL805MXUpmiVgQJte/8wu74+cdFEMH5g8P7Ng5N5RsI2JWWZ+L L55Y+mFivHchn9oxE6/ap2Y9M/q66M//c310vy9I731P4L3l7aQcYeBatgMT8/ILIDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796202616; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=Bw10SYMKPt1gB8ppufeHIVOieKYi5CfZ+OdNqK2ig+I=; b=GSdupjncYa/YIzcHAV8PAswEWgGTtmV0wtM12w1EJTqYyDXy1q5yXQN05OHVE977KQEg fJzjuWeemLWS6bvzQJtX9ms7OuPXcaAPEJKdZ7FrMy2FbW6Rf+4V9i6vOZZSCWT1p5jnq nU7ldcscSerUadAwsusoahd48XHq0ddK14tQ0TbXpa3JFvmv0OhefmEMcRqfLDh3I9FE/ rMMJWj5+uKsADeKv06R9wBFbgxt4LTr7O4wxDy+UATkI/M5kEkLDf0COEElcrXXHo8sY5 ZkgxQdumLpYG156cX3FQM+rxJAiRpDExmzuROAuWTQgC4PS+EulCMKVevEusGn49X4w== 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=ZRO5SuVC; 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 3B260606A325; Wed, 2 Dec 2026 09:10:15 +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=ZRO5SuVC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68DA71F000C1; Wed, 2 Dec 2026 09:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796202615; bh=Bw10SYMKPt1gB8ppufeHIVOieKYi5CfZ+OdNqK2ig+I=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ZRO5SuVCVWm+TeItxyu3o2rPeeMNRh3b1Ujy8MJpFnqO6lNbxinkPTKanntiZwhnr GTzwIdGBHVTaFG0VSSIYMe1vdxon+6rnpCJqTpzdZa87uMV3GvSXOK5e05IvDrQwIP C7xvBAnCy4k+DcZPZXlXfJ27dBlQczjM1P+CBgJ72uK1ZmcC3I6KaAQOgFVwpRj4QS +UChoE30LmZfxg8nwXQWT2PTzd4CCU4M+iIpIEsk+e7QS1o4K27Wf6LfITTYIdwcHb kc0WWX7P0V2JjI8bvk3Y7Rc5SfkXVSJfId0IeSeV6G/IOlPQbAbMuRlzmnpeodLhf9 3VAJ2cCvIeIXA== Date: Wed, 2 Dec 2026 09:10:08 +0000 From: "Lorenzo Stoakes (ARM)" To: Suren Baghdasaryan Cc: chuanhua han , 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 , 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-kernel@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Dec 01, 2026 at 06:49:55PM -0800, Suren Baghdasaryan wrote: > On Tue, Dec 1, 2026 at 5:24 PM chuanhua han wrote: > > I did use an AI assistant for this series and should have said so, sorry. I'll start with smaller MGLRU patches. Thank you, I appreciate your candour! > > > > The mmap_lock waits behind the MGLRU walk do cause frame drops on our > > phones, so I'd still like to fix that at some point. If the MGLRU > > maintainers have a preferred direction, I'm happy to hear it. > > I looked ahead at what you are doing later in the patchset and yeah, > that's definitely not something I'm comfortable with. Lockless VMA > walks are quite complex, just look at the lock_next_vma() > implementation. Speaking of which, from a quick look at your > walk_trylock_next_vma(), I think it might have been much easier to add > an option for lock_next_vma() to not fall back to mmap_lock, which I > think would have been enough to fit your usecase. I didn't spend much > time exploring that direction but it might be a much simpler change. Yeah I agree making a version of lock_next_vma() that doesn't fallback makes sense, but I think best way is to model it on the BPF user, i.e. replace the open-coded work there with a variant that permits it. Then obviously others who have a use for it can do so. Maybe try_lock_next_vma(), since lock_next_vma() is trying to guarantee a lock either way? > > Also a side-note about drop_mm part in this patch. In [1] Lorenzo > recently changed vma_start_read() to use mmdrop_async(), so that > "mmdrop() is a heavy operation" thing does not apply anymore. Yup :) > > [1] https://lore.kernel.org/all/20261124-vma-read-lock-mmdrop-async-v1-1-257f99f551de@kernel.org/ -- Cheers, Lorenzo