desktop entry proposal: TerminateSafe=true key

Brian J. Tarricone brian at
Sun May 9 19:50:25 PDT 2010

On 05/07/2010 10:53 AM, Lennart Poettering wrote:
> If this is added to the .desktop files too, then I'd however suggest to
> follow the oom_adj semantics closely, and make the field a nice-like
> value instead of a boolean. And it might be an idea to prefix this with
> X- or so, because then it becomes Linux-specific. Example:
> X-OOMAdjust=10

The problem with this is that it changes the semantics of Colin's
proposal in an important (and I think unfortunate) way.

TerminateSafe is a boolean because it actually represents application
behavior: either a) the application constantly saves its state so that
terminating it at any time is fine, or b) the application requires
manual user intervention to save state, so terminating it at any time
can cause data loss.  (There might be other reasons aside from user
state as to why it is/isn't safe to terminate, of course.)

The point of TerminateSafe isn't to decide (on a fine-grained level) how
amenable an application is to being arbitrarily terminated.  It's to
determine if it's ok or it's not ok.  Binary.  If, in the end, the
system is so fubar'd that some TerminateSafe=false apps end up getting
killed, then that sucks, but ok.

I don't think we want (or need) to push a fine-grained oom_adj value
onto application developers.  Who is to say that a video-editing
application should have a higher (or lower) oom_adj value than a word
processing app?  Sure, you could have a list of recommended values for
oom_adj based on some measure of an app's "importance," but that just
seems overly complicated and a bit arbitrary.  The desktop should be in
control of this (or the user, but, really, how many users could we
expect to actually care enough to tweak their applications' relative
"don't kill me" priorities?), not the app developer.

I think someone (Colin as well?) also mentioned that it could be used as
a part of logout -- the session manager need not ask the application to
save and quit if it knows that the app is ok with arbitrary termination.
 A recommended oom_adj value could not provide this information.

I think this is just a case of trying to tie the behavior of a
high-level concept to the low-level implementation.


P.S. I also think that some of the other OOM decisions should be handled
in another way: for example, things like Xorg should be kept alive at
all costs if possible, not just because it's "important," but because
killing Xorg would also kill TerminateSafe=false apps.  That policy
should be set using some other mechanism -- possibly not even a
standardized one, just perhaps Xorg should set oom_adj on startup (if it
doesn't already), since it's a bit of a special case.

More information about the xdg mailing list