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

From: Michal Koutný
Date: Tue Apr 05 2022 - 18:32:08 EST


On Mon, Apr 04, 2022 at 10:08:43AM -0700, Shakeel Butt <shakeelb@xxxxxxxxxx> wrote:
> What would be the challenge on returning the number of bytes reclaimed
> through cgroup interface?

You'd need an object that represents the write size:

> bfd = open("/sys/kernel/mm/reclaim/balloon", O_RDWR);
> dprintf(bfd, "type=file nodemask=1-2 timeout=30\n")
>
> fd = open("/sys/kernel/fs/cgroup/foo/memory.reclaim", O_WRONLY);
> reclaimed = splice(bfd, NULL, fd, NULL, reclaim_size);

(I'm joking with this API but it is a resembling concept.)

Michal