Changeset 433d52f in mainline


Ignore:
Timestamp:
2018-12-10T11:15:10Z (5 years ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f87a85a
Parents:
247fdea
git-author:
Jiri Svoboda <jiri@…> (2018-12-10 07:33:08)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2018-12-10 11:15:10)
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

    r247fdea r433d52f  
    13951395        mutex_unlock(&area->sh_info->lock);
    13961396
    1397         /*
    1398          * Compute total number of used pages
    1399          */
    1400         size_t used_pages = 0;
    1401 
    1402         used_space_ival_t *ival = used_space_first(&area->used_space);
    1403         while (ival != NULL) {
    1404                 used_pages += ival->count;
    1405                 ival = used_space_next(ival);
    1406         }
    1407 
    14081397        /* An array for storing frame numbers */
    1409         uintptr_t *old_frame = malloc(used_pages * sizeof(uintptr_t));
     1398        uintptr_t *old_frame = malloc(area->used_space.pages *
     1399            sizeof(uintptr_t));
    14101400        if (!old_frame) {
    14111401                mutex_unlock(&area->lock);
     
    14281418        size_t frame_idx = 0;
    14291419
    1430         ival = used_space_first(&area->used_space);
     1420        used_space_ival_t *ival = used_space_first(&area->used_space);
    14311421        while (ival != NULL) {
    14321422                uintptr_t ptr = ival->page;
Note: See TracChangeset for help on using the changeset viewer.