diff options
Diffstat (limited to 'ipc/shm.c')
-rw-r--r-- | ipc/shm.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -63,8 +63,6 @@ static struct ipc_ids init_shm_ids; | |||
63 | ((struct shmid_kernel*)ipc_lock(&shm_ids(ns),id)) | 63 | ((struct shmid_kernel*)ipc_lock(&shm_ids(ns),id)) |
64 | #define shm_unlock(shp) \ | 64 | #define shm_unlock(shp) \ |
65 | ipc_unlock(&(shp)->shm_perm) | 65 | ipc_unlock(&(shp)->shm_perm) |
66 | #define shm_get(ns, id) \ | ||
67 | ((struct shmid_kernel*)ipc_get(&shm_ids(ns),id)) | ||
68 | #define shm_buildid(ns, id, seq) \ | 66 | #define shm_buildid(ns, id, seq) \ |
69 | ipc_buildid(&shm_ids(ns), id, seq) | 67 | ipc_buildid(&shm_ids(ns), id, seq) |
70 | 68 | ||
@@ -563,7 +561,19 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss, | |||
563 | struct shmid_kernel *shp; | 561 | struct shmid_kernel *shp; |
564 | struct inode *inode; | 562 | struct inode *inode; |
565 | 563 | ||
566 | shp = shm_get(ns, next_id); | 564 | /* |
565 | * idr_find() is called via shm_get(), so with shm_ids.mutex | ||
566 | * locked. Since ipc_addid() is also called with | ||
567 | * shm_ids.mutex down, there is no need to add read barriers | ||
568 | * here to gurantee the writes in ipc_addid() are seen in | ||
569 | * order here (for Alpha). | ||
570 | * However idr_find() itself does not necessary require | ||
571 | * ipc_ids.mutex down. So if idr_find() is used by other | ||
572 | * places without ipc_ids.mutex down, then it needs read | ||
573 | * read memory barriers as ipc_lock() does. | ||
574 | */ | ||
575 | |||
576 | shp = idr_find(&shm_ids(ns).ipcs_idr, next_id); | ||
567 | if (shp == NULL) | 577 | if (shp == NULL) |
568 | continue; | 578 | continue; |
569 | 579 | ||