Setting threshold for "Low memory warning"

Hello, I am running a heavy neural network in tensorflow-keras on TX2.
I get a warning saying (with a spelling mistake!)

“Low Memory Warninig!”
Memory available for New process: **MB
Free **MB, buffers/cache **MB.

As per TX2’s developer guide, Ubuntu Desktop issues a warning when available memory falls below a threshold limit. The threshold limit is user-configurable.

How to configure the threshold?
Thanks in advance!

I’ve never tried to adjust this, but you might find this useful:
https://www.oracle.com/technical-resources/articles/it-infrastructure/dev-oom-killer.html

The gist is that there are some settings which might be read or written in “/proc/sys/”, and that the file for setting this at boot is “/etc/sysctl.conf”, while setting this on command line as a one time test is with the “sysctl” tool (run with sudo).

In that article you will see this:

sysctl vm.panic_on_oom=1
sysctl kernel.panic=X

The commands above refer to files under “/proc/sys/”. To see the current content the command “sysctl vm.panic_on_oom” has via cat of a file:
cat /proc/sys/vm/panic_on_oom
…or cat of kernel.panic:
cat /proc/sys/kernel/panic

In some cases sysctl as a command merely echos a new value into the file (if the file is writable). If you were to add something like “kernel.panic=5” to “/etc/sysctl.conf”, then upon boot this value would go into “/proc/sys/kernel/panic” in the same way that the command “sysctl kernel.panic=5” would do. Again, be careful about modifying the actual “/etc/sysctl.conf” unless you are certain what you are doing is correct.

Low memory can be a serious problem, and I would be careful about disabling a warning or OOM killer. If the message is just interfering by being visible where it is inconvenient, then perhaps you could simply start your app redirecting stderr to “/dev/null”. If it is the desktop sending pop-ups, then there is probably a desktop specific mechanism to prevent the pop-up, but I don’t know what that would be.

Btw, if it turns out to be disk space filling, then this can leave your system without a rescue ability other than to flash it again (possibly cloning first) if you can’t log in to reduce disk content clutter. My assumption with the above is RAM out of memory.

Thank you Linuxdev,

It is a desktop pop-up.
And the process is never killed because of OOM in several test runs.
Thus, I want to disable the pop up warning somehow.
Either a flag somewhere or setting a threshold value somewhere.

Hi,

We are checking this with our internal team.
Will share more information with you later.

Thanks.

Hi,

The low memory threshold is set to 150MB by default.
To configure the threshold, please update this script directly.

/etc/systemd/nvmemwarning.sh

# Minimum available memory limit (in MB)
threshold=150

# Check time interval (in sec)
interval=20

mem_warning()
{
        while : ; do
                ...

Thanks.