wq tweaks

上级 ae573cc0
......@@ -23,6 +23,7 @@ struct stat;
struct proc;
struct vmap;
struct pipe;
struct work;
// bio.c
void binit(void);
......@@ -324,11 +325,10 @@ void updatepages(pml4e_t*, void*, void*, int);
struct vmap * vmap_copy(struct vmap *, int);
// wq.c
#if WQENABLE
int wq_trywork(void);
#else
#define wq_trywork() 0
#endif
int wq_push(struct work *w);
struct work * allocwork(void);
void freework(struct work *w);
// cilk.c
#if CILKENABLE
......
......@@ -20,7 +20,6 @@
#define LOCKSTAT 0
#define VERIFYFREE LOCKSTAT
#define ALLOC_MEMSET 1
#define WQENABLE 1
#define WQSHIFT 4
#if defined(HW_josmp)
#define NCPU 16 // maximum number of CPUs
......
......@@ -375,8 +375,6 @@ scheduler(void)
worked = wq_trywork();
} while(worked);
sti();
if (!WQENABLE)
hlt();
}
}
}
......
#if WQENABLE
#include "types.h"
#include "kernel.h"
#include "spinlock.h"
......@@ -47,13 +46,13 @@ wq_stat(void)
return &stat[cpunum()];
}
static struct work *
struct work *
allocwork(void)
{
return (struct work *)kalloc();
}
static void
void
freework(struct work *w)
{
kfree(w);
......@@ -159,8 +158,8 @@ __wq_steal(int c)
static void
__wq_run(struct work *w)
{
void (*fn)(struct work*, void*, void*) = w->rip;
fn(w, w->arg0, w->arg1);
void (*fn)(struct work*, void*, void*, void*, void*) = w->rip;
fn(w, w->arg0, w->arg1, w->arg2, w->arg3);
freework(w);
}
......@@ -248,5 +247,3 @@ initwq(void)
for (i = 0; i < NCPU; i++)
initlock(&queue[i].lock, "wq lock", LOCKSTAT_WQ);
}
#endif // WQENABLE
......@@ -2,5 +2,7 @@ struct work {
void *rip;
void *arg0;
void *arg1;
void *arg2;
void *arg3;
char data[];
};
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论