From mboxrd@z Thu Jan 1 00:00:00 1970 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 5631A3112D0 for ; Sun, 16 Nov 2025 20:48:59 +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=1763326140; cv=none; b=KDCac4JPLjWXbhHIz1/avIaJ1dhQTt4x4DBHamE/WwGs/18gyIZ7Y+KbpeRN6vzQgDRcINgBGHoUQEWMdnyuJeoY8+lPS6DNGRGt9f01YmlsRTr4ROAYz0Ss12sG4CktiA9rfBPewLmCCUHhfB17QXQ/wwEwxv+R9GsZNV+8fmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763326140; c=relaxed/simple; bh=zqAZCzLWkxZD+e76etq7zlkSRiRI1Y7VrYwSK9tFAlo=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=RCH7XeA/6N3oA4cscm3tGq4SnE7asvY75AkHLeUmbqGVVh3gx8HX4RNz6K6yLd4gYW5s4HCnDht754K3JPmDL7sPIykMLW6hjU5hz+UkXv9W4ivcxrL8dvTMABuqAQJ476F7yiQteGyoeDGQK6aFg7DTzofeYOugikEqSckz79g= 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=z4xhinl+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=i7J0r8dw; 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="z4xhinl+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="i7J0r8dw" Message-ID: <20251104075427.430938391@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763326137; 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=A5b0W46fZ1DC+DlmuPt9JSSxncrHZPTk75Urt26KwI0=; b=z4xhinl+WYi4u9GtwPzXmG2HlEC5DzUCedlI9QfOwIgd0FfZUpWp0RFov9m4HnHfz4035j th4LYx/6/lzzOJZY+71pdrmdA9ktR1leYU5t8elZLgN8BEO828SBCtWnm93sa2DBsHirw3 CEaGAEkvm6gLcC4uv36y2e25a98MkZCi/2EaMv2MlHAuwZC8reUs+Wkqf19bnSCqpDsgdj zeH2YI/niweXHqmPQp44qumXnOF1C51GEn51V2eEdwrJjOeInLcH5lAGHaXaRdw3mBvQzi OzpAui6zMGQyf1p5MfkN68uzUg/iHfSnIhlyO/NS4tWtFNY2AXQMuq0J9p5WOw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763326137; 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=A5b0W46fZ1DC+DlmuPt9JSSxncrHZPTk75Urt26KwI0=; b=i7J0r8dwH0K2aWGNpPU12pbOqIuiCa7wP+v8hEVtkMUEfKrAZmqduDZPQ6zFWhGsM9uMrl kEz64R4SUqygxbCQ== From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Gabriele Monaco , Mathieu Desnoyers , Michael Jeanson , Jens Axboe , "Paul E. McKenney" , "Gautham R. Shenoy" , Florian Weimer , Tim Chen , Yury Norov , Shrikanth Hegde Subject: [patch V4 12/20] sched/mmcid: Move initialization out of line References: <20251104075053.700034556@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Sun, 16 Nov 2025 21:48:56 +0100 (CET) It's getting bigger soon, so just move it out of line to the rest of the code. Signed-off-by: Thomas Gleixner Reviewed-by: Mathieu Desnoyers --- include/linux/mm_types.h | 15 +-------------- kernel/sched/core.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1351,20 +1351,7 @@ static inline unsigned long *mm_cidmask( return (unsigned long *)cid_bitmap; } -static inline void mm_init_cid(struct mm_struct *mm, struct task_struct *p) -{ - int i; - - for_each_possible_cpu(i) { - struct mm_cid_pcpu *pcpu = per_cpu_ptr(mm->mm_cid.pcpu, i); - - pcpu->cid = MM_CID_UNSET; - } - mm->mm_cid.nr_cpus_allowed = p->nr_cpus_allowed; - raw_spin_lock_init(&mm->mm_cid.lock); - cpumask_copy(mm_cpus_allowed(mm), &p->cpus_mask); - bitmap_zero(mm_cidmask(mm), num_possible_cpus()); -} +void mm_init_cid(struct mm_struct *mm, struct task_struct *p); static inline int mm_alloc_cid_noprof(struct mm_struct *mm, struct task_struct *p) { --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -10431,6 +10431,20 @@ void sched_mm_cid_fork(struct task_struc WARN_ON_ONCE(!t->mm || t->mm_cid.cid != MM_CID_UNSET); t->mm_cid.active = 1; } + +void mm_init_cid(struct mm_struct *mm, struct task_struct *p) +{ + struct mm_cid_pcpu __percpu *pcpu = mm->mm_cid.pcpu; + int cpu; + + for_each_possible_cpu(cpu) + per_cpu_ptr(pcpu, cpu)->cid = MM_CID_UNSET; + + mm->mm_cid.nr_cpus_allowed = p->nr_cpus_allowed; + raw_spin_lock_init(&mm->mm_cid.lock); + cpumask_copy(mm_cpus_allowed(mm), &p->cpus_mask); + bitmap_zero(mm_cidmask(mm), num_possible_cpus()); +} #else /* CONFIG_SCHED_MM_CID */ static inline void mm_update_cpus_allowed(struct mm_struct *mm, const struct cpumask *affmsk) { } #endif /* !CONFIG_SCHED_MM_CID */