pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Gurjeet Singh <gurjeet@singh.im>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: PGSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: /proc/self/oom_adj is deprecated in newer Linux kernels
Date: Tue, 10 Jun 2014 17:09:33 +0200
Message-ID: <20140610150933.GK8406@alap3.anarazel.de> (raw)
In-Reply-To: <30402.1402412692@sss.pgh.pa.us>
References: <29121.1316185073@sss.pgh.pa.us>
	<1316355543.12186.9.camel@vanquo.pezone.net>
	<15953.1316362868@sss.pgh.pa.us>
	<1316420754.14001.3.camel@fsopti579.F-Secure.com>
	<16241.1316441883@sss.pgh.pa.us>
	<CABwTF4XDdYiBQXqj=CKrFXN7x2NiBbVnpHSJG6AVnMBLnLBmLA@mail.gmail.com>
	<20140610143202.GI8406@alap3.anarazel.de>
	<30402.1402412692@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

> Andres Freund <andres@2ndquadrant.com> writes:
> > Independent of the rest of the discussion, I think there's one more
> > point: Trying to keep your system stable by *increasing* the priority of
> > normal backends is a bad idea. If you system gets into OOM land you need
> > to fix that, not whack who gets killed around.
> > The reason it makes sense to increase the priority of the postmaster is
> > that that *does* increase the stability by cleaning up resources and
> > restarting everything.
> 
> That's half of the reason.  The other half is that, at least back when
> we added this code, the Linux kernel's victim-selection code
> disproportionately chose to kill the postmaster rather than any child
> backend, an outcome definitely not to be preferred.  IIRC this was because
> it blamed the postmaster for the sum of childrens' memory sizes *including
> shared memory*, counting the shared memory over again for each child.

That's essentially the same thing. We want the postmaster survive, not
the children...

> I don't know whether our switch away from SysV shmem has helped that, or
> if recent kernel versions have less brain-dead OOM victim selection.
> I'm not terribly hopeful though.

It has gotten much better in the latest few versions. But it'll be a
fair bit till those will be wildly used. And even then, from the
kernel's view, there's just no reason strongly prefer not to kill the
postmaster over other processes without the user providing the information.

On 2014-06-10 11:04:52 -0400, Tom Lane wrote:
> But anyway, yeah, the point of this feature is that the OOM priority
> of the postmaster, and *only* the postmaster, should be raised.  Allowing
> unprivileged people to break that is not attractive on any level.

A superuser could already write a function that echoes into /proc? I
fail to see how a GUC changes the landscape significantly here.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (66+ messages)  latest in thread

Message-ID: <20140610150933.GK8406@alap3.anarazel.de>
Permalink:  ../20140610150933.GK8406@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20140610150933.GK8406@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andres@2ndquadrant.com, tgl@sss.pgh.pa.us, gurjeet@singh.im, peter_e@gmx.net
  Subject: Re: /proc/self/oom_adj is deprecated in newer Linux kernels
  In-Reply-To: <20140610150933.GK8406@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox