From nobody Fri Oct 3 23:08: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 2083E2ED86F for ; Sat, 23 Aug 2025 16:39:39 +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=1755967182; cv=none; b=J9zUePtByDvpFCisAtagkHU0XGTx7WaVQMMN4kPHBMXWnBhZKM07DDN2C5lY1JeJERYaZqEPsdnaKN8dCExDdu/4Z1ADK3OlsTkIHnrxetKnus4XpbYTuUlja1+mCd9ksmbUPOZ1Wska7xY7mKhwnHbjhCFOjBLSB4ED8EsLUjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755967182; c=relaxed/simple; bh=zWogiLI32y56lyIiiKjVJfTGiLOGPR+uyhBbkbNIWZU=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=B9n3FBbVd7uYdQm6dtEqlKQO14jEeexnrqq/fFv2BIir+WowmMLI/o/Eym2CjViCmsdy4cWuBuYyKqhZi5rwDcdefxwdbA+uglKl16TCcak/z4TxgyZr9LplxryDLyr/OM0DkX2rRwmUAhs8AEjNvvUTlotAnPz4xCEhrCxDUmQ= 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=bzoOKFvK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=s04sxqff; 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="bzoOKFvK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="s04sxqff" Message-ID: <20250823161654.102905434@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1755967178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=vB4qNxPbyFropiAHJLd8M6UT1xH4V1GwhPc78Lrvq8o=; b=bzoOKFvKS6x7oIJF2E8Zc1xUcD0AXATAT+E4ENkA66f1DYETeUKpxtL53H9Gx5/tlUhx4B UM1ckkI9CZhVVYSTzuihY9ajUgPnqsUdFu2h+Oihls27MX3PG1jCwojbt+nlUvpftvYuVp vOzVIdkh9OX6Ld38FFWAAMfDN4tGYyXbJcHPW2WpkbsCWZ91udIQlVtQq7sQJP84U61pVy 1/30Im5sfTf5749rhaM28ndEDq7V6kcsJpQbqra+SNRiBg75OHEq3kq6y3EUK8h/IHD9w4 QSERRQgbF4fse6oljCBKa2p08bnD8k+ib+uGN3GG8X3IGp5ZkFrpwZe4AAly9A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1755967178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=vB4qNxPbyFropiAHJLd8M6UT1xH4V1GwhPc78Lrvq8o=; b=s04sxqffLOX+qMiFotU4AoDHxscXxMxQthDN+rOaLSDCr5p6ZObTqk7hXmhCzmziPg6X1s +vrzWFulbcrNcPDA== From: Thomas Gleixner To: LKML Cc: Jens Axboe , Mathieu Desnoyers , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Paolo Bonzini , Sean Christopherson , Wei Liu , Dexuan Cui , x86@kernel.org, Arnd Bergmann , Heiko Carstens , Christian Borntraeger , Sven Schnelle , Huacai Chen , Paul Walmsley , Palmer Dabbelt Subject: [patch V2 13/37] sched: Move MM CID related functions to sched.h References: <20250823161326.635281786@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Sat, 23 Aug 2025 18:39:37 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is nothing mm specific in that and including mm.h can cause header recursion hell. Signed-off-by: Thomas Gleixner Reviewed-by: Mathieu Desnoyers --- include/linux/mm.h | 25 ------------------------- include/linux/sched.h | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2310,31 +2310,6 @@ struct zap_details { /* Set in unmap_vmas() to indicate a final unmap call. Only used by huget= lb */ #define ZAP_FLAG_UNMAP ((__force zap_flags_t) BIT(1)) =20 -#ifdef CONFIG_SCHED_MM_CID -void sched_mm_cid_before_execve(struct task_struct *t); -void sched_mm_cid_after_execve(struct task_struct *t); -void sched_mm_cid_fork(struct task_struct *t); -void sched_mm_cid_exit_signals(struct task_struct *t); -static inline int task_mm_cid(struct task_struct *t) -{ - return t->mm_cid; -} -#else -static inline void sched_mm_cid_before_execve(struct task_struct *t) { } -static inline void sched_mm_cid_after_execve(struct task_struct *t) { } -static inline void sched_mm_cid_fork(struct task_struct *t) { } -static inline void sched_mm_cid_exit_signals(struct task_struct *t) { } -static inline int task_mm_cid(struct task_struct *t) -{ - /* - * Use the processor id as a fall-back when the mm cid feature is - * disabled. This provides functional per-cpu data structure accesses - * in user-space, althrough it won't provide the memory usage benefits. - */ - return raw_smp_processor_id(); -} -#endif - #ifdef CONFIG_MMU extern bool can_do_mlock(void); #else --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2309,4 +2309,30 @@ static __always_inline void alloc_tag_re #define alloc_tag_restore(_tag, _old) do {} while (0) #endif =20 +/* Avoids recursive inclusion hell */ +#ifdef CONFIG_SCHED_MM_CID +void sched_mm_cid_before_execve(struct task_struct *t); +void sched_mm_cid_after_execve(struct task_struct *t); +void sched_mm_cid_fork(struct task_struct *t); +void sched_mm_cid_exit_signals(struct task_struct *t); +static inline int task_mm_cid(struct task_struct *t) +{ + return t->mm_cid; +} +#else +static inline void sched_mm_cid_before_execve(struct task_struct *t) { } +static inline void sched_mm_cid_after_execve(struct task_struct *t) { } +static inline void sched_mm_cid_fork(struct task_struct *t) { } +static inline void sched_mm_cid_exit_signals(struct task_struct *t) { } +static inline int task_mm_cid(struct task_struct *t) +{ + /* + * Use the processor id as a fall-back when the mm cid feature is + * disabled. This provides functional per-cpu data structure accesses + * in user-space, althrough it won't provide the memory usage benefits. + */ + return task_cpu(t); +} +#endif + #endif