Re: Setting oom_adj on linux?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Magnus Hagander <magnus@hagander.net>
Cc: Alex Hunsaker <badalex@gmail.com>, Alvaro Herrera <alvherre@commandprompt.com>, Andrew Dunstan <andrew@dunslane.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-01-08T14:27:53Z
Lists: pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> Do we need to make the value configurable? I'd certainly find it
> interesting to set backends to say 5 or something like that, that
> makes them less likely to be killed than any old "oops opened too big
> file in an editor"-process, but still possible to kill if the system
> is *really* running out of memory.

I don't want to go to the trouble of creating (and documenting) a
configure option for this.  Much less a GUC ;-)

What I suggest is that we do something like

	#ifdef LINUX_OOM_ADJ
	...
	fprintf(oom, "%d\n", LINUX_OOM_ADJ);
	...
	#endif

Then, somebody who wants the feature would build with, say,
	-DLINUX_OOM_ADJ=0
or another value if they want that.

			regards, tom lane