git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reduce the size of ppage by 8 bytes using signly linked list
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
ds
/
lru.h
diff --git
a/lunaix-os/includes/lunaix/ds/lru.h
b/lunaix-os/includes/lunaix/ds/lru.h
index 76c959749c69b7675daeebd5c792db8752001084..622d6e4bcb176c819a72943246b02c69885452ae 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/lru.h
+++ b/
lunaix-os/includes/lunaix/ds/lru.h
@@
-2,6
+2,7
@@
#define __LUNAIX_LRU_H
#include <lunaix/ds/llist.h>
#define __LUNAIX_LRU_H
#include <lunaix/ds/llist.h>
+#include <lunaix/ds/spinlock.h>
#include <lunaix/types.h>
struct lru_node
#include <lunaix/types.h>
struct lru_node
@@
-15,12
+16,29
@@
struct lru_zone
{
struct llist_header lead_node;
struct llist_header zones;
{
struct llist_header lead_node;
struct llist_header zones;
-
u32_t objects
;
+
char name[32]
;
evict_cb try_evict;
evict_cb try_evict;
+ spinlock_t lock;
+
+ unsigned int objects;
+ unsigned int hotness;
+ struct {
+ unsigned int n_single;
+ unsigned int n_half;
+ unsigned int n_full;
+ } evict_stats;
+
+ union {
+ struct {
+ bool delayed_free:1;
+ unsigned char attempts;
+ };
+ unsigned int flags;
+ };
};
struct lru_zone*
};
struct lru_zone*
-lru_new_zone(evict_cb try_evict_cb);
+lru_new_zone(
const char* name,
evict_cb try_evict_cb);
void
lru_use_one(struct lru_zone* zone, struct lru_node* node);
void
lru_use_one(struct lru_zone* zone, struct lru_node* node);
@@
-34,4
+52,10
@@
lru_remove(struct lru_zone* zone, struct lru_node* node);
void
lru_evict_half(struct lru_zone* zone);
void
lru_evict_half(struct lru_zone* zone);
+void
+lru_evict_all(struct lru_zone* zone);
+
+void
+lru_free_zone(struct lru_zone* zone);
+
#endif /* __LUNAIX_LRU_H */
#endif /* __LUNAIX_LRU_H */