Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bfb1179 in mainline


Ignore:
Timestamp:
2018-12-10T10:50:30Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Parents:
dd74b5b
git-author:
Jiri Svoboda <jiri@…> (2018-12-10 07:33:08)
git-committer:
Jiri Svoboda <jiri@…> (2018-12-10 10:50:30)
Message:

No need to compute number of used pages again

In as_area_change_flags we can just use used_space.pages which already
contains the number of used pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/as.c

    rdd74b5b rbfb1179  
    13901390        mutex_unlock(&area->sh_info->lock);
    13911391
    1392         /*
    1393          * Compute total number of used pages
    1394          */
    1395         size_t used_pages = 0;
    1396 
    1397         used_space_ival_t *ival = used_space_first(&area->used_space);
    1398         while (ival != NULL) {
    1399                 used_pages += ival->count;
    1400                 ival = used_space_next(ival);
    1401         }
    1402 
    14031392        /* An array for storing frame numbers */
    1404         uintptr_t *old_frame = malloc(used_pages * sizeof(uintptr_t));
     1393        uintptr_t *old_frame = malloc(area->used_space.pages *
     1394            sizeof(uintptr_t));
    14051395        if (!old_frame) {
    14061396                mutex_unlock(&area->lock);
     
    14231413        size_t frame_idx = 0;
    14241414
    1425         ival = used_space_first(&area->used_space);
     1415        used_space_ival_t *ival = used_space_first(&area->used_space);
    14261416        while (ival != NULL) {
    14271417                uintptr_t ptr = ival->page;
Note: See TracChangeset for help on using the changeset viewer.