Changeset 38dc82d in mainline for kernel/generic/src/synch/futex.c


Ignore:
Timestamp:
2016-08-31T14:16:45Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
346b12a2
Parents:
dc05a9a
Message:

Make page_mapping_find() return a copy rather than the actual PTE

This makes page_mapping_find() more suitable for use with lock-free data
structures such as CHT that guarantee existence of the data only for
some limited time while a condition holds (e.g. inside of a RCU-protected
critical section that must be around all CHT lookups).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/futex.c

    rdc05a9a r38dc82d  
    291291        spinlock_lock(&futex_ht_lock);
    292292
    293         bool found = false;
    294         pte_t *t = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE), true);
    295        
    296         if (t && PTE_VALID(t) && PTE_PRESENT(t)) {
    297                 found = true;
    298                 *paddr = PTE_GET_FRAME(t) + (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
     293        bool success = false;
     294
     295        pte_t t;
     296        bool found;
     297
     298        found = page_mapping_find(AS, ALIGN_DOWN(uaddr, PAGE_SIZE), true, &t);
     299        if (found && PTE_VALID(&t) && PTE_PRESENT(&t)) {
     300                success = true;
     301                *paddr = PTE_GET_FRAME(&t) +
     302                    (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
    299303        }
    300304       
     
    302306        page_table_unlock(AS, false);
    303307       
    304         return found;
     308        return success;
    305309}
    306310
Note: See TracChangeset for help on using the changeset viewer.