pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: 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:45:36 +0200
Message-ID: <20140610154536.GN8406@alap3.anarazel.de> (raw)
In-Reply-To: <CA+TgmoatSjstqnA2iDiTA3F361nYm6tqCeq1w-29bk6Lqkgfag@mail.gmail.com>
References: <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>
	<28946.1402408948@sss.pgh.pa.us>
	<CA+Tgmoaps4ih-VEKvUgftqJ66_oSo-h9PpHi2_-wAzhVTYnzYw@mail.gmail.com>
	<30117.1402411876@sss.pgh.pa.us>
	<CA+TgmoZ2tDAVB5cLPt=UKHaogw+cfq6ZEis1yCTD_gsBWud9SA@mail.gmail.com>
	<30601.1402413283@sss.pgh.pa.us>
	<CA+TgmoatSjstqnA2iDiTA3F361nYm6tqCeq1w-29bk6Lqkgfag@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 2014-06-10 11:35:23 -0400, Robert Haas wrote:
> > Because it would convert the intended behavior (postmaster and only
> > postmaster is exempt from OOM kill) into a situation where possibly
> > all of the database processes are exempt from OOM kill, at the whim
> > of somebody who should not have the privilege to decide that.
> 
> Gurjeet already refused that argument.

Only that he was wrong:
~# echo -500 > /proc/$BASHPID/oom_score_adj
~# su andres
~$ echo -1000 > /proc/$BASHPID/oom_score_adj
bash: echo: write error: Permission denied # so I can't decrease the likelihood
~$ echo -400 > /proc/$BASHPID/oom_score_adj # but I can increase it
~$ echo -500 > /proc/$BASHPID/oom_score_adj # but also *reset* it

Since we have to do the adjustment after the fork - otherwise the
postmaster would be vulnerable for a time - normal backends can reset
their score.

> Apparently, the child
> processes can only increase their chance of being OOM-killed, not
> decrease it, so you have this exactly backwards: right now, an
> individual system administrator can exempt all of the database
> processes from OOM kill, but cannot exempt the postmaster alone.

Well, if you compile postgres with the #define it'll reset the
likelihood after the fork? That's the reset? Or do you mean without
compiling postgres with the option?

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: <20140610154536.GN8406@alap3.anarazel.de>
Permalink:  ../20140610154536.GN8406@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20140610154536.GN8406@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, robertmhaas@gmail.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: <20140610154536.GN8406@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