コード例 #1
0
ファイル: propsel.c プロジェクト: unakatsuo/multipath-tools
extern int
select_prio (struct path * pp)
{
	struct mpentry * mpe;

	if ((mpe = find_mpe(pp->wwid))) {
		if (mpe->prio_name) {
			pp->prio = prio_lookup(mpe->prio_name);
			prio_set_args(pp->prio, mpe->prio_args);
			condlog(3, "%s: prio = %s (LUN setting)",
				pp->dev, pp->prio->name);
			return 0;
		}
	}

	if (pp->hwe && pp->hwe->prio_name) {
		pp->prio = prio_lookup(pp->hwe->prio_name);
		prio_set_args(pp->prio, pp->hwe->prio_args);
		condlog(3, "%s: prio = %s (controller setting)",
			pp->dev, pp->hwe->prio_name);
		condlog(3, "%s: prio args = %s (controller setting)",
			pp->dev, pp->hwe->prio_args);
		return 0;
	}
	if (conf->prio_name) {
		pp->prio = prio_lookup(conf->prio_name);
		prio_set_args(pp->prio, conf->prio_args);
		condlog(3, "%s: prio = %s (config file default)",
			pp->dev, conf->prio_name);
		condlog(3, "%s: prio args = %s (config file default)",
			pp->dev, conf->prio_args);
		return 0;
	}
	pp->prio = prio_lookup(DEFAULT_PRIO);
	prio_set_args(pp->prio, DEFAULT_PRIO_ARGS);
	condlog(3, "%s: prio = %s (internal default)",
		pp->dev, DEFAULT_PRIO);
	condlog(3, "%s: prio = %s (internal default)",
		pp->dev, DEFAULT_PRIO_ARGS);
	return 0;
}
コード例 #2
0
ファイル: yarn.c プロジェクト: prophile/yarns
yarn_t yarn_new ( void (*routine)(void*), void* udata, int nice )
{
	// grab memory
	yarn* active_yarn;
	yarn_t pid;
	//prepare_context(0);
	pool* p = get_yarn_pool();
	active_yarn = (yarn*)pool_allocate(p);
	assert(active_yarn);
	// prepare the context
	init_context(&active_yarn->context);
	// set up stack and such
	active_yarn->stackBase = allocate_stack(&(active_yarn->context));
	// run yarn_context_make to direct it over to the bootstrap
	prepare_context(active_yarn, routine, udata);
	// insert it into the yarn list
	pid = list_insert(active_yarn, nice);
	if (live)
		master_sched_schedule(pid, prio_lookup(nice));
	return pid;
}
コード例 #3
0
ファイル: yarn.c プロジェクト: prophile/yarns
void yarn_process ( unsigned long otherThreadCount, int primaryScheduler, int secondaryScheduler )
{
// look through yarns
	unsigned long nprocs;
	int i;
#ifdef YARNS_ENABLE_SMP
	nprocs = numprocs() - otherThreadCount;
	if (nprocs < 1) nprocs = 1;
	master_sched_init(nprocs, primaryScheduler, secondaryScheduler);
#else
	master_sched_init(1, primaryScheduler, secondaryScheduler);
#endif
#if YARNS_SYNERGY == YARNS_SYNERGY_PREEMPTIVE
	preempt_init();
	preempt_handle = yarn_preempt_handle;
#endif
	TTDINIT_MAIN();
	wg = wait_graph_new();
	// set up all the yarns in the scheduler
	for (i = 1; i < maxpid; i++)
	{
		master_sched_schedule(i, prio_lookup(PTABLE(i)->nice));
	}
	live = 1;
	DEBUG("starting with context API: %s\n", YARN_CONTEXT_API);
#ifdef YARNS_ENABLE_SMP
		// create the secondary threads
	for (i = 1; i < nprocs; i++)
	{
#if YARNS_SYNERGY == YARNS_SYNERGY_PREEMPTIVE
		preempt_disable();
#endif
		pthread_create(&threads[i], NULL, (void* (*)(void*))yarn_processor, (void*)i);
	}
#endif
	threads[i] = pthread_self();
	coreCount = nprocs;
	// run the primary thread
	yarn_processor(0);
}