Hi, all!
It seems to me that we're allocating shared memory for SLRU lwlocks twice, unless I'm missing something.
SimpleLruShmemSize() calculates total SLRU shared memory size including lwlocks size.
SimpleLruInit() starts with line
shared = (SlruShared) ShmemInitStruct(name,
SimpleLruShmemSize(nslots, nlsns),
&found);
which allocates SLRU shared memory (LWLocks size is included because SimpleLruShmemSize() is used for size computation).
Following line allocates shared memory for LWLocks again:
shared->buffer_locks = (LWLockPadded *) ShmemAlloc(sizeof(LWLockPadded) * nslots);
Attached patch fixes that by removing extra ShmemAlloc for SLRU.