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

towards free-standing crange/gc/ns

上级 875bc53a
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
#include "atomic.hh" #include "atomic.hh"
using std::atomic;
struct crange; struct crange;
struct crange_locked; struct crange_locked;
struct range; struct range;
...@@ -18,7 +16,7 @@ class markptr_mark; ...@@ -18,7 +16,7 @@ class markptr_mark;
template<class T> template<class T>
class markptr { class markptr {
protected: protected:
atomic<uptr> _p; std::atomic<uptr> _p;
public: public:
markptr() : _p(0) {} markptr() : _p(0) {}
...@@ -88,7 +86,7 @@ struct range : public rcu_freed { ...@@ -88,7 +86,7 @@ struct range : public rcu_freed {
private: private:
const u64 key; const u64 key;
const u64 size; const u64 size;
atomic<int> curlevel; // the current levels it appears on std::atomic<int> curlevel; // the current levels it appears on
const int nlevel; // the number of levels this range should appear const int nlevel; // the number of levels this range should appear
crange *const cr; // the crange this range is part of crange *const cr; // the crange this range is part of
markptr<range>* const next; // one next pointer per level markptr<range>* const next; // one next pointer per level
......
#include "types.h"
#include "kernel.hh"
#include "spinlock.h"
#include "condvar.h"
#include "cpputil.hh"
#include "atomic.hh"
#include "proc.hh"
#include "cpu.hh"
#include "ns.hh"
#include "types.h" #include "crange_arch.hh"
#include "kernel.hh"
#include "mmu.h"
#include "spinlock.h"
#include "condvar.h"
#include "queue.h"
#include "proc.hh"
#include "cpu.hh"
#include "gc.hh" #include "gc.hh"
#include "crange.hh" #include "crange.hh"
#include "cpputil.hh"
// //
// Concurrent atomic range operations using skip lists. An insert may split an // Concurrent atomic range operations using skip lists. An insert may split an
...@@ -92,7 +84,7 @@ range::print(int l) ...@@ -92,7 +84,7 @@ range::print(int l)
range::~range() range::~range()
{ {
dprintf("%d: range_free: 0x%lx 0x%lx-0x%lx(%ld)\n", myproc()->cpuid, (u64) this, key, key+size, size); //dprintf("%d: range_free: 0x%lx 0x%lx-0x%lx(%ld)\n", myproc()->cpuid, (u64) this, key, key+size, size);
cr->check(this); cr->check(this);
// assert(curlevel == -1); // assert(curlevel == -1);
for (int l = 0; l < nlevel; l++) { for (int l = 0; l < nlevel; l++) {
...@@ -107,7 +99,7 @@ range::dec_ref(void) ...@@ -107,7 +99,7 @@ range::dec_ref(void)
{ {
int n = curlevel--; int n = curlevel--;
if (n == 0) { // now removed from all levels. if (n == 0) { // now removed from all levels.
dprintf("%d: free_delayed: 0x%lx 0x%lx-0x%lx(%lu) %lu\n", myproc()->pid, (long) this, key, key + size, size, myproc()->epoch); //dprintf("%d: free_delayed: 0x%lx 0x%lx-0x%lx(%lu) %lu\n", myproc()->pid, (long) this, key, key + size, size, myproc()->epoch);
cr->check(this); cr->check(this);
assert(curlevel == -1); assert(curlevel == -1);
gc_delayed(this); gc_delayed(this);
...@@ -206,7 +198,7 @@ crange::check(struct range *absent) ...@@ -206,7 +198,7 @@ crange::check(struct range *absent)
{ {
if (!crange_checking) if (!crange_checking)
return; return;
int t = mycpu()->id; int t = -1; //mycpu()->id;
struct range *e, *s; struct range *e, *s;
for (int l = 0; l < nlevel; l++) { for (int l = 0; l < nlevel; l++) {
for (e = crange_head->next[l].ptr(); e; e = s) { for (e = crange_head->next[l].ptr(); e; e = s) {
......
#include "types.h" #include "crange_arch.hh"
#include "kernel.hh" #include "gc.hh"
#include "mmu.h"
#include "amd64.h"
#include "spinlock.h"
#include "condvar.h"
#include "queue.h"
#include "proc.hh"
#include "cpu.hh"
#include "ns.hh"
#include "atomic.hh"
extern u64 proc_hash(const u32&); extern u64 proc_hash(const u32&);
extern xns<u32, proc*, proc_hash> *xnspid; extern xns<u32, proc*, proc_hash> *xnspid;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论