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]
Message-ID: <CALOAHbAAyAOx9Ck27LhqV-sddTTWsk0cqMdHRNiA5O-r_9K+cQ@mail.gmail.com>
Date:   Tue, 31 Aug 2021 21:25:52 +0800
From:   Yafang Shao <laoar.shao@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Mel Gorman <mgorman@...e.de>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Benjamin Segall <bsegall@...gle.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Alison Chaiken <achaiken@...ora.tech>,
        kbuild test robot <lkp@...el.com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-rt-users <linux-rt-users@...r.kernel.org>
Subject: Re: [PATCH v3 2/7] sched: make struct sched_statistics independent of
 fair sched class

On Tue, Aug 31, 2021 at 6:19 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Tue, Aug 24, 2021 at 11:29:41AM +0000, Yafang Shao wrote:
>
> > +#ifdef CONFIG_FAIR_GROUP_SCHED
> > +static inline void
> > +__schedstats_from_sched_entity(struct sched_entity *se,
> > +                           struct sched_statistics **stats)
> > +{
> > +     struct task_group *tg;
> > +     struct task_struct *p;
> > +     struct cfs_rq *cfs;
> > +     int cpu;
> > +
> > +     if (entity_is_task(se)) {
> > +             p = task_of(se);
> > +             *stats = &p->stats;
> > +     } else {
> > +             cfs = group_cfs_rq(se);
> > +             tg = cfs->tg;
> > +             cpu = cpu_of(rq_of(cfs));
> > +             *stats = tg->stats[cpu];
> > +     }
> > +}
> > +
> > +#else
> > +
> > +static inline void
> > +__schedstats_from_sched_entity(struct sched_entity *se,
> > +                           struct sched_statistics **stats)
> > +{
> > +     struct task_struct *p;
> > +
> > +     p = task_of(se);
> > +     *stats = &p->stats;
> > +}
> > +
> > +#endif
> > +
> >  /*
> >   * Update the current task's runtime statistics.
> >   */
> > @@ -826,6 +861,7 @@ static void update_curr(struct cfs_rq *cfs_rq)
> >  {
> >       struct sched_entity *curr = cfs_rq->curr;
> >       u64 now = rq_clock_task(rq_of(cfs_rq));
> > +     struct sched_statistics *stats = NULL;
> >       u64 delta_exec;
> >
> >       if (unlikely(!curr))
> > @@ -837,8 +873,11 @@ static void update_curr(struct cfs_rq *cfs_rq)
> >
> >       curr->exec_start = now;
> >
> > -     schedstat_set(curr->statistics.exec_max,
> > -                   max(delta_exec, curr->statistics.exec_max));
> > +     if (schedstat_enabled()) {
> > +             __schedstats_from_sched_entity(curr, &stats);
> > +             __schedstat_set(stats->exec_max,
> > +                             max(delta_exec, stats->exec_max));
> > +     }
> >
> >       curr->sum_exec_runtime += delta_exec;
> >       schedstat_add(cfs_rq->exec_clock, delta_exec);
>
>
> That's just really odd style; what's wrong with something like:
>

I will change it.

> static inline struct sched_statistics *
> __schedstats_from_se(struct sched_entity *se)
> {
>         ...
> }
>
>         if (schedstats_enabled()) {
>                 struct sched_statistics *stats = __schedstats_from_se(curr);
>                 __schedstat_set(stats->exec_max, max(stats->exec_max, delta_exec));
>         }
>
>


-- 
Thanks
Yafang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ