ShmemAlloc() alignment patch
От | Qingqing Zhou |
---|---|
Тема | ShmemAlloc() alignment patch |
Дата | |
Msg-id | e97esc$1aa6$1@news.hub.org обсуждение исходный текст |
Ответы |
Re: ShmemAlloc() alignment patch
|
Список | pgsql-hackers |
In ShmemAlloc() we have: newStart = BUFFERALIGN(newStart); newSpace = (void *) (ShmemBase + newStart); return newSpace; Notice that though newStart is ALIGNOF_BUFFER, ShmemBase is not. Thus the newSpace is not aligned as we disired. Attached please find the patch. Regards, Qingqing Index: src/backend/storage/ipc/shmem.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v retrieving revision 1.92 diff -c -r1.92 shmem.c *** src/backend/storage/ipc/shmem.c 13 Jul 2006 16:49:16 -0000 1.92 --- src/backend/storage/ipc/shmem.c 14 Jul 2006 06:47:43 -0000 *************** *** 169,178 **** SpinLockAcquire(ShmemLock); newStart = shmemseghdr->freeoffset; /* extra alignment for large requests, since they are probably buffers */ if (size >= BLCKSZ) ! newStart = BUFFERALIGN(newStart); newFree = newStart + size; if (newFree <= shmemseghdr->totalsize) --- 169,179 ---- SpinLockAcquire(ShmemLock); newStart = shmemseghdr->freeoffset; + newSpace = (void *) MAKE_PTR(newStart); /* extra alignment for large requests, since they are probably buffers */ if (size >= BLCKSZ) ! newStart = MAKE_OFFSET(BUFFERALIGN(newSpace)); newFree = newStart + size; if (newFree <= shmemseghdr->totalsize)
В списке pgsql-hackers по дате отправления: