Buddy System.
More...
Go to the source code of this file.
|
struct | bb_page_t |
| The base structure representing a bb page. More...
|
|
struct | bb_free_area_t |
| Buddy system descriptor: collection of free page blocks. Each block represents 2^k free contiguous page. More...
|
|
struct | bb_instance_t |
| Buddy system instance, that represents a memory area managed by the buddy system. More...
|
|
Buddy System.
- Copyright
- (c) 2014-2024 This file is distributed under the MIT License. See LICENSE.md for details.
◆ bb_alloc_page_cached()
Alloc a page using bb cache.
- Parameters
-
instance | Buddy system instance. |
- Returns
- An allocated page.
◆ bb_alloc_pages()
Allocate a block of page frames of size 2^order.
- Parameters
-
instance | A buddy system instance. |
order | The logarithm of the size of the block. |
- Returns
- The address of the first page descriptor of the block, or NULL.
◆ bb_free_page_cached()
Free a page allocated with bb_alloc_page_cached.
- Parameters
-
instance | Buddy system instance. |
page | The address of the first page descriptor of the block. |
◆ bb_free_pages()
Free a block of page frames of size 2^order.
- Parameters
-
instance | A buddy system instance. |
page | The address of the first page descriptor of the block. |
◆ buddy_system_dump()
Print the size of free_list of each free_area.
- Parameters
-
instance | A buddy system instance. |
◆ buddy_system_get_cached_space()
unsigned long buddy_system_get_cached_space |
( |
bb_instance_t * |
instance | ) |
|
Returns the cached space for the given instance.
- Parameters
-
instance | A buddy system instance. |
- Returns
- The requested total sapce.
◆ buddy_system_get_free_space()
unsigned long buddy_system_get_free_space |
( |
bb_instance_t * |
instance | ) |
|
Returns the free space for the given instance.
- Parameters
-
instance | A buddy system instance. |
- Returns
- The requested total sapce.
◆ buddy_system_get_total_space()
unsigned long buddy_system_get_total_space |
( |
bb_instance_t * |
instance | ) |
|
Returns the total space for the given instance.
- Parameters
-
instance | A buddy system instance. |
- Returns
- The requested total sapce.
◆ buddy_system_init()
Initialize Buddy System.
- Parameters
-
instance | A buddysystem instance. |
name | The name of the current instance (for debug purposes) |
pages_start | The start address of the page structures |
bbpage_offset | The offset from the start of the whole page of the bb_page_t struct. |
pages_stride | The (padded) size of the whole page structure |
pages_count | The number of pages in this region |