Re: 2.3.31 - shm broken on Alpha ?

Manfred (manfreds@colorfullife.com)
Sat, 11 Dec 1999 23:06:13 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0051_01BF442C.52246570
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

From: Dave Gilbert <gilbertd@treblig.org>
> A diff of the /proc/sysvipc/shm before and after the gnome app was run
> reveals differences like:
>
> key shmid perms size cpid lpid nattch uid gid cuid cgid
> atime dtime ctime
> 0 37158914 777 262144 15725 15558 0 9031 800 9031 800
> 944942965 944942966 944942965
>
> Two things I can notice which are odd about this (but I haven't gone back
> to a previous version to look):
> 1) The shmid is a great big hairy number.

That's OK, the new shmid number are great big hairy numbers:
the hex value is 0x2370002: it's the third (2, 0-based) shm segment, and the
sequence number is 0x46e (shmid/32768). These changes were nessecary to add
sysctl support.

> Ideas?

There were major changes in the shm code, and I couldn't test them on a
64-bit computer. Could you please compile and run the attached test program?
./shmtst 8 100000 20 20 0
or
./shmtst 8 100000 20 20 1 [you'll see lots of messages about deleted
segments]

Btw, are you running a SMP or UP kernel?

------=_NextPart_000_0051_01BF442C.52246570
Content-Type: application/octet-stream;
name="shmtst.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="shmtst.c"

#include <stdlib.h>
#include <stdio.h>

#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>

int main (int ac, char **av) {
int segs, size, proc, rmpr;
unsigned long long iter;
pid_t pid;

if (ac < 5) {
printf ("usage: shmtst segs size proc iter rm%%\n");
exit (1);
}
segs = atoi (av[1]);
size = atoi (av[2]);
proc = atoi (av[3]);
iter = atoi (av[4]);
rmpr = atoi (av[5]);

iter = 1 << iter;
printf ("using %d segs of size %d (%llu iterations)\n",
segs, size, iter);
while (-- proc) {
if ((pid = fork()) > 0) {
printf ("started process %d\n", (int) pid);
} else {
break;
}
}
srandom (getpid());
while (iter--) {
key_t key;
int seg, i;
char *ptr, *p;

key = random() % segs +1;
if ((seg = shmget (key, size, IPC_CREAT| 0600)) == -1) {
perror("shmget");
if (errno != EIDRM)
exit (1);
continue;
}
if ((ptr = shmat (seg, 0, 0)) == NULL) {
perror ("shmat");
continue;
}
for (i = 0 ; i < size; i += 4097)
ptr[i] = (char) i;

for (i = 0 ; i < size; i += 4097){
if (ptr[i] != (char)i)
printf ("ptr[%i] != %i\n", (int)ptr[i], (int)i);
}

if (shmdt (ptr) != 0) {
perror("shmdt");
exit (1);
}
if (random () % 100 < rmpr &&
shmctl (seg, IPC_RMID, NULL) == -1)
perror("shmctl IPC_RMID");
}
}

------=_NextPart_000_0051_01BF442C.52246570--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/