Esempio n. 1
0
static void pts_proc_print(struct seq_file *m, struct prio_set *ps)
{
	int prio = ps->prio;

	if (ps->policy == -1) {
		seq_printf(m, "0 0 0 -1 ");
		return;
	}

	if (rt_prio(prio))
		seq_printf(m, "%d %d %d", (prio - MAX_RT_PRIO), 0,
			   (MAX_RT_PRIO-1 - prio));
	else
		seq_printf(m, "%d %d %d", USER_PRIO(prio), PRIO_TO_NICE(prio), 0);
	seq_printf(m, " %d ", ps->policy);
}
Esempio n. 2
0
static int pts_proc_show(struct seq_file *m, void *unused)
{
	struct prio_tracer *pt = m->private;
	struct prio_set ps_copy[4];
	unsigned int count_usr, count_ker;
	unsigned int change_usr, change_ker;
	int prio_binder;
	int i, j;
	unsigned long flags;

	spin_lock_irqsave(&pts_lock, flags);
	count_usr   = pt->count_usr;
	count_ker   = pt->count_ker;
	change_usr  = pt->change_usr;
	change_ker  = pt->change_ker;
	prio_binder = pt->prio_binder;

	for (i = 0; i < 2; i++) {
		for (j = 0; j < 2; j++) {
			memcpy(&ps_copy[((i*2)+j)], select_set(pt, j, i),
			       sizeof(struct prio_set));
		}
	}
	spin_unlock_irqrestore(&pts_lock, flags);

	seq_printf(m, "%u %u ", count_usr, change_usr);
	for (i = 0; i < 2; i++)
		pts_proc_print(m, &ps_copy[i]);

	seq_printf(m, " %u %u ", count_ker, change_ker);
	for (i = 2; i < 4; i++)
		pts_proc_print(m, &ps_copy[i]);

	if (prio_binder != PTS_DEFAULT_PRIO) {
		int tmp = prio_binder;
		prio_binder = rt_prio(tmp) ? (tmp - MAX_RT_PRIO) :
					     USER_PRIO(tmp);
	}
	seq_printf(m, " %d\n", prio_binder);
	return 0;
}
Esempio n. 3
0
/*
 * Update scheduling information from the owning thread.
 */
void __spu_update_sched_info(struct spu_context *ctx)
{
	/*
	 * assert that the context is not on the runqueue, so it is safe
	 * to change its scheduling parameters.
	 */
	BUG_ON(!list_empty(&ctx->rq));

	/*
	 * 32-Bit assignments are atomic on powerpc, and we don't care about
	 * memory ordering here because retrieving the controlling thread is
	 * per definition racy.
	 */
	ctx->tid = current->pid;

	/*
	 * We do our own priority calculations, so we normally want
	 * ->static_prio to start with. Unfortunately this field
	 * contains junk for threads with a realtime scheduling
	 * policy so we have to look at ->prio in this case.
	 */
	if (rt_prio(current->prio))
		ctx->prio = current->prio;
	else
		ctx->prio = current->static_prio;
	ctx->policy = current->policy;

	/*
	 * TO DO: the context may be loaded, so we may need to activate
	 * it again on a different node. But it shouldn't hurt anything
	 * to update its parameters, because we know that the scheduler
	 * is not actively looking at this field, since it is not on the
	 * runqueue. The context will be rescheduled on the proper node
	 * if it is timesliced or preempted.
	 */
<<<<<<< HEAD