Re: Setting oom_adj on linux?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Setting oom_adj on linux?
Date: 2010-01-08 14:53:59
Message-ID: 201001081453.o08Erxt01807@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alex Hunsaker wrote:
> On Thu, Jan 7, 2010 at 20:26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Alex Hunsaker <badalex(at)gmail(dot)com> writes:
>
> > We can either drop this in core (with a lot of #ifdef LINUX added)
>
> Any thoughts on doing something like (in fork_process.c)
>
> #ifdef LINUX
> void oom_adjust()
> {
> ...
> }
> #else
> void oom_adjust() {}
> #endif
>
> So there is only one #ifdef? It still leaves the ugly calls to the function...

The usual solution for this kind of thing is:

#ifdef LINUX
#define OOM_ADJUST oom_adjust()
#else
#define OOM_ADJUST do {} while (0)
#endif

so there is no call or dummy function and you reference it in the code
as:

OOM_ADJUST;

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-01-08 14:54:16 Re: Serializable Isolation without blocking
Previous Message Kevin Grittner 2010-01-08 14:46:57 Re: Serializable implementation