Skip to content

Commit bf07052

Browse files
committed
sched/mmcid: Move initialization out of line
It's getting bigger soon, so just move it out of line to the rest of the code. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://patch.msgid.link/20251119172549.769636491@linutronix.de
1 parent 2b1642b commit bf07052

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

include/linux/mm_types.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,20 +1351,7 @@ static inline unsigned long *mm_cidmask(struct mm_struct *mm)
13511351
return (unsigned long *)cid_bitmap;
13521352
}
13531353

1354-
static inline void mm_init_cid(struct mm_struct *mm, struct task_struct *p)
1355-
{
1356-
int i;
1357-
1358-
for_each_possible_cpu(i) {
1359-
struct mm_cid_pcpu *pcpu = per_cpu_ptr(mm->mm_cid.pcpu, i);
1360-
1361-
pcpu->cid = MM_CID_UNSET;
1362-
}
1363-
mm->mm_cid.nr_cpus_allowed = p->nr_cpus_allowed;
1364-
raw_spin_lock_init(&mm->mm_cid.lock);
1365-
cpumask_copy(mm_cpus_allowed(mm), &p->cpus_mask);
1366-
bitmap_zero(mm_cidmask(mm), num_possible_cpus());
1367-
}
1354+
void mm_init_cid(struct mm_struct *mm, struct task_struct *p);
13681355

13691356
static inline int mm_alloc_cid_noprof(struct mm_struct *mm, struct task_struct *p)
13701357
{

kernel/sched/core.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10431,6 +10431,20 @@ void sched_mm_cid_fork(struct task_struct *t)
1043110431
WARN_ON_ONCE(!t->mm || t->mm_cid.cid != MM_CID_UNSET);
1043210432
t->mm_cid.active = 1;
1043310433
}
10434+
10435+
void mm_init_cid(struct mm_struct *mm, struct task_struct *p)
10436+
{
10437+
struct mm_cid_pcpu __percpu *pcpu = mm->mm_cid.pcpu;
10438+
int cpu;
10439+
10440+
for_each_possible_cpu(cpu)
10441+
per_cpu_ptr(pcpu, cpu)->cid = MM_CID_UNSET;
10442+
10443+
mm->mm_cid.nr_cpus_allowed = p->nr_cpus_allowed;
10444+
raw_spin_lock_init(&mm->mm_cid.lock);
10445+
cpumask_copy(mm_cpus_allowed(mm), &p->cpus_mask);
10446+
bitmap_zero(mm_cidmask(mm), num_possible_cpus());
10447+
}
1043410448
#else /* CONFIG_SCHED_MM_CID */
1043510449
static inline void mm_update_cpus_allowed(struct mm_struct *mm, const struct cpumask *affmsk) { }
1043610450
#endif /* !CONFIG_SCHED_MM_CID */

0 commit comments

Comments
 (0)