Changeset 50 for trunk/kernel/mm/kcm.h


Ignore:
Timestamp:
Jun 26, 2017, 3:15:11 PM (7 years ago)
Author:
alain
Message:

bloup

File:
1 edited

Legend:

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

    r23 r50  
    3636 * This structure defines a generic Kernel Cache Manager, that is a block allocator,
    3737 * for fixed size objects. It exists a specific KCM allocator for each object type.
    38  * The actual allocated block size is the smallest multiple of 64 bytes that can
    39  * contain one single object.
     38 * The actual allocated block size is the smallest multiple of the KCM slot, that
     39 * contain one single object. The KCM slot is typically 64 bytes, as it must be large
     40 * enough to store the kcm_page descriptor, defined below.
    4041 * The various KCM allocators themselves are not statically allocated in the cluster
    4142 * manager, but are dynamically allocated when required, using the embedded KCM
     
    4647{
    4748        spinlock_t           lock;             /*! protect exclusive access to allocator   */
    48         uint32_t             block_size;       /*! actual block size (bytes)               */
    49         uint32_t             blocks_nr;        /*! number of blocks per page               */
     49        uint32_t             block_size;       /*! rounded block size (bytes)              */
     50        uint32_t             blocks_nr;        /*! max number of blocks per page           */
    5051
    5152        list_entry_t         active_root;      /*! root of active pages list               */
     
    6465/****************************************************************************************
    6566 * This structure defines a KCM-page descriptor.
    66  * A KCM-page can contain up to (CONFIG_PPM_PAGE_SIZE / CONFIG_CACHE_LINE_SIZE) blocks.
     67 * A KCM-page contains at most (CONFIG_PPM_PAGE_SIZE / CONFIG_KCM_SLOT_SIZE) blocks.
    6768 * This kcm page descriptor is stored in the first slot of the page.
    6869 ***************************************************************************************/
     
    7071typedef struct kcm_page_s
    7172{
    72         uint32_t        bitmap[BITMAP_SIZE(CONFIG_KCM_BLOCKS_MAX)];
    73         uint8_t       * base;                  /*! pointer on first block in page          */
    74         kcm_t         * kcm;                   /*! owner KCM allocator                     */
     73        uint32_t        bitmap[2];             /*! at most 64 blocks in a single page      */
    7574        list_entry_t    list;                  /*! [active / busy / free] list member      */
     75    kcm_t         * kcm;                   /*! pointer on kcm allocator                */ 
    7676        page_t        * page;                  /*! pointer on the physical page descriptor */
    77         uint8_t         refcount;              /*! number of allocated blocks              */
    78         uint8_t         busy;                  /*! page busy if non zero                   */
    79         uint8_t         active;                /*! page active if non zero                 */
    80         uint8_t         unused;                /*!                                         */
     77        uint32_t        count;                 /*! number of allocated blocks              */
     78        uint32_t        busy;                  /*! page busy if non zero                   */
     79        uint32_t        active;                /*! page active if non zero                 */
    8180}
    8281kcm_page_t;
Note: See TracChangeset for help on using the changeset viewer.