From nobody Mon Jun 8 05:26:21 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 1BDDC283CB5; Tue, 2 Jun 2026 19:35:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780428955; cv=none; b=alYW9SHXN9bSAgs+XSddcNQ0nUoLs1H+GLZLgVLvDrdxapZcC374tYIF4tIHKaapoqCdkVPfMsh4adRi+f//r1cb8HO7Oj1xOeI7Y1AYfG2+mO7myH2+o2qJ01XDs0Iy8Efb+3bzh/XS1Q14C2atwGVTWBU0cgtRFxtvU+mTRMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780428955; c=relaxed/simple; bh=yTaUTCOjG9VHAaF/mwC5CCE+7PPO1WLFsXLp2jaB8Ts=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=IkJSHp/8VXSg+o6lXYD+KW6v2uMPif/EEnxfj9N4X/TAYP47f7GJB3d6WFQHXJ7uPyNnbh0mg4JOKzuAqEyCJemqsYizdn66HW5S8jtf8hxmpC2D7o/GeTXFME/dobvVCl0Kr1y0o4+y6uP5/px7GszRSZBmPraLP5E8Fi03a+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v3NTak8F; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0FNy5ODh; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v3NTak8F"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0FNy5ODh" Date: Tue, 02 Jun 2026 19:35:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780428952; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kOIEgDSllHBxoisnOlMdkoJEUWynMo3V68UBKytxp+Y=; b=v3NTak8FxV4sB8OqZWXNDqTT05GbV/e6MhUFCk5YUquGhmHHQfA3ZjYNUhWEHWZZY820pA YDN/nAPXDg6z+rWYXKN6MplJXu6RGqh8j9HYNImbDVwRSsAJuhHIR0eNplvsbD9LKZy4s3 qqmJdKbHVkiMZeDls5HhNOnbNkBqV++373XyvIlRymA4IiwIkkYge312v5yfc/jisfNk9q FcVqSZGNXN2Dkjq0qRnffm9ivgSQimbrzay8av3dRbo0C5+01SBQAhzrdQEDFSrmZT3JJ+ jvpZg6jGSrph2XGgex/86KQduEydvZpTopUD2ruLJ6ic6jGLCf5/+udpUYjzqg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780428952; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kOIEgDSllHBxoisnOlMdkoJEUWynMo3V68UBKytxp+Y=; b=0FNy5ODh3tWFiOw2yjKZPDVnjnLQ+xNMj/c9fR/33eKxgUn4Y/gRdPk4eTnjbudxzbYU79 0caeyg+zqV/ecNDg== From: "tip-bot2 for Rosen Penev" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers/migration: Turn tmigr_hierarchy level_list into a flexible array Cc: Rosen Penev , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260522231618.41622-1-rosenp@gmail.com> References: <20260522231618.41622-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178042895101.710.12067381384261768859.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/core branch of tip: Commit-ID: 45b49d7e3ab6490a9b957a4075344093c43d1f7e Gitweb: https://git.kernel.org/tip/45b49d7e3ab6490a9b957a4075344093c= 43d1f7e Author: Rosen Penev AuthorDate: Fri, 22 May 2026 16:16:18 -07:00 Committer: Thomas Gleixner CommitterDate: Tue, 02 Jun 2026 21:34:03 +02:00 timers/migration: Turn tmigr_hierarchy level_list into a flexible array The level_list array is allocated separately right after the parent struct. The size of the array is already known. Move level_list to the struct tail as a flexible array member and fold the two allocations into a single kzalloc_flex(). Signed-off-by: Rosen Penev Signed-off-by: Thomas Gleixner Assisted-by: Claude:Opus-4.7 Link: https://patch.msgid.link/20260522231618.41622-1-rosenp@gmail.com --- kernel/time/timer_migration.c | 16 +++++----------- kernel/time/timer_migration.h | 5 ++--- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 8ba53ad..548d849 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1963,17 +1963,15 @@ static struct tmigr_hierarchy *tmigr_get_hierarchy(= int cpu) if (hier) return hier; =20 - hier =3D kzalloc(sizeof(*hier), GFP_KERNEL); + hier =3D kzalloc_flex(*hier, level_list, tmigr_hierarchy_levels); if (!hier) return ERR_PTR(-ENOMEM); =20 hier->cpumask =3D kzalloc(cpumask_size(), GFP_KERNEL); - if (!hier->cpumask) - goto err; - - hier->level_list =3D kzalloc_objs(struct list_head, tmigr_hierarchy_level= s); - if (!hier->level_list) - goto err; + if (!hier->cpumask) { + kfree(hier); + return ERR_PTR(-ENOMEM); + } =20 for (int i =3D 0; i < tmigr_hierarchy_levels; i++) INIT_LIST_HEAD(&hier->level_list[i]); @@ -1982,10 +1980,6 @@ static struct tmigr_hierarchy *tmigr_get_hierarchy(i= nt cpu) list_add_tail(&hier->node, &tmigr_hierarchy_list); =20 return hier; -err: - kfree(hier->cpumask); - kfree(hier); - return ERR_PTR(-ENOMEM); } =20 static int tmigr_connect_old_root(struct tmigr_hierarchy *hier, int cpu, diff --git a/kernel/time/timer_migration.h b/kernel/time/timer_migration.h index ea8db95..31735dd 100644 --- a/kernel/time/timer_migration.h +++ b/kernel/time/timer_migration.h @@ -9,19 +9,18 @@ * struct tmigr_hierarchy - a hierarchy associated to a given CPU capacity. * Homogeneous systems have only one hierarchy. * Heterogenous have one hierarchy per CPU capaci= ty. - * @level_list: Per level lists of tmigr groups * @cpumask: CPUs belonging to this hierarchy * @root: The current root of the hierarchy * @capacity: CPU capacity associated to this hierarchy * @node: Node in the global hierarchy list + * @level_list: Per level lists of tmigr groups */ struct tmigr_hierarchy { - struct list_head *level_list; struct cpumask *cpumask; struct tmigr_group *root; unsigned long capacity; struct list_head node; - + struct list_head level_list[]; }; =20 /**