The memory.min parameter in the cgroups-v2 memory controller should help.
Namely, let me quote:
"Hard memory protection. If the memory usage of a cgroup is within its effective min boundary, the cgroup’s memory won’t be reclaimed under any conditions. If there is no unprotected reclaimable memory available, OOM killer is invoked."
https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html