From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 7AD4534D90D for ; Wed, 1 Jul 2026 15:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782919258; cv=none; b=uEhNgMQAcXC3KZxIC10qQNoSusJsIpkXbG1orDU/OEo3guyG49OX5DxR6T22G0z0aZJRaSJoP9v0X11ppjk6/4awC0TUPPHhu/8v/huxa14s9gGepHui71NVO5ih1prOJI7GRlD3d7/8acr43lOloRH/mQo9ekqHlakRdxmEWUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782919258; c=relaxed/simple; bh=B5OtZj/lBZyOnuuuCWdlMKPRT3npcqUb/grocb0Ceik=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ssnHs+WhuMcMpaiWHMYmkAFS4jxM6NSAz75infeLco9Ttcir6kY6wG8vS3VvitOFmYkrgED1Ndj9u1fSE7GppYwYhaIQk/2JL5Ccy2ho9oxQCprKmVmrugQB4V28yu6V/MGgQyU8fZ90m9YN1yYhllEVmDvVg2aHMY2+JGGjZxo= 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=ufxlAByw; arc=none smtp.client-ip=209.85.222.178 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="ufxlAByw" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-92e65e18969so57888985a.1 for ; Wed, 01 Jul 2026 08:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1782919255; x=1783524055; 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=zSMdskJ/XVsebZBQ8sHZxAPdt7ILVugrW/olreDrl4I=; b=ufxlABywSsz5oik0DwZQI8l3TVtoOhz4T/8mPkNocZCngVRiRVC7QdMijAKZOkhi8H yQdiqi3qN9PYLQYAlzvEjgf8mp/bPJa8m1V0NX0uRlnhzDL9qZkHnuBGGDU9GhYbwlEY oGWFQ8hCSPmGBqI7mL89dBV2VfLaeq8PNsAPx939s6qw/kRqOTTBurXVDGQ4XWmrAxSJ rLp95vNLyPUJdB5xRY2lSQhIQzxBHLK29Fv58ZYNJVhWMYj5HDEsSfcw54sytQvuzpL1 Ac2StMsVKRQb1QeTaNdZyig8dUCvgshFOxGZOWiB8w59eMop4cAK6ZUc96osShIcVySF 5h+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782919255; x=1783524055; 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=zSMdskJ/XVsebZBQ8sHZxAPdt7ILVugrW/olreDrl4I=; b=b5jFz4flgV+DCIPvmILeQck1eBOXOAI5cyha0LsmqhmlRRsLAy+ExubybHPK4mcraC 6GOoBDlJV9U0LKNQcau9Xazr2cKE/87i7cbB8P2TRkjgZE68OSf+m5frK3tRcRFIB/uY VDVOc5EsmRQ6Z+Dm1DQEIPHSGG5OMv1xJwMYyp67vexl5MsP8JZbo7UFIE5cBWm+F6f0 tAiG0tUGYIu9zF9YB94QWjLZsGow1PMRkJqSoeA4bCGmpIPNEcjbjrRGVtxv7d1qPYhY eQJLHtH9etGUXQfPXi+biL/fKDAaH9lcBKFSFhGProCjWqwWZLtQwMgYNolcwoV2fo5s wRxw== X-Forwarded-Encrypted: i=1; AFNElJ/yZbooUblQ5IHd6acLwbqkgPtMTAhwMD4f0IVCyrkzmQqkaXTf/5ch0Ruon1pmtzRb7LXfuA7LlIdNJp4=@vger.kernel.org X-Gm-Message-State: AOJu0YzHq/M3Y5+wb21QIXfctsqtIhV6QW0P0K/+OjgiLkaUfZ4mrQco mqmVwyuWrlVW2lTNy3NiJVEDdTwYWNDgIeFu2sA5zp7vas/9gp+p0ktBcm6FgcmN8fM= X-Gm-Gg: AfdE7ckzMt2ES9KTYygS1nEDu9BdHdi8y5gAWJGB5taJ7xMyFtdZAYBhucGcWByQa7H 28XRCK2KOjsln1OebrzkzSZdRE7eHPwkEUyb1xw7xFpWi+UQr7JITx/Bnd8NCVnFxXxhCJThEVb pruSLuKOfS5ACsPnXGOqRsLapQoMFcBDvtlVDqmx3B/HJzR7xnRUmq1nUnCX61DzhEkZEZ8YGj4 KRg5kVSAl4ayKDnacb7mug8mUvr4JSsJJu7qIwzx4aHwqUy8XAebLpCCXyDOQdYEOXXMgGFiW2+ CGSP3SXH+cF4osOdVTeNlaWsNM6HqIasuwpDRFsYne6IJloKwhGSgsA+7b8BIRJV02sXhTeV/LG KPk2oRBkBUSkVMFzlYjrNb64zHXiDgMaQEqDoKVIKcMmY4m70ALFjPfp+Xko58Sv/M9MbfcbI3k zKxdf6T8jUn6cyXvS0hxOp3jDqHfHwjxifgwR2Nz6QbVY0u1kjALy5wFNjml4Zi8l2t5gI X-Received: by 2002:a05:620a:178e:b0:92b:f1ba:5fad with SMTP id af79cd13be357-92e69821ad8mr849855185a.37.1782919255344; Wed, 01 Jul 2026 08:20:55 -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-92e623379easm595581185a.32.2026.07.01.08.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2026 08:20:54 -0700 (PDT) Date: Wed, 1 Jul 2026 11:20:50 -0400 From: Gregory Price To: Mike Rapoport Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, kernel-team@meta.com, david@kernel.org, osalvador@suse.de, akpm@linux-foundation.org, mgorman@techsingularity.net, hannes@cmpxchg.org, vbabka@kernel.org Subject: Re: [PATCH] mm/mm_init: handle alloc_percpu failure in free_area_init_core_hotplug Message-ID: References: <20260630214039.2263562-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: On Wed, Jul 01, 2026 at 09:38:57AM +0300, Mike Rapoport wrote: > On Tue, Jun 30, 2026 at 05:40:39PM -0400, Gregory Price wrote: > > We miss a failed allocation check for pgdat->per_cpu_nodestats, which > > results in a NULL deref when we offset into the per-cpu area. > > > > Propagate -ENOMEM up the stack and leave per_cpu_nodestats pointing > > at boot_nodestats so a later online can retry the allocation. > > > > hotadd_init_pgdat() returns NULL on failure, which __try_online_node() > > already maps to -ENOMEM. > > > > Assisted-by: Sashiko:unknown-model > > I suppose it's rather > > Reported-by: Sashiko I honestly wasn't sure here, Assisted-by is the tag for LLMs lol i can change it > > > Fixes: 75ef71840539 ("mm, vmstat: add infrastructure for per-node vmstats") > > Signed-off-by: Gregory Price > > --- > > include/linux/memory_hotplug.h | 2 +- > > mm/memory_hotplug.c | 3 ++- > > mm/mm_init.c | 14 +++++++++++--- > > 3 files changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h > > index 7c9d66729c60..f04b915678db 100644 > > --- a/include/linux/memory_hotplug.h > > +++ b/include/linux/memory_hotplug.h > > @@ -289,7 +289,7 @@ static inline void __remove_memory(u64 start, u64 size) {} > > /* Default online_type (MMOP_*) when new memory blocks are added. */ > > extern enum mmop mhp_get_default_online_type(void); > > extern void mhp_set_default_online_type(enum mmop online_type); > > -extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat); > > +extern int __ref free_area_init_core_hotplug(struct pglist_data *pgdat); > > Nit: we are trying to get rid of 'extern's in the headers, even though it > makes the declarations inconsistent. > Can you please drop the extern since you anyway changing this? yup no problem