Changeset c739102 in mainline for kernel/generic/src/mm/backend_anon.c
- Timestamp:
- 2012-11-21T23:26:22Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2c80a
- Parents:
- bebf97d (diff), 1f7753a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/backend_anon.c
rbebf97d rc739102 59 59 static void anon_destroy(as_area_t *); 60 60 61 static bool anon_is_resizable(as_area_t *); 62 static bool anon_is_shareable(as_area_t *); 63 61 64 static int anon_page_fault(as_area_t *, uintptr_t, pf_access_t); 62 65 static void anon_frame_free(as_area_t *, uintptr_t, uintptr_t); … … 68 71 .destroy = anon_destroy, 69 72 73 .is_resizable = anon_is_resizable, 74 .is_shareable = anon_is_shareable, 75 70 76 .page_fault = anon_page_fault, 71 77 .frame_free = anon_frame_free, … … 74 80 bool anon_create(as_area_t *area) 75 81 { 82 if (area->flags & AS_AREA_LATE_RESERVE) 83 return true; 84 76 85 return reserve_try_alloc(area->pages); 77 86 } … … 79 88 bool anon_resize(as_area_t *area, size_t new_pages) 80 89 { 90 if (area->flags & AS_AREA_LATE_RESERVE) 91 return true; 92 81 93 if (new_pages > area->pages) 82 94 return reserve_try_alloc(new_pages - area->pages); … … 100 112 ASSERT(mutex_locked(&area->as->lock)); 101 113 ASSERT(mutex_locked(&area->lock)); 114 ASSERT(!(area->flags & AS_AREA_LATE_RESERVE)); 102 115 103 116 /* … … 139 152 void anon_destroy(as_area_t *area) 140 153 { 154 if (area->flags & AS_AREA_LATE_RESERVE) 155 return; 156 141 157 reserve_free(area->pages); 142 158 } 143 159 160 bool anon_is_resizable(as_area_t *area) 161 { 162 return true; 163 } 164 165 bool anon_is_shareable(as_area_t *area) 166 { 167 return !(area->flags & AS_AREA_LATE_RESERVE); 168 } 144 169 145 170 /** Service a page fault in the anonymous memory address space area. … … 225 250 * the different causes 226 251 */ 252 253 if (area->flags & AS_AREA_LATE_RESERVE) { 254 /* 255 * Reserve the memory for this page now. 256 */ 257 if (!reserve_try_alloc(1)) { 258 printf("Killing task %" PRIu64 " due to a " 259 "failed late reservation request.\n", 260 TASK->taskid); 261 TASK->silent_kill = true; 262 return AS_PF_FAULT; 263 } 264 } 265 227 266 kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE); 228 267 memsetb((void *) kpage, PAGE_SIZE, 0); … … 255 294 ASSERT(mutex_locked(&area->lock)); 256 295 257 frame_free_noreserve(frame); 296 if (area->flags & AS_AREA_LATE_RESERVE) { 297 /* 298 * In case of the late reserve areas, physical memory will not 299 * be unreserved when the area is destroyed so we need to use 300 * the normal unreserving frame_free(). 301 */ 302 frame_free(frame); 303 } else { 304 /* 305 * The reserve will be given back when the area is destroyed or 306 * resized, so use the frame_free_noreserve() which does not 307 * manipulate the reserve or it would be given back twice. 308 */ 309 frame_free_noreserve(frame); 310 } 258 311 } 259 312
Note:
See TracChangeset
for help on using the changeset viewer.