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

Changeset 25a76ab8 in mainline for kernel/generic/src/mm/as.c


Ignore:
Timestamp:
2010-05-08T07:53:23Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
051bc69a
Parents:
6c39a907 (diff), 1317380 (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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r6c39a907 r25a76ab8  
    11/*
    2  * Copyright (c) 2001-2006 Jakub Jermar
     2 * Copyright (c) 2010 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    152152         * reference count never drops to zero.
    153153         */
    154         atomic_set(&AS_KERNEL->refcount, 1);
     154        as_hold(AS_KERNEL);
    155155}
    156156
     
    200200        DEADLOCK_PROBE_INIT(p_asidlock);
    201201
     202        ASSERT(as != AS);
    202203        ASSERT(atomic_get(&as->refcount) == 0);
    203204       
    204205        /*
    205          * Since there is no reference to this area,
    206          * it is safe not to lock its mutex.
     206         * Since there is no reference to this address space, it is safe not to
     207         * lock its mutex.
    207208         */
    208209
     
    225226        preemption_enable();    /* Interrupts disabled, enable preemption */
    226227        if (as->asid != ASID_INVALID && as != AS_KERNEL) {
    227                 if (as != AS && as->cpu_refcount == 0)
     228                if (as->cpu_refcount == 0)
    228229                        list_remove(&as->inactive_as_with_asid_link);
    229230                asid_put(as->asid);
     
    258259
    259260        slab_free(as_slab, as);
     261}
     262
     263/** Hold a reference to an address space.
     264 *
     265 * Holding a reference to an address space prevents destruction of that address
     266 * space.
     267 *
     268 * @param a             Address space to be held.
     269 */
     270void as_hold(as_t *as)
     271{
     272        atomic_inc(&as->refcount);
     273}
     274
     275/** Release a reference to an address space.
     276 *
     277 * The last one to release a reference to an address space destroys the address
     278 * space.
     279 *
     280 * @param a             Address space to be released.
     281 */
     282void as_release(as_t *as)
     283{
     284        if (atomic_predec(&as->refcount) == 0)
     285                as_destroy(as);
    260286}
    261287
Note: See TracChangeset for help on using the changeset viewer.