Changes in kernel/generic/src/mm/backend_anon.c [59fb782:38dc82d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/backend_anon.c
r59fb782 r38dc82d 76 76 .page_fault = anon_page_fault, 77 77 .frame_free = anon_frame_free, 78 79 .create_shared_data = NULL, 80 .destroy_shared_data = NULL 78 81 }; 79 82 … … 118 121 */ 119 122 mutex_lock(&area->sh_info->lock); 120 list_foreach(area->used_space.leaf_list, cur) {121 btree_node_t *node;123 list_foreach(area->used_space.leaf_list, leaf_link, btree_node_t, 124 node) { 122 125 unsigned int i; 123 126 124 node = list_get_instance(cur, btree_node_t, leaf_link);125 127 for (i = 0; i < node->keys; i++) { 126 128 uintptr_t base = node->key[i]; … … 129 131 130 132 for (j = 0; j < count; j++) { 131 pte_t *pte; 133 pte_t pte; 134 bool found; 132 135 133 136 page_table_lock(area->as, false); 134 pte = page_mapping_find(area->as, 135 base + P2SZ(j), false); 136 ASSERT(pte && PTE_VALID(pte) && 137 PTE_PRESENT(pte)); 137 found = page_mapping_find(area->as, 138 base + P2SZ(j), false, &pte); 139 140 ASSERT(found); 141 ASSERT(PTE_VALID(&pte)); 142 ASSERT(PTE_PRESENT(&pte)); 143 138 144 btree_insert(&area->sh_info->pagemap, 139 145 (base + P2SZ(j)) - area->base, 140 (void *) PTE_GET_FRAME( pte), NULL);146 (void *) PTE_GET_FRAME(&pte), NULL); 141 147 page_table_unlock(area->as, false); 142 148 143 pfn_t pfn = ADDR2PFN(PTE_GET_FRAME( pte));149 pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(&pte)); 144 150 frame_reference_add(pfn); 145 151 } … … 191 197 return AS_PF_FAULT; 192 198 193 if (area->sh_info) { 199 mutex_lock(&area->sh_info->lock); 200 if (area->sh_info->shared) { 194 201 btree_node_t *leaf; 195 202 … … 201 208 * mapping, a new frame is allocated and the mapping is created. 202 209 */ 203 mutex_lock(&area->sh_info->lock);204 210 frame = (uintptr_t) btree_search(&area->sh_info->pagemap, 205 211 upage - area->base, &leaf); … … 233 239 } 234 240 frame_reference_add(ADDR2PFN(frame)); 235 mutex_unlock(&area->sh_info->lock);236 241 } else { 237 242 … … 255 260 * Reserve the memory for this page now. 256 261 */ 257 if (!reserve_try_alloc(1)) 262 if (!reserve_try_alloc(1)) { 263 mutex_unlock(&area->sh_info->lock); 258 264 return AS_PF_SILENT; 265 } 259 266 } 260 267 … … 263 270 km_temporary_page_put(kpage); 264 271 } 272 mutex_unlock(&area->sh_info->lock); 265 273 266 274 /* … … 295 303 * the normal unreserving frame_free(). 296 304 */ 297 frame_free(frame );305 frame_free(frame, 1); 298 306 } else { 299 307 /* … … 302 310 * manipulate the reserve or it would be given back twice. 303 311 */ 304 frame_free_noreserve(frame );312 frame_free_noreserve(frame, 1); 305 313 } 306 314 }
Note:
See TracChangeset
for help on using the changeset viewer.