From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E95A330F94B for ; Sat, 27 Jun 2026 08:23:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782548640; cv=none; b=OW76r3jzhE544jHWYZ69O6NCGcUTnkqMIyz2YyH0eozUX+rsRod7nnVLdAZezfJiBB4maOWBBlrl0N+Yl8sBWv4CjgnpVV8/QzKImQRW7gEQOpM2jk92PyrDNxxW1arUB5ZK9Cf9VayoUD+9P2h6KdI1enMighNHp9wLGrvmddI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782548640; c=relaxed/simple; bh=pHyJuhYl/jaNnPl2SnkFl+8Jum7fL0oJDja08WRHig4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P2p5iME+ZsSh7dC7BRKhLIPpyN3ysDtTFTzcJVNn2++FAAH9YLljIEqgAJyIZo4q2KmZ1CAhcKTezqPfpnaS0qWjpFyAQHoiYlUNaSTzNuAKrGV9to/MRQprKMkwey3F5OAHk5vdLKj3owuT/iqAJ1n6AoTKz0DII8OlfNy3i94= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=H0gmiNq9; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="H0gmiNq9" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-92120eb916aso183576485a.1 for ; Sat, 27 Jun 2026 01:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1782548638; x=1783153438; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=qcCGwXLwtMV8RI4Wg+2Z1TCVKqOFak4eb3FLVCz7QhM=; b=H0gmiNq9AqOzXQOuybjVrCS0AKwAZb5Jqy+zMpxbmye02eq4Z8XXqpfaGCq9/ZX4Ei j+nrZlQJG0fU54EudXDJ6UGxCHG+CVViqhcDa691/nae0XsboPhYRqmFbOE+LwAqx1aR MSpd01uUr/2w4Y131lwNGqT3PXh6XfezPAhsjgEjh/cHvYSOtjbX7M+r7hOuhccEt2Mw icWwrdGQFol8w8fLemh+IuIUgANtMJgrr2i+NhbSDYjBnPZK3TdeC+pd+9SE5Fbcpwq3 GzMTl0aHPk9jPBpX0hWStkHZOaadWWKU26ePs/CaXZXXY/N1NJ5nwu+iv5J/U0A8mCV3 /BNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782548638; x=1783153438; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qcCGwXLwtMV8RI4Wg+2Z1TCVKqOFak4eb3FLVCz7QhM=; b=dI8Uop76K+C1kAUc3YB6F7eQFImGFuRIVINc8DWbjdFnPmQfD7DA8+1BmrxtKAx2sY //6MN1czP14jrstMgdsTBjqRmgks0FINhYpAIyMudbEp1DELbCcrHfz2hab0phI8bpLW g6hLl43BPN9RzYbqTceJC00H8VJaZf4IOFRq6T1uj2bWQCi92x+e6fD3nuR8JefEYH9P l+8gnIcFLmeRjx2XCa0Ax8FvnY52CGrimcxDAcKyc1v8ZF72cg3TrgX9JrRlJkfnKQp5 R2aAaOWErf0+eVF/bqX/zY8SYlj1NkJ7WKtsT5aE8Gw/8eAft6FalIm+oEODuiQoQWy0 Qtig== X-Gm-Message-State: AOJu0YwSxZgZc7G1qP3FJfI6m97jrGsnl7t2nJBnS/TypKENyTHdypqp Akw9dmN7/er67k88+DReabYtOOnnVcMZvaL7mCjfkUAj7Dh/5SSsAEdsVyUNGqQgY9OUmNY7ZBB HjYBw X-Gm-Gg: AfdE7ck3wR1dDqOOjjdt+tTlq6MG0yxaIJjFhCZWFSfRO7mgESyKH+VHVmY/nVQ2bjp WQuygwQCEn6xqPk5zDL8WMLMPMqBqUmFlTb7nh54zN2qHeDL2PvaAIVTUn3Z7Fg0pTyMfeBxcAR /fxuWrY5oAUpCqwaMg14Gx1SjbafE0Z49/1aPrPOOKmpmWtvB0CiebIkytHiFH06zLKCUE8qJ5a aptLUHz+4lBriN43Re6+sXfnZS8aBvU/BMSDnKVpnXHD1S/mIjVysU4vNuZ5bqO8XcyR2PzIlj9 6h/aE+OjYdhZt+xhZTI9qt7NBL83kXjx2askHYbwZyFR8cU4HlF4pVE1P8wBebkZsA2xehWE/Dz Cj9Sg1vSaXvuykPAVFvefg5r7IhqeK280OJF6pgt7R19EY8TRyq/p1rbNzpBNjPRHP2Al1aVd05 gq8xTdTBaEKfhhgEU2sMYogSOfqiPsWEhPghtJrzOcCZsCt8FiG8AYBbUGdWVCWXNIFfK7RpviX Uc22Qg= X-Received: by 2002:a05:620a:28d3:b0:915:f163:a8 with SMTP id af79cd13be357-9293d0ba9a5mr1471270785a.53.1782548637840; Sat, 27 Jun 2026 01:23:57 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-926004ac1b8sm1375302685a.36.2026.06.27.01.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2026 01:23:56 -0700 (PDT) Date: Sat, 27 Jun 2026 04:23:52 -0400 From: Gregory Price To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, kernel-team@meta.com, akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, osalvador@suse.de, hannes@cmpxchg.org, mgorman@techsingularity.net, stable@vger.kernel.org Subject: Re: [PATCH] mm/vmstat: flush per-cpu node stats when a node goes offline Message-ID: References: <20260627073107.523499-1-gourry@gourry.net> 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: <20260627073107.523499-1-gourry@gourry.net> On Sat, Jun 27, 2026 at 03:31:07AM -0400, Gregory Price wrote: > > /* > * all memory/cpu of this node are removed, we can offline this > - * node now. > + * node now. Fold any pending per-cpu vmstat diffs into the global > + * counters first: once the node leaves the online set the periodic > + * fold skips it, orphaning the residual on a later online. > */ > + sync_vm_stats(); Sashiko points out this can deadlock on concurrent cpu hotplug, which after a quick look seems accurate. Has also made me realize the sync code is also racy with cpu hotplug as well as it iterates per-online-cpu. There are probably more races like this out there. Will need to give this a little more thought. > node_set_offline(nid); > unregister_node(nid); > }