diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/shm.c | 16 | ||||
-rw-r--r-- | ipc/util.c | 19 | ||||
-rw-r--r-- | ipc/util.h | 1 |
3 files changed, 13 insertions, 23 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 | ||
diff --git a/ipc/util.c b/ipc/util.c index 03b88798f71f..e72865f677a7 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -669,25 +669,6 @@ void ipc64_perm_to_ipc_perm (struct ipc64_perm *in, struct ipc_perm *out) | |||
669 | out->seq = in->seq; | 669 | out->seq = in->seq; |
670 | } | 670 | } |
671 | 671 | ||
672 | /* | ||
673 | * So far only shm_get_stat() calls ipc_get() via shm_get(), so ipc_get() | ||
674 | * is called with shm_ids.mutex locked. Since grow_ary() is also called with | ||
675 | * shm_ids.mutex down(for Shared Memory), there is no need to add read | ||
676 | * barriers here to gurantee the writes in grow_ary() are seen in order | ||
677 | * here (for Alpha). | ||
678 | * | ||
679 | * However ipc_get() itself does not necessary require ipc_ids.mutex down. So | ||
680 | * if in the future ipc_get() is used by other places without ipc_ids.mutex | ||
681 | * down, then ipc_get() needs read memery barriers as ipc_lock() does. | ||
682 | */ | ||
683 | struct kern_ipc_perm *ipc_get(struct ipc_ids *ids, int id) | ||
684 | { | ||
685 | struct kern_ipc_perm *out; | ||
686 | int lid = id % SEQ_MULTIPLIER; | ||
687 | out = idr_find(&ids->ipcs_idr, lid); | ||
688 | return out; | ||
689 | } | ||
690 | |||
691 | struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) | 672 | struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) |
692 | { | 673 | { |
693 | struct kern_ipc_perm *out; | 674 | struct kern_ipc_perm *out; |
diff --git a/ipc/util.h b/ipc/util.h index 30b2a6d7cbed..1546eda7d99e 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -103,7 +103,6 @@ void* ipc_rcu_alloc(int size); | |||
103 | void ipc_rcu_getref(void *ptr); | 103 | void ipc_rcu_getref(void *ptr); |
104 | void ipc_rcu_putref(void *ptr); | 104 | void ipc_rcu_putref(void *ptr); |
105 | 105 | ||
106 | struct kern_ipc_perm* ipc_get(struct ipc_ids* ids, int id); | ||
107 | struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id); | 106 | struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id); |
108 | void ipc_lock_by_ptr(struct kern_ipc_perm *ipcp); | 107 | void ipc_lock_by_ptr(struct kern_ipc_perm *ipcp); |
109 | void ipc_unlock(struct kern_ipc_perm* perm); | 108 | void ipc_unlock(struct kern_ipc_perm* perm); |