提交 ec5fed9f 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

fix userspace version

上级 1c77c3b0
...@@ -100,9 +100,9 @@ struct range : public rcu_freed { ...@@ -100,9 +100,9 @@ struct range : public rcu_freed {
protected: protected:
~range(); ~range();
range(crange *cr, u64 k, u64 sz, int nlevel = 0);
public: public:
range(crange *cr, u64 k, u64 sz, int nlevel = 0);
bool deleted() { return next[0].mark(); } bool deleted() { return next[0].mark(); }
} __mpalign__; } __mpalign__;
......
...@@ -20,6 +20,7 @@ typedef uintptr_t uptr; ...@@ -20,6 +20,7 @@ typedef uintptr_t uptr;
#define panic(...) do { printf(__VA_ARGS__); assert(0); } while (0) #define panic(...) do { printf(__VA_ARGS__); assert(0); } while (0)
#define LOCKSTAT_CRANGE 0 #define LOCKSTAT_CRANGE 0
#define LOCKSTAT_GC 0 #define LOCKSTAT_GC 0
#define NEW_DELETE_OPS(type)
struct spinlock { struct spinlock {
pthread_mutex_t mu; pthread_mutex_t mu;
...@@ -89,7 +90,7 @@ kmalign(void **ptr, size_t align, size_t size) ...@@ -89,7 +90,7 @@ kmalign(void **ptr, size_t align, size_t size)
} }
static inline void static inline void
kmalignfree(void *ptr) kmalignfree(void *ptr, size_t align, size_t size)
{ {
free(ptr); free(ptr);
} }
......
...@@ -80,6 +80,11 @@ threadpin(void (*fn)(void*), void *arg, const char *name, int cpu) ...@@ -80,6 +80,11 @@ threadpin(void (*fn)(void*), void *arg, const char *name, int cpu)
makeproc(p); makeproc(p);
} }
struct my_range : public range {
my_range(crange *cr, u64 k, u64 sz) : range(cr, k, sz) {}
virtual void do_gc() { delete this; }
};
static pthread_barrier_t worker_b, populate_b; static pthread_barrier_t worker_b, populate_b;
enum { iter_total = 1000000 }; enum { iter_total = 1000000 };
...@@ -99,7 +104,7 @@ worker(void *arg) ...@@ -99,7 +104,7 @@ worker(void *arg)
span.replace(0); span.replace(0);
} else { } else {
ANON_REGION("worker add", &perfgroup); ANON_REGION("worker add", &perfgroup);
span.replace(new range(cr, k, 1)); span.replace(new my_range(cr, k, 1));
} }
} }
...@@ -111,7 +116,7 @@ populate(void *arg) ...@@ -111,7 +116,7 @@ populate(void *arg)
{ {
crange *cr = (crange*) arg; crange *cr = (crange*) arg;
for (u32 i = 0; i < crange_items; i++) for (u32 i = 0; i < crange_items; i++)
cr->search_lock(1 + 2*i, 1).replace(new range(cr, 1+2*i, 1)); cr->search_lock(1 + 2*i, 1).replace(new my_range(cr, 1+2*i, 1));
pthread_barrier_wait(&populate_b); pthread_barrier_wait(&populate_b);
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论