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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNdEaw2nktq1NfmH@dhcp22.suse.cz>
Date:   Sat, 12 Aug 2023 10:35:55 +0200
From:   Michal Hocko <mhocko@...e.com>
To:     Shakeel Butt <shakeelb@...gle.com>
Cc:     Yosry Ahmed <yosryahmed@...gle.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Muchun Song <muchun.song@...ux.dev>, cgroups@...r.kernel.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: memcg: provide accurate stats for userspace reads

On Fri 11-08-23 19:48:14, Shakeel Butt wrote:
> On Fri, Aug 11, 2023 at 7:36 PM Yosry Ahmed <yosryahmed@...gle.com> wrote:
> >
> > On Fri, Aug 11, 2023 at 7:29 PM Shakeel Butt <shakeelb@...gle.com> wrote:
> > >
> > > On Fri, Aug 11, 2023 at 7:12 PM Yosry Ahmed <yosryahmed@...gle.com> wrote:
> > > >
> > > [...]
> > > >
> > > > I am worried that writing to a stat for flushing then reading will
> > > > increase the staleness window which we are trying to reduce here.
> > > > Would it be acceptable to add a separate interface to explicitly read
> > > > flushed stats without having to write first? If the distinction
> > > > disappears in the future we can just short-circuit both interfaces.
> > >
> > > What is the acceptable staleness time window for your case? It is hard
> > > to imagine that a write+read will always be worse than just a read.
> > > Even the proposed patch can have an unintended and larger than
> > > expected staleness window due to some processing on
> > > return-to-userspace or some scheduling delay.
> >
> > Maybe I am worrying too much, we can just go for writing to
> > memory.stat for explicit stats refresh.
> >
> > Do we still want to go with the mutex approach Michal suggested for
> > do_flush_stats() to support either waiting for ongoing flushes
> > (mutex_lock) or skipping (mutex_trylock)?
> 
> I would say keep that as a separate patch.

Separate patches would be better but please make the mutex conversion
first. We really do not want to have any busy waiting depending on a
sleep exported to the userspace. That is just no-go.

Thanks!
-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ