From nobody Wed Oct 8 02:03:24 2025 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 DEEB62D12F7; Thu, 3 Jul 2025 08:36:11 +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=1751531773; cv=none; b=NPOPDf6DZhkbIXtW6JjgMxpNSGUqS6P83EydCKBORV7cY4I6uMuUCE2hmf+DjpbHpsRgNVNDGEXBoKrM8+Ii5v3T13TqNRYNVFgQFAZv1djQTasoXNRiIf2UT6coImyFs3vzHLd5i6HYBQdxXdJeisEB4Da1VTBLZ9FiKK99ckE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751531773; c=relaxed/simple; bh=2zC0TRYa7W99gT+jcbgjgFGM0EDdBMHMsvgiDBSXXnI=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=IaqiYX9DeWq37kVNleitIp05+RXrd0FHlDEKFSCdmq3T6rLWlJQ4VQiM7T5iHhs6i9uYiKpLvBNvuVCVCj6V/2uP+WyU/KV8+jMrAk5iBUZmy59lAVZyG8OrXLitMrVbsNDigZYkc0d0zBC/wvziwlDl00QEnjUBrjs3AbU80sk= 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=2o6eHK2Q; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6PsQeVWW; 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="2o6eHK2Q"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6PsQeVWW" Date: Thu, 03 Jul 2025 08:36:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1751531770; 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=3XjLvA/DwogFv7KaaZwTTf/aNFcTkUVlWi/KtHkUVPw=; b=2o6eHK2Qii782QsKV05Sum/eY7SA0xi2E/1UbBnwlUY/R5fS16TgILGkZ6u4V0MU+sn8hD OcBmsnSKFNS5PhERuLH/K1vW0qXjvixtn4z895YXRsuV1Fzh5DDSqzZNqKF1pwe0qcr5Nk RvSXmWIoiH1Wod5/7mrWT1ZaP0TfSA+gy0vmUR+2ngnPYVme7jQvXlyWQO9d0Dbr73z8h6 RXMGAiWakGSk6Uz1+6POGslyHtkdOou2IRhb0z+/UbmhIdc8soGTxkV/iazQWZYRJg4GNI O/gmQ/rRU9+xW/2czdWEb5zMmJo/+HA98k3rWE/z4oCvxXhWRQQvzCatTZUBfg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1751531770; 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=3XjLvA/DwogFv7KaaZwTTf/aNFcTkUVlWi/KtHkUVPw=; b=6PsQeVWWPPpkl9mq6GbVOron4hsNqZmTeUUiKV9EGQStk6Fxzz4YImPOH9xp0RwCSoaarC nfMTkWaIpY+Y5/Bg== From: "tip-bot2 for Panagiotis Foliadis" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] rust: task: Mark Task methods inline Cc: Benno Lossin , Christian Schrefl , Charalampos Mitrodimas , Alice Ryhl , Panagiotis Foliadis , Boqun Feng , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250315-inline-c-wrappers-v3-1-048e43fcef7d@posteo.net> References: <20250315-inline-c-wrappers-v3-1-048e43fcef7d@posteo.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <175153176934.406.13550300797392656325.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 sched/core branch of tip: Commit-ID: 0a41f5af19391ce55cae1f0d7a562e8694bf1fd5 Gitweb: https://git.kernel.org/tip/0a41f5af19391ce55cae1f0d7a562e869= 4bf1fd5 Author: Panagiotis Foliadis AuthorDate: Sat, 15 Mar 2025 12:23:01=20 Committer: Boqun Feng CommitterDate: Tue, 24 Jun 2025 10:23:48 -07:00 rust: task: Mark Task methods inline When building the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 toolchain provided by kernel.org, the following symbols are generated: $ nm vmlinux | grep ' _R'.*Task | rustfilt ... T ::get_pid_ns ... T ::tgid_nr_ns ... T ::current_pid_ns ... T ::signal_pending ... T ::uid ... T ::euid ... T ::current ... T ::wake_up ... T ::dec_ref ... T ::inc_ref These Rust symbols are trivial wrappers around the C functions. It doesn't make sense to go through a trivial wrapper for these functions, so mark them inline. [boqun: Capitalize the title, reword a bit to avoid listing all the C functions as the code already shows them and remove the addresses of the symbols in the commit log as they are different from build to build.] Link: https://github.com/Rust-for-Linux/linux/issues/1145 Reviewed-by: Benno Lossin Reviewed-by: Christian Schrefl Reviewed-by: Charalampos Mitrodimas Reviewed-by: Alice Ryhl Signed-off-by: Panagiotis Foliadis Signed-off-by: Boqun Feng Link: https://lore.kernel.org/r/20250315-inline-c-wrappers-v3-1-048e43fcef7= d@posteo.net --- rust/kernel/task.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index 927413d..8343683 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -173,6 +173,7 @@ impl Task { /// Callers must ensure that the returned object is only used to acces= s a [`CurrentTask`] /// within the task context that was active when this function was cal= led. For more details, /// see the invariants section for [`CurrentTask`]. + #[inline] pub unsafe fn current() -> impl Deref { struct TaskRef { task: *const CurrentTask, @@ -222,24 +223,28 @@ impl Task { } =20 /// Returns the UID of the given task. + #[inline] pub fn uid(&self) -> Kuid { // SAFETY: It's always safe to call `task_uid` on a valid task. Kuid::from_raw(unsafe { bindings::task_uid(self.as_ptr()) }) } =20 /// Returns the effective UID of the given task. + #[inline] pub fn euid(&self) -> Kuid { // SAFETY: It's always safe to call `task_euid` on a valid task. Kuid::from_raw(unsafe { bindings::task_euid(self.as_ptr()) }) } =20 /// Determines whether the given task has pending signals. + #[inline] pub fn signal_pending(&self) -> bool { // SAFETY: It's always safe to call `signal_pending` on a valid ta= sk. unsafe { bindings::signal_pending(self.as_ptr()) !=3D 0 } } =20 /// Returns task's pid namespace with elevated reference count + #[inline] pub fn get_pid_ns(&self) -> Option> { // SAFETY: By the type invariant, we know that `self.0` is valid. let ptr =3D unsafe { bindings::task_get_pid_ns(self.as_ptr()) }; @@ -255,6 +260,7 @@ impl Task { =20 /// Returns the given task's pid in the provided pid namespace. #[doc(alias =3D "task_tgid_nr_ns")] + #[inline] pub fn tgid_nr_ns(&self, pidns: Option<&PidNamespace>) -> Pid { let pidns =3D match pidns { Some(pidns) =3D> pidns.as_ptr(), @@ -268,6 +274,7 @@ impl Task { } =20 /// Wakes up the task. + #[inline] pub fn wake_up(&self) { // SAFETY: It's always safe to call `wake_up_process` on a valid t= ask, even if the task // running. @@ -341,11 +348,13 @@ impl CurrentTask { =20 // SAFETY: The type invariants guarantee that `Task` is always refcounted. unsafe impl crate::types::AlwaysRefCounted for Task { + #[inline] fn inc_ref(&self) { // SAFETY: The existence of a shared reference means that the refc= ount is nonzero. unsafe { bindings::get_task_struct(self.as_ptr()) }; } =20 + #[inline] unsafe fn dec_ref(obj: ptr::NonNull) { // SAFETY: The safety requirements guarantee that the refcount is = nonzero. unsafe { bindings::put_task_struct(obj.cast().as_ptr()) }