Affinity shared memory area must be at least a page
If the system page size is greater than 4kB (or 32kB in the case of BIGNUMA), then the affinity code will fail to initialise. Ensure the shared memory area is at least one page in size.
This commit is contained in:
parent
8519e4ed9f
commit
749e605e9d
|
@ -555,24 +555,24 @@ static inline int is_dead(int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void open_shmem(void) {
|
static void open_shmem(void) {
|
||||||
|
int shm_size = 4096;
|
||||||
|
|
||||||
|
#if defined(BIGNUMA)
|
||||||
|
// raised to 32768, enough for 128 nodes and 1024 cups
|
||||||
|
shm_size = 32*1024;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// needs to be at least one page
|
||||||
|
shm_size = MAX(getpagesize(), shm_size);
|
||||||
|
|
||||||
int try = 0;
|
int try = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
#if defined(BIGNUMA)
|
shmid = shmget(SH_MAGIC, shm_size, 0666);
|
||||||
// raised to 32768, enough for 128 nodes and 1024 cups
|
|
||||||
shmid = shmget(SH_MAGIC, 32768, 0666);
|
|
||||||
#else
|
|
||||||
shmid = shmget(SH_MAGIC, 4096, 0666);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (shmid == -1) {
|
if (shmid == -1) {
|
||||||
#if defined(BIGNUMA)
|
shmid = shmget(SH_MAGIC, shm_size, IPC_CREAT | 0666);
|
||||||
shmid = shmget(SH_MAGIC, 32768, IPC_CREAT | 0666);
|
|
||||||
#else
|
|
||||||
shmid = shmget(SH_MAGIC, 4096, IPC_CREAT | 0666);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try ++;
|
try ++;
|
||||||
|
|
Loading…
Reference in New Issue