Changeset 683 for trunk/kernel/mm/kcm.h
- Timestamp:
- Jan 13, 2021, 12:36:17 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/kcm.h
r672 r683 32 32 #include <kmem.h> 33 33 34 35 #define KCM_PAGE_FULL 036 #define KCM_PAGE_EMPTY 137 #define KCM_PAGE_ACTIVE 238 39 34 /**************************************************************************************** 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. 44 41 * 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. 48 55 * 49 56 * To allow any thread running in any cluster to directly access the KCM of any cluster, … … 62 69 63 70 uint32_t order; /*! ln( block_size ) */ 64 uint32_t max_blocks; /*! max number of blocks per page */65 71 } 66 72 kcm_t; … … 84 90 list_entry_t list; /*! [active / busy / free] list member */ 85 91 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 */ 87 93 } 88 94 kcm_page_t; … … 120 126 **************************************************************************************** 121 127 * @ block_ptr : local pointer on the released block. 128 * @ order : log2( block_size in bytes ). 122 129 ***************************************************************************************/ 123 void kcm_free( void * block_ptr ); 130 void kcm_free( void * block_ptr, 131 uint32_t order ); 124 132 125 133 … … 143 151 * @ kcm_cxy : remote KCM cluster identifier. 144 152 * @ block_ptr : local pointer on the released buffer in remote cluster. 153 * @ order : log2( block_size in bytes ). 145 154 ***************************************************************************************/ 146 155 void kcm_remote_free( cxy_t kcm_cxy, 147 void * block_ptr ); 156 void * block_ptr, 157 uint32_t order ); 148 158 149 159 /****************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.