From nobody Mon Feb 9 08:28:05 2026 Received: from out0-193.mail.aliyun.com (out0-193.mail.aliyun.com [140.205.0.193]) (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 BC0461AACE for ; Mon, 5 Feb 2024 11:47:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707133650; cv=none; b=muhoiyAFzPcM05/C4pgzaK1Suj92RxkGe/yT19OqBVUDpd7+AfU6iKksVcrJNhQMMfGjuANkepst8ob5WFzYuajywjOnLnjR67Q2iZ8LXCZ4LYE5WXZjIKunaKZDYGt7qPov1JBAE5IZgQyvcu/c2Kyy2/gUt+ad9HI1n3BbmGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707133650; c=relaxed/simple; bh=aeIv3sGdCkzoeZ0Sga2roNKU5ZWZgPhlxgVKkJoerUE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ot0KaQSIiveJspK9+ho7umyc07K4MH2Wrc/NXGA0XPIrOVY27vxqLmh4qx0nTfPhoVco8TTNLtRA64a52xD4JPQ1/DXIlwVf2UY5Aht+AjQWEmRMvsWybSFO7JynmrRHh97um0CcWC0LqcoqYgActTBZ5t74PuGGLAXNnqLVH2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; arc=none smtp.client-ip=140.205.0.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047188;MF=tiwei.btw@antgroup.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---.WNt.HmM_1707133639; Received: from ubuntu..(mailfrom:tiwei.btw@antgroup.com fp:SMTPD_---.WNt.HmM_1707133639) by smtp.aliyun-inc.com; Mon, 05 Feb 2024 19:47:20 +0800 From: "Tiwei Bie" To: richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net Cc: , , "Tiwei Bie" Subject: [PATCH v2 6/6] um: Stop tracking host PID in cpu_tasks Date: Mon, 05 Feb 2024 19:47:08 +0800 Message-Id: <20240205114708.25235-7-tiwei.btw@antgroup.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205114708.25235-1-tiwei.btw@antgroup.com> References: <20240205114708.25235-1-tiwei.btw@antgroup.com> 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" The host PID tracked in 'cpu_tasks' is no longer used. Stopping tracking it will also save some cycles. Signed-off-by: Tiwei Bie --- arch/um/include/shared/as-layout.h | 1 - arch/um/kernel/process.c | 12 ++---------- arch/um/kernel/skas/process.c | 4 ---- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as= -layout.h index 9ec3015bc5e2..c22f46a757dc 100644 --- a/arch/um/include/shared/as-layout.h +++ b/arch/um/include/shared/as-layout.h @@ -31,7 +31,6 @@ #include =20 struct cpu_task { - int pid; void *task; }; =20 diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 4235e2ca2664..1201c1a79b23 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -43,13 +43,7 @@ * cares about its entry, so it's OK if another processor is modifying its * entry. */ -struct cpu_task cpu_tasks[NR_CPUS] =3D { [0 ... NR_CPUS - 1] =3D { -1, NUL= L } }; - -static inline int external_pid(void) -{ - /* FIXME: Need to look up userspace_pid by cpu */ - return userspace_pid[0]; -} +struct cpu_task cpu_tasks[NR_CPUS] =3D { [0 ... NR_CPUS - 1] =3D { NULL } = }; =20 void free_stack(unsigned long stack, int order) { @@ -70,8 +64,7 @@ unsigned long alloc_stack(int order, int atomic) =20 static inline void set_current(struct task_struct *task) { - cpu_tasks[task_thread_info(task)->cpu] =3D ((struct cpu_task) - { external_pid(), task }); + cpu_tasks[task_thread_info(task)->cpu] =3D ((struct cpu_task) { task }); } =20 extern void arch_switch_to(struct task_struct *to); @@ -208,7 +201,6 @@ void um_idle_sleep(void) =20 void arch_cpu_idle(void) { - cpu_tasks[current_thread_info()->cpu].pid =3D os_getpid(); um_idle_sleep(); } =20 diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index fdd5922f9222..99a5cbb36083 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c @@ -18,12 +18,8 @@ extern void start_kernel(void); =20 static int __init start_kernel_proc(void *unused) { - int pid; - block_signals_trace(); - pid =3D os_getpid(); =20 - cpu_tasks[0].pid =3D pid; cpu_tasks[0].task =3D current; =20 start_kernel(); --=20 2.34.1