mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Page allocator moved from pools to IO loops.
The resource pool system is highly hierarchical and keeping spare pages in pools leads to unnecessarily complex memory management. Loops have a flat hiearchy, at least for now, and it is therefore much easier to keep care of pages, especially in cases of excessive virtual memory fragmentation.
This commit is contained in:
@@ -7,6 +7,20 @@
|
||||
#ifndef _BIRD_SYSDEP_UNIX_IO_LOOP_H_
|
||||
#define _BIRD_SYSDEP_UNIX_IO_LOOP_H_
|
||||
|
||||
#include "nest/bird.h"
|
||||
|
||||
#include "lib/lists.h"
|
||||
#include "lib/event.h"
|
||||
#include "lib/timer.h"
|
||||
|
||||
struct free_pages
|
||||
{
|
||||
list list; /* List of empty pages */
|
||||
event *cleanup; /* Event to call when number of pages is outside bounds */
|
||||
u16 min, max; /* Minimal and maximal number of free pages kept */
|
||||
uint cnt; /* Number of empty pages */
|
||||
};
|
||||
|
||||
struct birdloop
|
||||
{
|
||||
resource r;
|
||||
@@ -29,10 +43,17 @@ struct birdloop
|
||||
|
||||
uint links;
|
||||
|
||||
struct free_pages pages;
|
||||
|
||||
void (*stopped)(void *data);
|
||||
void *stop_data;
|
||||
|
||||
struct birdloop *prev_loop;
|
||||
};
|
||||
|
||||
extern _Thread_local struct birdloop *birdloop_current;
|
||||
|
||||
void init_pages(struct birdloop *loop);
|
||||
void flush_pages(struct birdloop *loop);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user