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:   Mon, 18 Jan 2021 08:56:20 +0100
From:   Vincent Guittot <vincent.guittot@...aro.org>
To:     Jiang Biao <benbjiang@...il.com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Jiang Biao <benbjiang@...cent.com>
Subject: Re: [PATCH] sched/fair: add protection for delta of wait time

On Sun, 17 Jan 2021 at 13:31, Jiang Biao <benbjiang@...il.com> wrote:
>
> From: Jiang Biao <benbjiang@...cent.com>
>
> delta in update_stats_wait_end() might be negative, which would
> make following statistics go wrong.

Could you describe the use case that generates a negative delta ?

rq_clock is always increasing so this should not lead to a negative
value even if update_stats_wait_end/start are not called in the right
order,
This situation could happen after a migration if we forgot to call
update_stats_wait_start

>
> Add protection for delta of wait time, like what have been done in
> update_stats_enqueue_sleeper() for deltas of sleep/block time.
>
> Signed-off-by: Jiang Biao <benbjiang@...cent.com>
> ---
>  kernel/sched/fair.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c0374c1152e0..ac950ac950bc 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -917,6 +917,9 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
>
>         delta = rq_clock(rq_of(cfs_rq)) - schedstat_val(se->statistics.wait_start);
>
> +       if ((s64)delta < 0)
> +               delta = 0;
> +
>         if (entity_is_task(se)) {
>                 p = task_of(se);
>                 if (task_on_rq_migrating(p)) {
> --
> 2.21.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ