[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240905131244.GA179482@pauld.westford.csb>
Date: Thu, 5 Sep 2024 09:12:44 -0400
From: Phil Auld <pauld@...hat.com>
To: Waiman Long <longman@...hat.com>
Cc: Xuewen Yan <xuewen.yan@...soc.com>, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, linux-kernel@...r.kernel.org,
ke.wang@...soc.com, di.shen@...soc.com, xuewen.yan94@...il.com
Subject: Re: [RFC PATCH] sched: Do not copy user_cpus_ptr when parent is
reset_on_fork
On Thu, Sep 05, 2024 at 08:42:33AM -0400 Waiman Long wrote:
> On 9/5/24 05:04, Xuewen Yan wrote:
> > Now, the task's user_cpus_ptr would dup from parent's user_cpus_ptr.
> > It is better reset the user_cpus_ptr when parent's reset_on_fork
> > is set.
>
> According to sched(7):
>
> Each thread has a reset-on-fork scheduling flag. When this flag
> is set, children created by fork(2) do not inherit privileged
> scheduling policies.
>
> It can be argued what are considered privileged scheduling policies. AFAICS,
> a restricted affinity doesn't seem to be a "privileged" scheduling policy.
> That is my own opinion strictly from the definition point of view, I will
> let others weigh in on that and I am OK to go either way.
>
I think that one could argue that clearing a restricted affinity is
increasing the privilege and not preventing inheritence of same.
i.e. it would be the opposite of what reset-on-fork means.
I'd say NAK to this one if I had that power.
Cheers,
Phil
> Cheers,
> Longman
>
> >
> > Signed-off-by: Xuewen Yan <xuewen.yan@...soc.com>
> > ---
> > kernel/sched/core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index f3951e4a55e5..2fbae00cd1dc 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -2666,7 +2666,7 @@ int dup_user_cpus_ptr(struct task_struct *dst, struct task_struct *src,
> > * do_set_cpus_allowed().
> > */
> > raw_spin_lock_irqsave(&src->pi_lock, flags);
> > - if (src->user_cpus_ptr) {
> > + if (src->user_cpus_ptr && !src->sched_reset_on_fork) {
> > swap(dst->user_cpus_ptr, user_mask);
> > cpumask_copy(dst->user_cpus_ptr, src->user_cpus_ptr);
> > }
>
>
--
Powered by blists - more mailing lists