diff -NurpP --minimal linux-2.6.11-rc4-vs1.9.4.4.1/ipc/shm.c linux-2.6.11-rc4-vs1.9.4.5/ipc/shm.c --- linux-2.6.11-rc4-vs1.9.4.4.1/ipc/shm.c 2005-02-16 05:38:47 +0100 +++ linux-2.6.11-rc4-vs1.9.4.5/ipc/shm.c 2005-02-17 09:44:18 +0100 @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include "util.h" @@ -111,7 +113,12 @@ static void shm_open (struct vm_area_str */ static void shm_destroy (struct shmid_kernel *shp) { - shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; + struct vx_info *vxi = locate_vx_info(shp->shm_perm.xid); + int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; + + vx_ipcshm_sub(vxi, shp, numpages); + shm_tot -= numpages; + shm_rmid (shp->id); shm_unlock(shp); if (!is_file_hugepages(shp->shm_file)) @@ -121,6 +128,7 @@ static void shm_destroy (struct shmid_ke shp->mlock_user); fput (shp->shm_file); security_shm_free(shp); + put_vx_info(vxi); ipc_rcu_putref(shp); } @@ -187,6 +195,8 @@ static int newseg (key_t key, int shmflg if (shm_tot + numpages >= shm_ctlall) return -ENOSPC; + if (!vx_ipcshm_avail(current->vx_info, numpages)) + return -ENOSPC; shp = ipc_rcu_alloc(sizeof(*shp)); if (!shp) @@ -235,6 +245,7 @@ static int newseg (key_t key, int shmflg else file->f_op = &shm_file_operations; shm_tot += numpages; + vx_ipcshm_add(current->vx_info, key, numpages); shm_unlock(shp); return shp->id;