From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8418233947 for ; Tue, 28 Jul 2026 09:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785230844; cv=none; b=RARA7H/f77cs6yIn55runYQp2jNukQRIx5ROyUaBBcUV5vXok4cl2J1PBmyE72beezYXlIxSKC/TFscgN9PQQoEjQvROmIwQktuRgWzLAyd7VyYhxijd/QXPyZ8bXM7/iUTLMXJqEF/5JIAYVBSmTV8eVlxrL/Mvv8NqcDOAILg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785230844; c=relaxed/simple; bh=W7PoPP+c6aQU0s8hAt1IMkqo1UBalHCjZq4Wi9FK1uo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eIiHsNSBtML1fpDlG989Ixc+eVel7y2z9X5WCejWuQMOMeWx4AsM9t3R0uBcWDDncHjZyFRIeKxc+CNA2mYOVxKNtorzzPTUOv4vSSgCR7awUBTqYIyyRrGL3e5heR2XtmKpbuAFpwyJJ1DEmeNm5JHbhh5L4okct6th3xanWyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E3pj7Y2L; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E3pj7Y2L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A3981F000E9; Tue, 28 Jul 2026 09:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785230842; bh=vvFeSJ52Hy9OjYjsdGSFO6cUYL0PGqG3iOQEMzPpfqY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=E3pj7Y2L4G/RAxOBSkVa7jWXgajNAmVApyA0rgIkGqGmBAIt5qVRZtxwr6AchxN9D mkmB5xfNdfLsc6YOiqyuxBG4XTpVgbzDK/WLE4szFuS/rrrWdfAWTdSApSknzc8xTM WSCgwCDNFYL05fXY8DgC2jEfljAJY6P51Ffl3DDQIUseDDEGpdhtRCI7kkHtvmKnfx bU7fU0f0NQfTnt53UbhDCDrzmRhyPeVUZt8A+f4ZnbC2KLF3GMn4E+8tZEe6rMkEhh 2gRtv8yNE/JvegoBC7fvL0IosmwDzievIsJIfgF0XXYdXXkNYqXaMhpYhYjxMCNyzV DzpcrFuMCNaXA== Date: Tue, 28 Jul 2026 10:27:17 +0100 From: Will Deacon To: Yang Shi Cc: catalin.marinas@arm.com, ryan.roberts@arm.com, cl@gentwo.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ljs@kernel.org Subject: Re: [v8 PATCH] arm64: mm: show direct mapping use in /proc/meminfo Message-ID: References: <20260609214205.1260279-1-yang@os.amperecomputing.com> <255744ec-2a58-492c-a69a-850357440183@os.amperecomputing.com> <79d7069b-2895-4be3-a2a0-327ad3444bf3@os.amperecomputing.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <79d7069b-2895-4be3-a2a0-327ad3444bf3@os.amperecomputing.com> On Mon, Jul 27, 2026 at 12:50:59PM -0700, Yang Shi wrote: > On 7/22/26 4:31 AM, Will Deacon wrote: > > > Yes, it may race with memory hotplug. I missed memory hotplug for v7 > > > Sashiko. Two options to solve it: > > > > > > 1. Use atomic variables. Make lm_meminfo[NR_LM_TYPE] atomic_long_t, then > > > manipulate it with atomic ops. > > > 2. Protect it with a spin lock. > > > > > > The contention for the cache line or the spin lock should be rare since > > > memory hotplug should happen rarely. Any preference? > > I'd vote for keeping it simple and using a lock. Might be worth looking > > at the ongoing work from Lorenzo: > > > > https://lore.kernel.org/all/20260717-series-vmap-race-fix-v5-0-606a0ac6d3e5@kernel.org/ > > Thanks, Will. Took a look at Lorenzo's work. IIUC he used init_mm mmap_lock > to protect vmalloc area and linear mapping collapse on x86 in order to > serialize against ptdump. I don't think we should use init_mm mmap_lock. We > want to serialize linear mapping counter update between split and memory > hotplug, but neither of them takes init_mm mmap_lock. We can let them take > init_mm mmap_lock, but it sounds too overkilling. Hmm, but if split and hotplug don't take the mmap_lock, how are they serialised against ptdump? From what I understood, Lorenzo's patches change ptdump to take it for write in order to serialise against other walkers. Will