From nobody Sat Jun 20 19:57:25 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 3BC4133D4F5 for ; Fri, 10 Apr 2026 19:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775849296; cv=none; b=dfFN8thTPws+jNll6otvtoPqHvUSN6NDHqZpW574PDu8wn77pFz57lSwuhXnZTlZDlseA34+GdKvRYWUMPR6WvAHSSnsn/RzjPA2p2FaR4BdEQGCkyfLLkZxm2tIMulM9GbntZUFrY49ENLM2L/JuhHqHaCkGJIDHAEctMWOwZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775849296; c=relaxed/simple; bh=UiZ6Xdv6SCvdtlkS/bz/zCP8RakfE/HQ/93fHKoVGZ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=s/JZ1S66b+Cxp4Gl8Wd+QgsFn6j0TULSTTn2mp7romW/yexhuKMBSQ0JDobpg1hlZgQmi0C65G/dcHB0Xy7Nl5V76K9C90u5g8Ptom/8FGKmGZX194OL+u1B9XJmpOufCKlkTF3mKHXN62+qEodaXbT2Bk7/4ZDbOuw/remf73s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FbTOGZFp; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FbTOGZFp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775849294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=CVlJt9ZYhSzHLtYAUUyP5lAQ5GTCYyqWEJ5fb3twRFE=; b=FbTOGZFp/rX+4EVc1RvVIRK/DxwT97tpQtu2H1kxIxKWRvUFgy3Oa8KiJY4/OgU/zr2bfH GpA4uGAMgo31nJMNg752RGy5NkayXqvboZ4doW+0ouMicJY8JfH3jTmsRsjl/Ug1QVtiqy F95trcG3w+RFATl8FcLnMVXhXbjoV+c= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-TIUFxuB5O9OWzlcbTSYpLA-1; Fri, 10 Apr 2026 15:28:10 -0400 X-MC-Unique: TIUFxuB5O9OWzlcbTSYpLA-1 X-Mimecast-MFC-AGG-ID: TIUFxuB5O9OWzlcbTSYpLA_1775849288 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 43B7E18002DA; Fri, 10 Apr 2026 19:28:08 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.65.156]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CADC419560AB; Fri, 10 Apr 2026 19:28:04 +0000 (UTC) From: Waiman Long To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Frederic Weisbecker Cc: linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH] sched/isolation: Postpone re-allocation of housekeeping cpumask until initcall Date: Fri, 10 Apr 2026 15:27:49 -0400 Message-ID: <20260410192749.3511778-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" When testing a linux-next kernel with commit 59bd1d914bb5 ("memblock: warn when freeing reserved memory before memory map is initialized"), the following warning was hit when there was a "nohz_full" kernel boot parameter. [ 0.080911] Cannot free reserved memory because of deferred initializati= on of the memory map [ 0.080911] WARNING: mm/memblock.c:904 at __free_reserved_area+0xde/0xf0= , CPU#0: swapper/0/0 : [ 0.080945] Call Trace: [ 0.080947] [ 0.080949] memblock_phys_free+0xcb/0x100 [ 0.080953] housekeeping_init+0x14c/0x170 [ 0.080957] start_kernel+0x207/0x450 [ 0.080961] x86_64_start_reservations+0x24/0x30 [ 0.080965] x86_64_start_kernel+0xda/0xe0 [ 0.080967] common_startup_64+0x13e/0x141 [ 0.080972] IOW, we shouldn't free memblock allocated memory so early in the boot process when memory map isn't fully initialized in deferred_init_memmap(). Fix it by adding a new housekeeping_late_init() helper to defer the re-allocation of the housekeeping cpumasks to when initcall's are being processed. Fixes: 27c3a5967f05 ("sched/isolation: Convert housekeeping cpumasks to rcu= pointers") Signed-off-by: Waiman Long Reviewed-by: Valentin Schneider --- kernel/sched/isolation.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index ef152d401fe2..3f582ed6b985 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -164,8 +164,6 @@ int housekeeping_update(struct cpumask *isol_mask) =20 void __init housekeeping_init(void) { - enum hk_type type; - if (!housekeeping.flags) return; =20 @@ -173,15 +171,25 @@ void __init housekeeping_init(void) =20 if (housekeeping.flags & HK_FLAG_KERNEL_NOISE) sched_tick_offload_init(); +} + +static int __init housekeeping_late_init(void) +{ + enum hk_type type; + + if (!housekeeping.flags) + return 0; + /* * Realloc with a proper allocator so that any cpumask update - * can indifferently free the old version with kfree(). + * can indifferently free the old version with kfree(). This + * should be done after the completion of deferred_init_memmap(). */ for_each_set_bit(type, &housekeeping.flags, HK_TYPE_MAX) { struct cpumask *omask, *nmask =3D kmalloc(cpumask_size(), GFP_KERNEL); =20 if (WARN_ON_ONCE(!nmask)) - return; + return 0; =20 omask =3D rcu_dereference(housekeeping.cpumasks[type]); =20 @@ -191,7 +199,9 @@ void __init housekeeping_init(void) RCU_INIT_POINTER(housekeeping.cpumasks[type], nmask); memblock_free(omask, cpumask_size()); } + return 0; } +pure_initcall(housekeeping_late_init); =20 static void __init housekeeping_setup_type(enum hk_type type, cpumask_var_t housekeeping_staging) --=20 2.53.0