Re: shared memory settings: SHMMAX and SHMALL - Mailing list pgsql-general

From Gregory Bittar
Subject Re: shared memory settings: SHMMAX and SHMALL
Date
Msg-id 3AB0E309.10D02A3@iqa.cc
Whole thread Raw
In response to shared memory settings: SHMMAX and SHMALL  (Gregory Bittar <gbittar@iqa.cc>)
Responses Re: shared memory settings: SHMMAX and SHMALL
List pgsql-general
My last reply was made when I was exhausted.  Sorry.

Reconsidering....

According to my /usr/include/asm/shmparam.h,
SHMMAX (should be) <= (PAGE_SIZE << _SHM_IDX_BITS) = (4096 bytes << 15)
= 128MB.

I still don't see where to find the PAGE_SIZE value, although 4096 seems
to be a general default out there.

Also according to my server's /usr/include/asm/shmparam.h,
SHMALL  should be = (1 << (_SHM_IDX_BITS + _SHM_ID_BITS))  = (1 <<
(9+15))  =  16.

I wonder why some people are setting SHMALL and SHMMAX to the same value
when one is a measurement in pages and the other a measurement in
bytes.  Also, I thought that SHMMAX should be the max allotment in bytes
per application, rather than the max shared by all applications.  If I
anticipate 10 postmasters, is it dangerous to set SHMMAX so high?

Tatsuo Ishii wrote:

> > I've spent a whole day trying to figure this out.
> >  Every FAQ I read, between Linux, Postgres, and Oracle,
> > just sends me further into confusion, so I ask:
> >
> > If I have 512MB of memory in my system, excluding swap
> > space,
> > what values do I want to set for SHMMAX and SHMALL?
>
> That depeneds on your kernel implemetaion and hardware. I found
> followings in /usr/include/asm/shmparam.h on my Linux box.
>
> #define _SHM_ID_BITS    7
> #define SHM_ID_MASK     ((1<<_SHM_ID_BITS)-1)
>
> #define SHM_IDX_SHIFT   (_SHM_ID_BITS)
> #define _SHM_IDX_BITS   15
> #define SHM_IDX_MASK    ((1<<_SHM_IDX_BITS)-1)
>
> /*
>  * _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and
>  * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS).
>  */
>
> here PAGE_SIZE == 4096. So I guess we cannot have more than 128MB for
> the shared memory on this platform if above comment is correct.
> --
> Tatsuo Ishii


pgsql-general by date:

Previous
From: Gregory Bittar
Date:
Subject: Re: shared memory settings: SHMMAX and SHMALL
Next
From: Tom Lane
Date:
Subject: Re: Minor disaster after upgrading with cvs.