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


Ignore:
Timestamp:
Jan 13, 2021, 12:36:17 AM (3 years ago)
Author:
alain
Message:

All modifications required to support the <tcp_chat> application
including error recovery in case of packet loss.A

File:
1 edited

Legend:

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

    r672 r683  
    3232#include <kmem.h>
    3333
    34 
    35 #define KCM_PAGE_FULL     0
    36 #define KCM_PAGE_EMPTY    1
    37 #define KCM_PAGE_ACTIVE   2
    38 
    3934/****************************************************************************************
    40  * This structure defines a generic Kernel Cache Manager, that is a block allocator,
    41  * for fixed size objects. It exists in each cluster a specific KCM allocator for
    42  * the following block sizes: 64, 128, 256, 512, 1024, 2048 bytes.
    43  * These six KCM allocators are initialized by the cluster_init() function.
     35 * This structure defines a generic Kernel Cache Manager, a fixed size block allocator.
     36 * It returns an aligned block whose size is a power of 2, not smaller than a cache line,
     37 * but smaller than a small PPM page. It exists in each cluster a specific KCM allocator
     38 * for each possible block size. When the cache line contains 64 bytes and the page
     39 * contains 4K bytes, the possible block sizes are 64, 128, 256, 512, 1024, 2048 bytes.
     40 * These KCM allocators are initialized by the cluster_init() function.
    4441 *
    45  * Each KCM cache is implemented as a set o 4 Kbytes pages. A kcm_page is split in slots,
    46  * where each slot can contain one block. in each kcm_page, the first slot (that cannot
    47  * be smaller than 64 bytes) contains the kcm page descriptor, defined below
     42 * Each KCM cache is implemented as a set of "kcm_pages": a "kcm_page" is an aligned
     43 * buffer in physical memory (allocated by the PPM allocator) such as :
     44 *       buffer_size = block_size * 64  <=>  buffer_order = block_order + 6.
     45 *
     46 * A kcm_page contains always 64 kcm_blocks, but the first block (that cannot be smaller
     47 * than 64 bytes) is used to store the kcm_page descriptor defining the page allocation
     48 * status, and cannot be allocated to store data.
     49 *
     50 * A KCM cache is extensible, as new kcm_pages are dynamically allocated from the PPM
     51 * allocator when required. For a given KCM cache the set of kcm_pages is split in two
     52 * lists: the list of "full" pages (containing 63 allocated blocks), and the list of
     53 * "active" pages (containing at least one free block). An "empty" page (containing
     54 * only free blocks) is considered active, and is not released to PPM.
    4855 *
    4956 * To allow any thread running in any cluster to directly access the KCM of any cluster,
     
    6269
    6370        uint32_t             order;            /*! ln( block_size )                        */
    64         uint32_t             max_blocks;       /*! max number of blocks per page           */
    6571}
    6672kcm_t;
     
    8490        list_entry_t        list;              /*! [active / busy / free] list member      */
    8591        kcm_t             * kcm;               /*! pointer on kcm allocator                */
    86         page_t            * page;              /*! pointer on the physical page descriptor */
     92        page_t            * page;              /*! pointer on physical page descriptor    */
    8793}
    8894kcm_page_t;
     
    120126 ****************************************************************************************
    121127 * @ block_ptr   : local pointer on the released block.
     128 * @ order       : log2( block_size in bytes ).
    122129 ***************************************************************************************/
    123 void kcm_free( void    * block_ptr );
     130void kcm_free( void    * block_ptr,
     131               uint32_t  order );
    124132
    125133
     
    143151 * @ kcm_cxy     : remote KCM cluster identifier.
    144152 * @ block_ptr   : local pointer on the released buffer in remote cluster.
     153 * @ order       : log2( block_size in bytes ).
    145154 ***************************************************************************************/
    146155void kcm_remote_free( cxy_t     kcm_cxy,
    147                       void    * block_ptr );
     156                      void    * block_ptr,
     157                      uint32_t  order );
    148158
    149159/****************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.