Re: Limit allocated memory per session - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Limit allocated memory per session
Date
Msg-id 20091001172029.GF5607@alvh.no-ip.org
Whole thread Raw
In response to Re: Limit allocated memory per session  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Oh, BTW, did anyone get interested in adding the bits to disable the OOM
> > killer for postmaster on the various Linux initscripts?  It needs some
> > games with /proc/<pid>/oom_adj and requires root privileges, but I think
> > an initscript is in an excellent position to do it.
> 
> I was imagining that this would be something for individual distros
> to tackle.  It's probably not portable enough to go into the
> contrib/start-scripts examples.

Hmm?  I think it should be just (as root)

if [ -f /proc/$pid_of_postmaster/oom_adj ]; thenecho -17 > /proc/$pid_of_postmaster/oom_adj
fi

This is supported from 2.6.11 onwards AFAIK.  If the kernel is older
than that, the file would not exist and this would be a noop.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Kenneth Marshall
Date:
Subject: Re: Rejecting weak passwords
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: CommitFest 2009-09, two weeks on