|
|
|
@ -34,17 +34,6 @@
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
#include <sched.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef CORES
|
|
|
|
|
#define CORES 8
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <ck_backoff.h>
|
|
|
|
|
#include <ck_cc.h>
|
|
|
|
|
#include <ck_pr.h>
|
|
|
|
@ -54,6 +43,8 @@
|
|
|
|
|
#include <ck_stack.h>
|
|
|
|
|
#include <ck_hp_stack.h>
|
|
|
|
|
|
|
|
|
|
#include "../../common.h"
|
|
|
|
|
|
|
|
|
|
static unsigned int threshold;
|
|
|
|
|
static unsigned int n_threads;
|
|
|
|
|
static unsigned int barrier;
|
|
|
|
@ -70,46 +61,9 @@ struct node {
|
|
|
|
|
};
|
|
|
|
|
static ck_stack_t stack = {NULL, NULL};
|
|
|
|
|
static ck_hp_t stack_hp;
|
|
|
|
|
|
|
|
|
|
CK_STACK_CONTAINER(struct node, stack_entry, stack_container)
|
|
|
|
|
|
|
|
|
|
struct affinity {
|
|
|
|
|
uint32_t delta;
|
|
|
|
|
uint32_t request;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct affinity a;
|
|
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
#ifndef gettid
|
|
|
|
|
static pid_t
|
|
|
|
|
gettid(void)
|
|
|
|
|
{
|
|
|
|
|
return syscall(__NR_gettid);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
aff_iterate(struct affinity *acb)
|
|
|
|
|
{
|
|
|
|
|
cpu_set_t s;
|
|
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
c = ck_pr_faa_uint(&acb->request, acb->delta);
|
|
|
|
|
CPU_ZERO(&s);
|
|
|
|
|
CPU_SET(c % CORES, &s);
|
|
|
|
|
|
|
|
|
|
return sched_setaffinity(gettid(), sizeof(s), &s);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
static int
|
|
|
|
|
aff_iterate(struct affinity *acb)
|
|
|
|
|
{
|
|
|
|
|
acb = NULL;
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static void *
|
|
|
|
|
thread(void *unused)
|
|
|
|
|
{
|
|
|
|
|