Re: [PATCH resend] memcg: introduce per-memcg reclaim interface

Michal Hocko
2022-04-04T08:44:12Z

On Fri 01-04-22 09:58:59, Roman Gushchin wrote:
> On Fri, Apr 01, 2022 at 03:49:19PM +0200, Michal Hocko wrote:
> > On Thu 31-03-22 10:25:23, Roman Gushchin wrote:
> > > On Thu, Mar 31, 2022 at 08:41:51AM +0000, Yosry Ahmed wrote:
> > [...]
> > > > - A similar per-node interface can also be added to support proactive
> > > > reclaim and reclaim-based demotion in systems without memcg.
> > >
> > > Maybe an option to specify a timeout? That might simplify the userspace part.
> >
> > What do you mean by timeout here? Isn't
> > timeout $N echo $RECLAIM > ....
> >
> > enough?
>
> It's nice and simple when it's a bash script, but when it's a complex
> application trying to do the same, it quickly becomes less simple and
> likely will require a dedicated thread to avoid blocking the main app
> for too long and a mechanism to unblock it by timer/when the need arises.
>
> In my experience using correctly such semi-blocking interfaces (semi- because
> it's not clearly defined how much time the syscall can take and whether it
> makes sense to wait longer) is tricky.

We have the same approach to setting other limits which need to perform
the reclaim. Have we ever hit that as a limitation that would make
userspace unnecessarily too complex?
--
Michal Hocko
SUSE Labs