Re: POSIX shared memory, jails, and (lack of) limits

From: Mark Johnston <markj_at_freebsd.org>
Date: Tue, 03 Aug 2021 13:50:55 UTC
On Mon, Aug 02, 2021 at 09:58:08PM +0200, Thomas Steen Rasmussen wrote:
> On 8/2/21 9:40 PM, Mark Johnston wrote:
> > Cyril has written a few patches for racct, including one which includes
> > POSIX shared memory objects in rctl's "nshm" and "shmsize" resources,
> > which currently only apply to SysV shm objects:
> > https://reviews.freebsd.org/D30775
> > We plan to get them committed in the next couple of weeks.
> > 
> Hello,
> 
> I haven't looked at it for a bit, but the last time I tried to use 
> sysutils/jail_exporter to get graphs for jail resource usage the graphs 
> for Postgres jails were hilariously wrong, which I believe I tracked 
> down to shared memory being counted more than once.
> 
> I gave up trying to figure out how to fix it and just lived with Grafana 
> telling me a postgres jail on a 128gb jailhost used 900gb of memory.
> 
> But it sounds like the above might fix this?

I'm not familiar with jail_exporter, which resource counters is it
fetching?  I doubt this change on its own will solve the problem, it
simply includes POSIX shm objects in racct's shared memory accounting.
The mechanisms we use for memory usage are not changed there.