From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 400CF480342 for ; Fri, 6 Mar 2026 20:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772830486; cv=none; b=I7vkbMxecIWHlFGWpk49n8voLlk6EWEfWVCYktvIMQi8nkX3feJU7hLPZ+cZYqVRGaRgYcICcDOWhPUeLQjUiizUAS+EP0GrmW0mL9kE0dclgvet+eAhmyTHTjiTVpau3BazTlZtINLZJiJAMKChuZT+R+RNhztDm/DS21GDvNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772830486; c=relaxed/simple; bh=qNo4S1+WkJwdqp+tYHVLUssHQKKKZZAhD4/FolFcVuY=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=iQ53yTf87rch3ptwOSl7tB5TyOHBNqL53eICF+pdH4jPgcQjYeqlbWz2jMx/GY2QyCmoZNO5prmfEp/te+SEqPcFqLUn853T8MPnzzOEsqeP0T6y6mqFrGrcz7azyFK5yU80FLrpkXHGtdSBwjgeZlgiYIC5FGKJAjhWFzJxajE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20230601.gappssmtp.com header.i=@etsalapatis-com.20230601.gappssmtp.com header.b=YT66nzp2; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20230601.gappssmtp.com header.i=@etsalapatis-com.20230601.gappssmtp.com header.b="YT66nzp2" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-8c70ab3b5fcso1312875285a.2 for ; Fri, 06 Mar 2026 12:54:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20230601.gappssmtp.com; s=20230601; t=1772830484; x=1773435284; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XYYb3MTgue6ruqAtTWWQIpjzRV2dEjMOcxssr5ef14s=; b=YT66nzp2HON53RRPc9/Of61TLF20gp2tb0TD8D1GyC8uXOQTWWhL3yZgJVchDPrw++ coFUhVs4SZ5qH8fILNiY0j6Ku7PlIyUcy+IOfSaKEDPz6Vfxess+Ch9PyEpcYUQDmmEc 8+eVP031m6wU5BM8F3I+ctuMs1+8cPrisvQDC++nSRJNy22s51HCNKUWgAkCjL5Ebo6m zAMClvlJo35KRcRKBNAXiLV2UIfRvcefRT8N6IZZ+fiPY83byX4cGliU9w847/2brEct IqQT+CfzrzkTxDZy3+E76kt3flWVOToHE+3q59+WxZovyf1sp2GtKChiHV2380uar521 oBZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772830484; x=1773435284; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XYYb3MTgue6ruqAtTWWQIpjzRV2dEjMOcxssr5ef14s=; b=KDBiI0k+NckHa2nzTjU21LbxEB6yiRF5Hir6tZSsS8tULLa9bHVje4dzKgveggT7qZ OCtT/NXtXs2F0asDvVmH5UHFi0jOW9Oe8bORi7GBGfWA0A94up1iS8zr/98a/56OQ7A6 5Q/CWlOOypBQ2lfI7pqiMVMDBaN8kt1z+1jfOykODNrfI8iukPSPsts4eJ7qahAdzLY9 tJWhbhAsytCYtieSnGgnN+/N4boqH24T2anxpXG7UKoyh8n6KUUvVw9BUmfPNXkEei9V 86+XLu1LlUB/twJbOIEzVA07WExDeXGZ4rCSJAKrOwBdlu5Tld422QHsXVIsMpdZ1sZW JyoA== X-Forwarded-Encrypted: i=1; AJvYcCUEGjh6nF1fGlwPyIyQVIAVW4tIPNu+MupZ1cvheDlr3FzVCTJzJJOS2uKfH0RICgeLpfIUfYExZ7Lz9u8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2ZMJPGQltOtf7PWL9/wtvpeQo07R/ohhARYe3mMg6b7UJm47S oHteXrZrRELojiZuKsZCZKSp7CuFZy37Yt2UtjrZqMuarly49QyLfs9xpBURHHL0beg= X-Gm-Gg: ATEYQzzjGRNXEPsoRh2/iKC8mJxAMraOaAOR7Vm6tOFgoZEcfQD0xNRyl3NKnBCs9lt wZptD+XOlS6cv2vDIa9MiV6L7owZLVNeO689QArLYTrKIa6dPNDxkbfWTVamTbE+ykiXSh2AhD1 rdS2tRXy1s8dU4+or+djSQBsXT6c8b2P26lSvVv/zSW3CKzaxIAPvaNm/DFh/eLUyet8hgapaib mFkGa0w7iyxIpMJiM/u28UmlEdWNnl1Sou8WKa4UIh/GNNrW7hQ5dIfMihCJM+Aamxtic12IEdk AGn585DEbkO+nEbi8zB14DUzvrAKYXtQR0F8aezSmnEYANV63pwPjgR3QR+5N+zbgHfCyTLcG+q GTK2+ItbomSaK3NOLltdtqEo/qTwPm+yHG3Ldv6sMg8Zwg6JPyl0KZbmwHxMP7cGp8vyZX1U0LI gvRFsvYIbkJnFKSkz7Tv0r+eckNgsgr291xg== X-Received: by 2002:a05:620a:2587:b0:8b5:5a33:22d2 with SMTP id af79cd13be357-8cd6d4b5a1bmr462953385a.46.1772830484213; Fri, 06 Mar 2026 12:54:44 -0800 (PST) Received: from localhost ([140.174.219.137]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cd6f566fd5sm188141285a.43.2026.03.06.12.54.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Mar 2026 12:54:43 -0800 (PST) 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 Content-Type: text/plain; charset=UTF-8 Date: Fri, 06 Mar 2026 15:54:42 -0500 Message-Id: Cc: , , Subject: Re: [PATCH 03/15] sched_ext: Factor out pnode allocation and deallocation into helpers From: "Emil Tsalapatis" To: "Tejun Heo" , , X-Mailer: aerc 0.20.1 References: <20260306190623.1076074-1-tj@kernel.org> <20260306190623.1076074-4-tj@kernel.org> In-Reply-To: <20260306190623.1076074-4-tj@kernel.org> On Fri Mar 6, 2026 at 2:06 PM EST, Tejun Heo wrote: > Extract pnode allocation and deallocation logic into alloc_pnode() and > free_pnode() helpers. This simplifies scx_alloc_and_add_sched() and prepa= res > for adding more per-node initialization and cleanup in subsequent patches= . > > No functional changes. > > Signed-off-by: Tejun Heo Reviewed-by: Emil Tsalapatis > --- > kernel/sched/ext.c | 32 +++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c > index 9232abea4f22..c36d399bca3e 100644 > --- a/kernel/sched/ext.c > +++ b/kernel/sched/ext.c > @@ -4114,6 +4114,7 @@ static const struct attribute_group scx_global_attr= _group =3D { > .attrs =3D scx_global_attrs, > }; > =20 > +static void free_pnode(struct scx_sched_pnode *pnode); > static void free_exit_info(struct scx_exit_info *ei); > =20 > static void scx_sched_free_rcu_work(struct work_struct *work) > @@ -4148,7 +4149,7 @@ static void scx_sched_free_rcu_work(struct work_str= uct *work) > free_percpu(sch->pcpu); > =20 > for_each_node_state(node, N_POSSIBLE) > - kfree(sch->pnode[node]); > + free_pnode(sch->pnode[node]); > kfree(sch->pnode); > =20 > rhashtable_walk_enter(&sch->dsq_hash, &rht_iter); > @@ -5685,6 +5686,24 @@ static int alloc_kick_syncs(void) > return 0; > } > =20 > +static void free_pnode(struct scx_sched_pnode *pnode) > +{ > + kfree(pnode); > +} > + > +static struct scx_sched_pnode *alloc_pnode(struct scx_sched *sch, int no= de) > +{ > + struct scx_sched_pnode *pnode; > + > + pnode =3D kzalloc_node(sizeof(*pnode), GFP_KERNEL, node); > + if (!pnode) > + return NULL; > + > + init_dsq(&pnode->global_dsq, SCX_DSQ_GLOBAL, sch); > + > + return pnode; > +} > + > static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *o= ps, > struct cgroup *cgrp, > struct scx_sched *parent) > @@ -5714,16 +5733,11 @@ static struct scx_sched *scx_alloc_and_add_sched(= struct sched_ext_ops *ops, > } > =20 > for_each_node_state(node, N_POSSIBLE) { > - struct scx_sched_pnode *pnode; > - > - pnode =3D kzalloc_node(sizeof(*pnode), GFP_KERNEL, node); > - if (!pnode) { > + sch->pnode[node] =3D alloc_pnode(sch, node); > + if (!sch->pnode[node]) { > ret =3D -ENOMEM; > goto err_free_pnode; > } > - > - init_dsq(&pnode->global_dsq, SCX_DSQ_GLOBAL, sch); > - sch->pnode[node] =3D pnode; > } > =20 > sch->dsp_max_batch =3D ops->dispatch_max_batch ?: SCX_DSP_DFL_MAX_BATCH= ; > @@ -5821,7 +5835,7 @@ static struct scx_sched *scx_alloc_and_add_sched(st= ruct sched_ext_ops *ops, > free_percpu(sch->pcpu); > err_free_pnode: > for_each_node_state(node, N_POSSIBLE) > - kfree(sch->pnode[node]); > + free_pnode(sch->pnode[node]); > kfree(sch->pnode); > err_free_hash: > rhashtable_free_and_destroy(&sch->dsq_hash, NULL, NULL);