From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B70A2E1C7B for ; Wed, 19 Nov 2025 16:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763569048; cv=none; b=SA5dBuSAZnCxpmnW1iPHO2Vy8TIlW+HC5ERVlL3hgKca250zzhK+vEyMOyzVP/sQsqdR+5xtqvekqXKR1HHB9XUl/RoUybf12dEvz/SmKrtw4LV+qQ5d285qUc0IjFIOtLJ4XECRcoa9CirG5MoCdtVr5/NjHoYPhdkUVYNKzY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763569048; c=relaxed/simple; bh=ZhopoqxcWzn91CiucmlHHidBU7nCtGSyy6CskBowsdY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aSPClIzPFe87PAw2teNnA44HFqppjQnYrlsgnk2l3ZBDTsrVLD5Aes2GDDrILbZCVI+AgZZUQiQ6LSH+V+qBUuK6Xdcgei9CA3YYpd2uWlZWMUo5lhlNV52eJYJVMXy23Sa9rGivX/nN1DrY7zxXX2n3aJTBOvzSvDoXWZviKS8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FNXOhkc3; arc=none smtp.client-ip=209.85.160.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FNXOhkc3" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-4ee1879e6d9so45117541cf.1 for ; Wed, 19 Nov 2025 08:17:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763569045; x=1764173845; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=+ZdXucMedWP7jP+foppTjTuFYxuL0zaJAsib+d2Xd1E=; b=FNXOhkc3zl196CXKpKK91+BPLIf2eoq89ZlvM0paGi58Cs+NLMD38jk1VRnBoDSYWi X0rsKnMQqZpQpknki1uy5T3aiiYKZlPNCOvSv/V6tQ4t1zWN9obBdF0Z6k2EIj+FU5m7 T6LmBBj9qjiXqNZj+VGCks+CbaCVBmCyMRbY3AXhm2uzN/fYEMNEgeXBwJ5CLIN9rCXU 7hYO7rC9TYb9vB2qIb8rtr0igbCfyUu+yeWgyYybpMvxjEhJITgQ4giqHqQ9Qj5KOBlp koLXDxd0szP8a8J7dF0H+d/1Q64+KmW7ENetxwhcMj1rfi+t7fxHtOqJmnQ/PfYZoNOu qNbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763569045; x=1764173845; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+ZdXucMedWP7jP+foppTjTuFYxuL0zaJAsib+d2Xd1E=; b=gXdFD5lyw14imJchoppzo3gajzMKtL6wfzbV/+jspE3O6XwmecSKKD4WUoA5fV3XDa l/mxt67MrD4F+lsUTSFOc2wNfSDkmULonFV00ys+tUZ4GRVIv+I4T1WZRnQUpAHNt5Wl UcexLR8kdSf8R/u1QWoJ7/pt5FnN/S9T7pmt5DgQpMfQ9jMTE0XoMwmDDZgRn6+hyCeI NPzAniIuDkFq/g2rkdmRyUs+ktL+CLqVPoeD/zFAMoi0oOYCpD4b0oiGGDJ0qNHW7uQC qIh3Ulkx8j690+voSAx1PurZbvi1TgIwqAod2DIb+UMabQlGZc1VQjQl4lAAMc1SFrnH HWpg== X-Gm-Message-State: AOJu0YwQij7SKY5et29055XiQuar4ynUTaG8r2IdsHvbC79B3hSn6/HR hxXi/lOhtflZr7WMih40ss0/79fJ/38K5K7uV0wfQ7fHOKRqTz8qeA/l X-Gm-Gg: ASbGncs8TIw87u7BgFBKEf1TZ+54nSv0XSbZcJ+8VhZhGyIeyZOynRCRQm9nCbi1/4v pKbL4ueUEqmbDSu9ttWGXYMd9oAuFS88gShS2UkCm8//1EPYlzVfmmov9cF/9iOIayiAfZvrZNK d+0AjWHIxsxsSQwlRqNhBJ9JoO/eQKdotRTdKtKMxVXO62MeC8G9/xB+DAnpcTw/eFhlZbrwuEu rbfhQ74NxAqIaPpTciIR9xL8Z8nTZ8xpGJ5xKoDzHeKG38T/YajiXMWsl32qhe82QPG1PGJ7ITh pz+ucX9q4FIZ9tzQ05IA6QhzDzp4eY9xiNDqu2qSRkQk02uFy/a9pC7tFT/kyPha21eMEJxmQSX XCfHcvAABdOP//NJTJJjWrZO9lcnH7nKuq8rdau2rkj25Ez156YZFADE24oAVsTf2qCxbQRy9xE vleNZKMgDUDyV1+bJPaw== X-Google-Smtp-Source: AGHT+IG+qz/JgXzFJn9EADA16x0grHtA6Iy6CJfjyYDaMAXWfNuF38KKZoB/oEeWvD6DtxJeczcwvw== X-Received: by 2002:a05:622a:c9:b0:4ec:f452:4ec0 with SMTP id d75a77b69052e-4edf2142c67mr292572051cf.69.1763569045059; Wed, 19 Nov 2025 08:17:25 -0800 (PST) Received: from localhost ([12.22.141.131]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ede87e6db1sm124395611cf.20.2025.11.19.08.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 08:17:24 -0800 (PST) Date: Wed, 19 Nov 2025 11:17:21 -0500 From: Yury Norov To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Gabriele Monaco , Mathieu Desnoyers , Michael Jeanson , Jens Axboe , "Paul E. McKenney" , "Gautham R. Shenoy" , Florian Weimer , Tim Chen , Shrikanth Hegde Subject: Re: [patch V4 05/20] sched/mmcid: Move scheduler code out of global header Message-ID: References: <20251104075053.700034556@linutronix.de> <20251104075426.934381707@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=us-ascii Content-Disposition: inline In-Reply-To: <20251104075426.934381707@linutronix.de> On Sun, Nov 16, 2025 at 09:48:43PM +0100, Thomas Gleixner wrote: > This is only used in the scheduler core code, so there is no point to have > it in a global header. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Mathieu Desnoyers Thanks for unloading global headers! Acked-by: Yury Norov (NVIDIA) > --- > include/linux/mm_types.h | 13 ------------- > kernel/sched/core.c | 20 ++++++++++++++++++-- > 2 files changed, 18 insertions(+), 15 deletions(-) > > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -1387,27 +1387,14 @@ static inline unsigned int mm_cid_size(v > return 2 * cpumask_size(); /* mm_cpus_allowed(), mm_cidmask(). */ > } > > -static inline void mm_set_cpus_allowed(struct mm_struct *mm, const struct cpumask *cpumask) > -{ > - struct cpumask *mm_allowed = mm_cpus_allowed(mm); > - > - if (!mm) > - return; > - /* The mm_cpus_allowed is the union of each thread allowed CPUs masks. */ > - guard(raw_spinlock)(&mm->mm_cid.lock); > - cpumask_or(mm_allowed, mm_allowed, cpumask); > - WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, cpumask_weight(mm_allowed)); > -} > #else /* CONFIG_SCHED_MM_CID */ > static inline void mm_init_cid(struct mm_struct *mm, struct task_struct *p) { } > static inline int mm_alloc_cid(struct mm_struct *mm, struct task_struct *p) { return 0; } > static inline void mm_destroy_cid(struct mm_struct *mm) { } > - > static inline unsigned int mm_cid_size(void) > { > return 0; > } > -static inline void mm_set_cpus_allowed(struct mm_struct *mm, const struct cpumask *cpumask) { } > #endif /* CONFIG_SCHED_MM_CID */ > > struct mmu_gather; > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -2669,6 +2669,8 @@ int push_cpu_stop(void *arg) > return 0; > } > > +static inline void mm_update_cpus_allowed(struct mm_struct *mm, const cpumask_t *affmask); > + > /* > * sched_class::set_cpus_allowed must do the below, but is not required to > * actually call this function. > @@ -2728,7 +2730,7 @@ static void > put_prev_task(rq, p); > > p->sched_class->set_cpus_allowed(p, ctx); > - mm_set_cpus_allowed(p->mm, ctx->new_mask); > + mm_update_cpus_allowed(p->mm, ctx->new_mask); > > if (queued) > enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK); > @@ -10372,6 +10374,18 @@ void call_trace_sched_update_nr_running( > * When a task exits, the MM CID held by the task is not longer required as > * the task cannot return to user space. > */ > +static inline void mm_update_cpus_allowed(struct mm_struct *mm, const struct cpumask *affmsk) > +{ > + struct cpumask *mm_allowed = mm_cpus_allowed(mm); > + > + if (!mm) > + return; > + /* The mm_cpus_allowed is the union of each thread allowed CPUs masks. */ > + guard(raw_spinlock)(&mm->mm_cid.lock); > + cpumask_or(mm_allowed, mm_allowed, affmsk); > + WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, cpumask_weight(mm_allowed)); > +} > + > void sched_mm_cid_exit_signals(struct task_struct *t) > { > struct mm_struct *mm = t->mm; > @@ -10411,7 +10425,9 @@ 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; > } > -#endif /* CONFIG_SCHED_MM_CID */ > +#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 */ > > #ifdef CONFIG_SCHED_CLASS_EXT > void sched_deq_and_put_task(struct task_struct *p, int queue_flags,