From nobody Fri Nov 29 00:42:00 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 660D51B0132 for ; Thu, 26 Sep 2024 22:49:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727390961; cv=none; b=qYanZ3ajkL6o8fkOzH18WrUWehhQDyRPRsHKDUMQ+wIDi7T6IZkjIF6LNxmheBhzGTFC3Abi/MxO2nuWFO8fHfQlnuy/nY331F6VNn31Trv/B+Lgx+kRy+8fDYbtCJ61gH9s+pEjZaM7i+LUEpHV0NNCVhSMDMKZ5o03XrCHks4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727390961; c=relaxed/simple; bh=IoZPaCv863UIRZr027aVdH0TUkaWU86goti0yjIS6gg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p+0gM8ko+RNQbpy8tQV5e3z04Qv/5NWzWJ44aVhN5QPY1Tci0Zj3KmiQ6ww62IUgcfrrRJRSw3wO7xKsa3FdCAweSTanK3kIxwNTnOC0b8hWLxCE5oVtpKyx2xaaC/Oda4gKSSy4fj7KzKz8Tc9P69SBnLhnG6a9PoawJlQL70s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U2hFLO8T; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U2hFLO8T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C984C4CEC9; Thu, 26 Sep 2024 22:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727390960; bh=IoZPaCv863UIRZr027aVdH0TUkaWU86goti0yjIS6gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2hFLO8TVLpXed/PO8bgaQChLsEVO9vBLiU/qf2289Myb6BL0gr2NKwazqBvUsLwx 7wVi1axumlXMWfRDy+cwHzwmOwWePtR7tdL/5DWBWofhdVwSND2gOcn1x1CWxuU9Gk JWw3WVJF7DrTNbKP34keg4vaIuYVO/yi/+VnPIWv+5Pc2iUZfH5d/6AsekRekntuEU UISHVVdOIAfSKquSmHqMRyg+DZ9lSJwNHiUQjlJ0vV/soCrtV9FBjHUPjfgo2klb4g EKS7gUmP77XIYQQQS/kvS9aEG2qoGF6ebiD6BX2X9pCKTKwzVGE9sYbDcWgTjVtHHB +nxwrY/j0geVQ== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Fenghua Yu , Reinette Chatre , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , Peter Zijlstra , Thomas Gleixner Subject: [PATCH 02/20] x86/resctrl: Use kthread_run_on_cpu() Date: Fri, 27 Sep 2024 00:48:50 +0200 Message-ID: <20240926224910.11106-3-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240926224910.11106-1-frederic@kernel.org> References: <20240926224910.11106-1-frederic@kernel.org> 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" Use the proper API instead of open coding it. Acked-by: Reinette Chatre Signed-off-by: Frederic Weisbecker --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 28 +++++++---------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cp= u/resctrl/pseudo_lock.c index e69489d48625..ae1f0c28eee6 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -1205,20 +1205,14 @@ static int pseudo_lock_measure_cycles(struct rdtgro= up *rdtgrp, int sel) plr->cpu =3D cpu; =20 if (sel =3D=3D 1) - thread =3D kthread_create_on_node(measure_cycles_lat_fn, plr, - cpu_to_node(cpu), - "pseudo_lock_measure/%u", - cpu); + thread =3D kthread_run_on_cpu(measure_cycles_lat_fn, plr, + cpu, "pseudo_lock_measure/%u"); else if (sel =3D=3D 2) - thread =3D kthread_create_on_node(measure_l2_residency, plr, - cpu_to_node(cpu), - "pseudo_lock_measure/%u", - cpu); + thread =3D kthread_run_on_cpu(measure_l2_residency, plr, + cpu, "pseudo_lock_measure/%u"); else if (sel =3D=3D 3) - thread =3D kthread_create_on_node(measure_l3_residency, plr, - cpu_to_node(cpu), - "pseudo_lock_measure/%u", - cpu); + thread =3D kthread_run_on_cpu(measure_l3_residency, plr, + cpu, "pseudo_lock_measure/%u"); else goto out; =20 @@ -1226,8 +1220,6 @@ static int pseudo_lock_measure_cycles(struct rdtgroup= *rdtgrp, int sel) ret =3D PTR_ERR(thread); goto out; } - kthread_bind(thread, cpu); - wake_up_process(thread); =20 ret =3D wait_event_interruptible(plr->lock_thread_wq, plr->thread_done =3D=3D 1); @@ -1315,18 +1307,14 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rd= tgrp) =20 plr->thread_done =3D 0; =20 - thread =3D kthread_create_on_node(pseudo_lock_fn, rdtgrp, - cpu_to_node(plr->cpu), - "pseudo_lock/%u", plr->cpu); + thread =3D kthread_run_on_cpu(pseudo_lock_fn, rdtgrp, + plr->cpu, "pseudo_lock/%u"); if (IS_ERR(thread)) { ret =3D PTR_ERR(thread); rdt_last_cmd_printf("Locking thread returned error %d\n", ret); goto out_cstates; } =20 - kthread_bind(thread, plr->cpu); - wake_up_process(thread); - ret =3D wait_event_interruptible(plr->lock_thread_wq, plr->thread_done =3D=3D 1); if (ret < 0) { --=20 2.46.0