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: <CAJuCfpF_gSdfk_csny-6p661gfGy41w0V2QwoCSY02KdeXMLEA@mail.gmail.com>
Date:   Wed, 13 Sep 2023 23:01:01 +0000
From:   Suren Baghdasaryan <surenb@...gle.com>
To:     yang.yang29@....com.cn
Cc:     hannes@...xchg.org, mingo@...hat.com, linux-kernel@...r.kernel.org,
        juri.lelli@...hat.com
Subject: Re: [PATCH linux-next] sched/psi: Avoid update triggers and
 rtpoll_total when it is unnecessary

On Wed, Sep 13, 2023 at 12:44 PM <yang.yang29@....com.cn> wrote:
>
> From: Yang Yang <yang.yang29@....com.cn>
>
> When psimon wakes up and there are no state changes for rtpoll_states,
> it's unnecessary to update triggers and rtpoll_total because the pressures
> being monitored by user have not changed.
>
> Signed-off-by: Yang Yang <yang.yang29@....com.cn>
> ---
>  kernel/sched/psi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> index 81fca77397f6..e4463bb267c3 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -701,7 +701,7 @@ static void psi_rtpoll_work(struct psi_group *group)
>                 goto out;
>         }
>
> -       if (now >= group->rtpoll_next_update) {
> +       if ((changed_states & group->rtpoll_states) && (now >= group->rtpoll_next_update)) {

With this additional condition group->rtpoll_next_update will not be
updated if states do not change and later on we will have a call to
psi_schedule_rtpoll_work() with the delay calculated as
"nsecs_to_jiffies(group->rtpoll_next_update - now) + 1". With
group->rtpoll_next_update not updated, we can end up with a negative
delay. I don't think that's your intention here, it is?

>                 group->rtpoll_next_update = update_triggers(group, now, &update_total, PSI_POLL);
>                 if (update_total)
>                         memcpy(group->rtpoll_total, group->total[PSI_POLL],
> --
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ