Changeset 567 for trunk/kernel/mm/kcm.c


Ignore:
Timestamp:
Oct 5, 2018, 12:01:52 AM (6 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/kcm.c

    r551 r567  
    11/*
    2  * kcm.c - Per cluster & per type Kernel Cache Manager access functions
     2 * kcm.c - Per cluster Kernel Cache Manager implementation.
    33 *
    44 * Author  Ghassan Almaless (2008,2009,2010,2011,2012)
     
    2626#include <hal_kernel_types.h>
    2727#include <hal_special.h>
     28#include <busylock.h>
    2829#include <list.h>
    2930#include <printk.h>
     
    3637#include <kcm.h>
    3738
     39
    3840//////////////////////////////////////////////////////////////////////////////////////
    3941// This static function returns pointer on an allocated block from an active page.
     
    219221
    220222        // initialize lock
    221         spinlock_init( &kcm->lock );
     223        busylock_init( &kcm->lock , LOCK_KCM_STATE );
    222224
    223225        // initialize KCM type
     
    248250
    249251        // get KCM lock
    250         spinlock_lock( &kcm->lock );
     252        busylock_acquire( &kcm->lock );
    251253
    252254        // release all free pages
     
    278280
    279281        // release KCM lock
    280         spinlock_unlock( &kcm->lock );
     282        busylock_release( &kcm->lock );
    281283}
    282284
     
    288290
    289291        // get lock
    290         uint32_t     irq_state;
    291         spinlock_lock_busy( &kcm->lock, &irq_state );
     292        busylock_acquire( &kcm->lock );
    292293
    293294        // get an active page
     
    299300                if( kcm_page == NULL )
    300301                {
    301                         spinlock_unlock_busy( &kcm->lock, irq_state );
     302                        busylock_release( &kcm->lock );
    302303                        return NULL;
    303304                }
     
    319320
    320321        // release lock
    321         spinlock_unlock_busy( &kcm->lock, irq_state );
     322        busylock_release( &kcm->lock );
    322323
    323324        return ptr;
     
    336337
    337338        // get lock
    338         spinlock_lock( &kcm->lock );
     339        busylock_acquire( &kcm->lock );
    339340
    340341        // release block
     
    342343
    343344        // release lock
    344         spinlock_unlock( &kcm->lock );
     345        busylock_release( &kcm->lock );
    345346}
    346347
Note: See TracChangeset for help on using the changeset viewer.