diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-08-08 16:10:12 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-08-08 16:10:12 -0400 |
commit | af7a535688a758d15f06a98833e6a143b29af9de (patch) | |
tree | bac5ab210bbbbe276f0e44ed84194d7c8bb16aae /ipc/shm.c | |
parent | 0c17e4ceedd35c78b1c7413dbd16279a350be6bc (diff) | |
parent | c41107c2d4fd31924533f4dbc4c3428acc2b5894 (diff) |
Merge http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm into for-rmk
Diffstat (limited to 'ipc/shm.c')
-rw-r--r-- | ipc/shm.c | 24 |
1 files changed, 5 insertions, 19 deletions
@@ -112,23 +112,8 @@ void __init shm_init (void) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | /* | 114 | /* |
115 | * shm_lock_(check_)down routines are called in the paths where the rw_mutex | ||
116 | * is held to protect access to the idr tree. | ||
117 | */ | ||
118 | static inline struct shmid_kernel *shm_lock_down(struct ipc_namespace *ns, | ||
119 | int id) | ||
120 | { | ||
121 | struct kern_ipc_perm *ipcp = ipc_lock_down(&shm_ids(ns), id); | ||
122 | |||
123 | if (IS_ERR(ipcp)) | ||
124 | return (struct shmid_kernel *)ipcp; | ||
125 | |||
126 | return container_of(ipcp, struct shmid_kernel, shm_perm); | ||
127 | } | ||
128 | |||
129 | /* | ||
130 | * shm_lock_(check_) routines are called in the paths where the rw_mutex | 115 | * shm_lock_(check_) routines are called in the paths where the rw_mutex |
131 | * is not held. | 116 | * is not necessarily held. |
132 | */ | 117 | */ |
133 | static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id) | 118 | static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id) |
134 | { | 119 | { |
@@ -211,7 +196,7 @@ static void shm_close(struct vm_area_struct *vma) | |||
211 | 196 | ||
212 | down_write(&shm_ids(ns).rw_mutex); | 197 | down_write(&shm_ids(ns).rw_mutex); |
213 | /* remove from the list of attaches of the shm segment */ | 198 | /* remove from the list of attaches of the shm segment */ |
214 | shp = shm_lock_down(ns, sfd->id); | 199 | shp = shm_lock(ns, sfd->id); |
215 | BUG_ON(IS_ERR(shp)); | 200 | BUG_ON(IS_ERR(shp)); |
216 | shp->shm_lprid = task_tgid_vnr(current); | 201 | shp->shm_lprid = task_tgid_vnr(current); |
217 | shp->shm_dtim = get_seconds(); | 202 | shp->shm_dtim = get_seconds(); |
@@ -577,7 +562,8 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss, | |||
577 | 562 | ||
578 | if (is_file_hugepages(shp->shm_file)) { | 563 | if (is_file_hugepages(shp->shm_file)) { |
579 | struct address_space *mapping = inode->i_mapping; | 564 | struct address_space *mapping = inode->i_mapping; |
580 | *rss += (HPAGE_SIZE/PAGE_SIZE)*mapping->nrpages; | 565 | struct hstate *h = hstate_file(shp->shm_file); |
566 | *rss += pages_per_huge_page(h) * mapping->nrpages; | ||
581 | } else { | 567 | } else { |
582 | struct shmem_inode_info *info = SHMEM_I(inode); | 568 | struct shmem_inode_info *info = SHMEM_I(inode); |
583 | spin_lock(&info->lock); | 569 | spin_lock(&info->lock); |
@@ -931,7 +917,7 @@ invalid: | |||
931 | 917 | ||
932 | out_nattch: | 918 | out_nattch: |
933 | down_write(&shm_ids(ns).rw_mutex); | 919 | down_write(&shm_ids(ns).rw_mutex); |
934 | shp = shm_lock_down(ns, shmid); | 920 | shp = shm_lock(ns, shmid); |
935 | BUG_ON(IS_ERR(shp)); | 921 | BUG_ON(IS_ERR(shp)); |
936 | shp->shm_nattch--; | 922 | shp->shm_nattch--; |
937 | if(shp->shm_nattch == 0 && | 923 | if(shp->shm_nattch == 0 && |