On Tue, Jan 04, 2011 at 09:51:05AM -0800, Jeff Janes wrote:
> > Correct. The kernel ignores locking requests because it's a great way
> > to DOS a machine. For example, mlock() of large blocks of memory is
> > also not permitted for similar reasons.
> 
> Does it ignore such requests in general, or only under certain situations?
> 
> If the latter, do you know what those situations are?

Well, not in general, but for shared memory it's ignored (not sure
about if you're root). It used to be that shared memory was always
locked, which sounds like a great idea, until people started abusing it.

So now shared memory is on ethe same footing as other memory. Not sure
where I read this, I know it came up several years ago. I think it
changed back in 2.0 times.

> RLIMIT_MEMLOCK exists, it has a small default hard limit, and only
> root can increase that.  If root has gone out of its way to grant the
> postgres user a higher limit, the kernel should respect that, at least
> up until the situation become truly desperate.

Like I said, not sure about how it works for root.

> Unfortunately it is hard to know what the kernel considers to be
> significant memory pressure.
> 
> My experience (from mostly non-pgsql work) is that kernel has what I
> would consider enough cache memory to throw away, but for some reason
> doesn't throw it away but does more counter productive things instead.

Possibly. Everyone always considers their memory to be more important
than all other memory on the system, but the kernel has a much better
idea of what's going on than the user. That doesn't mean it's without
fault or couldn't be improved.

But if there's a bunch of shared memory not being accessed very often
and the kernel thinks it's better used somewhere else, it may be right.
Repeatable test cases in this area are really hard.

Have a nice day,
-- 
Martijn van Oosterhout   <klep...@svana.org>   http://svana.org/kleptog/
> Patriotism is when love of your own people comes first; nationalism,
> when hate for people other than your own comes first. 
>                                       - Charles de Gaulle

Attachment: signature.asc
Description: Digital signature

Reply via email to