예제 #1
0
파일: sched.c 프로젝트: wind15973/research
void coremu_init_sched_all()
{
    /* Get the available processors */
    host_cpu_avail = sysconf(_SC_NPROCESSORS_ONLN);

    /* HIGH numeric value indicates LOW priority,
       and vice versa */
    max_prio = -21;
    min_prio = 19;
    avg_prio = (max_prio + min_prio) / 2;
    low_prio = (avg_prio + min_prio) / 2;
    high_prio = (max_prio + avg_prio) / 2;

    coremu_print("[priority]: max[%d], min[%d], "
             "low[%d], avg[%d], high[%d]",
             max_prio, min_prio, low_prio, avg_prio, high_prio);

    /* set priority for main thread
       NOTE: now it is HW thread. */
    //assert(! setpriority(PRIO_PROCESS, 0, high_prio));
    //assert(! sched_setscheduler(0, SCHED_RR, NULL));
    display_thread_sched_attr("MAIN thread scheduling settings:");
    coremu_thread_setpriority(PRIO_PROCESS, 0, high_prio);
    topology_init();

    /* bind hardware thread to the fisrt core */
    //topology_bind_hw();
}
예제 #2
0
파일: intr.c 프로젝트: SJTU-IPADS/COREMU
void coremu_core_signal_handler(int signo, siginfo_t *info, void *context)
{
    CMCore *self = coremu_get_core_self();
    adjust_intr_threshold();
    coremu_thread_setpriority(PRIO_PROCESS, 0, avg_prio);

    if (event_notifier) {
        event_notifier();
    }

    self->sig_pending = 0;
}
예제 #3
0
파일: sched.c 프로젝트: wind15973/research
void coremu_init_sched_core()
{
    int policy;
    CMCore *self;
    struct sched_param param;
    assert(!pthread_getschedparam(pthread_self(), &policy, &param));
    assert(policy == CM_SCHED_POLICY);

    coremu_thread_setpriority(PRIO_PROCESS, 0, avg_prio);
    self = coremu_get_core_self();
    self->tid = coremu_gettid();

    /* display the scheduling info */
    display_thread_sched_attr("CORE thread scheduler settings:");

#ifdef CM_ENABLE_BIND_CORE
    /* bind thread to a specific core */
    //topology_bind_core();
#endif

}
예제 #4
0
파일: intr.c 프로젝트: SJTU-IPADS/COREMU
static void coremu_send_signal(CMCore *core)
{
    int64_t pending_intr = coremu_intr_get_size(core);
    uint64_t send_sig_p = 0;

    if (pending_intr > core->intr_thresh_hold) {
        if (!core->sig_pending) {
            core->sig_pending = 1;
            core->state = CM_STATE_RUN;
            send_sig_p = 1;
        } else {
            if (core->intr_thresh_hold < MAX_INTR_THRESHOLD)
                core->intr_thresh_hold = (core->intr_thresh_hold + 1) << 1;
        }
    }

    if (coremu_physical_core_enough_p() || send_sig_p ||
        core->state == CM_STATE_HALT || core->state == CM_STATE_PAUSE) {
        coremu_thread_setpriority(PRIO_PROCESS, core->tid, high_prio);
        pthread_kill(core->thread, COREMU_SIGNAL);
    }
}