lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Apr 2023 15:47:14 +0100
From:   John Stultz <jstultz@...gle.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Joel Fernandes <joelaf@...gle.com>,
        Qais Yousef <qyousef@...gle.com>,
        Ingo Molnar <mingo@...hat.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Valentin Schneider <vschneid@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>,
        Zimuzo Ezeozue <zezeozue@...gle.com>,
        Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH v3 08/14] sched: Replace rq->curr access w/ rq_curr(rq)

On Sat, Apr 22, 2023 at 11:42 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Tue, Apr 11, 2023 at 04:25:05AM +0000, John Stultz wrote:
> > +static inline struct task_struct *rq_curr(struct rq *rq)
> > +{
> > +     return rq->curr_exec;
> > +}
> > +
> > +static inline struct task_struct *rq_curr_rcu(struct rq *rq)
> > +{
> > +     return rcu_dereference(rq->curr_exec);
> > +}
> > +
> > +static inline struct task_struct *rq_curr_once(struct rq *rq)
> > +{
> > +     return READ_ONCE(rq->curr_exec);
> > +}
> > +
> > +static inline void rq_set_curr(struct rq *rq, struct task_struct *task)
> > +{
> > +     rcu_assign_pointer(rq->curr_exec, task);
> > +}
> > +
> > +/*
> > + *  XXX jstultz: seems like rcu_assign_pointer above would also
> > + *               work for this, but trying to match usage.
> > + */
> > +static inline void rq_set_curr_rcu_init(struct rq *rq, struct task_struct *task)
> > +{
> > +     RCU_INIT_POINTER(rq->curr_exec, task);
> > +}
>
> > +static inline struct task_struct *rq_selected(struct rq *rq)
> > +{
> > +       return rq->curr_sched;
> > +}
> > +
> > +static inline struct task_struct *rq_selected_rcu(struct rq *rq)
> > +{
> > +       return rcu_dereference(rq->curr_sched);
> > +}
> > +
> > +static inline struct task_struct *rq_selected_once(struct rq *rq)
> > +{
> > +       return READ_ONCE(rq->curr_sched);
> > +}
> > +
> > +static inline void rq_set_selected(struct rq *rq, struct task_struct *t)
> > +{
> > +       rcu_assign_pointer(rq->curr_sched, t);
> > +}
>
> How is any of that helping? That's just making it harder to read.

Heh. So the main reason I added these was so the !CONFIG_PROXY_EXEC
case would be able to collapse down cleanly.

> Can we please just keep it rq->curr and rq->proxy and stop this wrapper
> fettish.

So, I could go back and set the rq_curr() back to rq->curr, but it
seems like we'd still want the rq_selected()  [whatever its named]
wrapper to avoid the extra pointer in the task struct when proxy-exec
isn't used. Or do you have a different suggestion for this?

thanks
-john

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ