public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup/cpuset: Adjust exception handling in generate_sched_domains()
@ 2023-12-31  7:28 Markus Elfring
  2023-12-31 18:29 ` Waiman Long
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Markus Elfring @ 2023-12-31  7:28 UTC (permalink / raw)
  To: cgroups, kernel-janitors, Johannes Weiner, Tejun Heo, Waiman Long,
	Zefan Li
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 31 Dec 2023 08:00:31 +0100

Two resource allocation failures triggered further actions
over the label “done” so far.

* Jump to the statement “ndoms = 1;” in three cases directly
  by using the label “set_ndoms” instead.

* Delete an assignment for the variable “ndoms” in one if branch.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 kernel/cgroup/cpuset.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index ba36c073304a..29ccd52eb45c 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -973,10 +973,9 @@ static int generate_sched_domains(cpumask_var_t **domains,

 	/* Special case for the 99% of systems with one, full, sched domain */
 	if (root_load_balance && !top_cpuset.nr_subparts) {
-		ndoms = 1;
 		doms = alloc_sched_domains(ndoms);
 		if (!doms)
-			goto done;
+			goto set_ndoms;

 		dattr = kmalloc(sizeof(struct sched_domain_attr), GFP_KERNEL);
 		if (dattr) {
@@ -986,12 +985,12 @@ static int generate_sched_domains(cpumask_var_t **domains,
 		cpumask_and(doms[0], top_cpuset.effective_cpus,
 			    housekeeping_cpumask(HK_TYPE_DOMAIN));

-		goto done;
+		goto set_ndoms;
 	}

 	csa = kmalloc_array(nr_cpusets(), sizeof(cp), GFP_KERNEL);
 	if (!csa)
-		goto done;
+		goto set_ndoms;
 	csn = 0;

 	rcu_read_lock();
@@ -1123,6 +1122,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
 	 * See comments in partition_sched_domains().
 	 */
 	if (doms == NULL)
+set_ndoms:
 		ndoms = 1;

 	*domains    = doms;
--
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-10 15:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-31  7:28 [PATCH] cgroup/cpuset: Adjust exception handling in generate_sched_domains() Markus Elfring
2023-12-31 18:29 ` Waiman Long
2024-01-01  8:56   ` Markus Elfring
2024-01-01 16:26     ` Waiman Long
2024-01-10 15:01 ` kernel test robot
2024-01-10 15:21 ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox