Jail resource limits?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Jail resource limits?

Greg Lewis-2
Hi all,

I've been playing with limiting FreeBSD jail resources with both cpuset and
rctl and I wondered if anyone knew of a way to tell from inside the jail
what these limits are?

E.g. let's say I use cpuset to limit a jail to CPU0 and rctl to limit a jail
to only using up to 4G of memory.  Can I then tell from a process running
inside the jail that these limits are in place?  I tried dumping out
sysctl -a and couldn't see anything that seemed to match up with the limits
I put in place.  I haven't yet tried writing some code to call cpuset(2)
to see if that works.

The reason I'm asking is that some software may make decisions based on the
resources available and I'd like to have a way to accurately determine
those resource limits for jailed processes.

Any pointers appreciated.

-- Greg
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Jail resource limits?

Miroslav Lachman
Greg Lewis wrote on 11/07/2019 05:43:

> Hi all,
>
> I've been playing with limiting FreeBSD jail resources with both cpuset and
> rctl and I wondered if anyone knew of a way to tell from inside the jail
> what these limits are?
>
> E.g. let's say I use cpuset to limit a jail to CPU0 and rctl to limit a jail
> to only using up to 4G of memory.  Can I then tell from a process running
> inside the jail that these limits are in place?  I tried dumping out
> sysctl -a and couldn't see anything that seemed to match up with the limits
> I put in place.  I haven't yet tried writing some code to call cpuset(2)
> to see if that works.
>
> The reason I'm asking is that some software may make decisions based on the
> resources available and I'd like to have a way to accurately determine
> those resource limits for jailed processes.

cpuset called inside a jail will return available cores

# cpuset -g
pid -1 mask: 2, 3

I don't think it is possible to query rctl limits.

Maybe somebody else knows better.

Miroslav Lachman
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"