desktop entry proposal: TerminateSafe=true key

Lennart Poettering mzkqt at 0pointer.de
Fri May 7 07:38:16 PDT 2010


On Fri, 07.05.10 10:15, Colin Walters (walters at verbum.org) wrote:

> > Well, the OOM killer kills processes at its descretion, and it doesn't
> > look into the desktop file of the process before doing that... ;-)
> 
> Yes; the current Linux OOM killer is stupid; it arises from a lack of
> vertical integration in our software stack.

oom_adj is a way to make the OOM killer smarter. So far only very few
apps set that, but we certainly could change that.

> > And, as it turns out the kernel already has a per-process setting that
> > allows you to adjust your likeliness of being killed first by the OOM
> > killer. You can change it via writing to /proc/self/oom_adj.
> 
> Sure; the way I think this should work is that userspace is actively
> involved in preventing the last-ditch Linux OOM killer from being
> invoked; for example the desktop shell could simply kill TerminateSafe
> applications if it gets a low-memory signal from the kernel.

Hmm, I am not aware that on Linux we have anything like a low-memory
signal. Please enlighten me on that!

And what is wrong with using the OOM killer as the only line of defense
but making it smart with oom_adj, so that it kills the right process?
Why duplicating the OOM killing logic in userspace?

> > Which makes me wondering: how does your suggestion relate to the kernel
> > setting, and why should a developer fiddle with your setting instead of
> > the kernel setting?
> 
> The likelihood of your app being killed via oom_adj is orthogonal to
> letting the operating system know that it's safe to kill your app,
> because it's not going to lose user data.

I don't see how that would be orthogonal.

If the machine is under memory pressure the kernel will look for the OOM
scores, which are primarily influenced by the oom_adj value and then
kill the process which scores worst. There is really no need to involve
the desktop shell in this. The OOM killing is best done in the kernel,
no need to duplicate that in userspace (and even unprivileged user
code).

So tell me, why exactly do you want this to be duplicated in userspace?
What would the benefit be for gnome-shell?

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the xdg mailing list