Exemplo n.º 1
0
Arquivo: percpu.c Projeto: rosrez/drv2
static void *pcpu_seq_start(struct seq_file *sf, loff_t *pos)
{
    unsigned long cpuno;
    volatile int count; 
    struct stats *st;

    if (*pos >= 1)
        return NULL;

    /* get the address of per-cpu data for current CPU
     * and disable kernel preemption */
    st = get_cpu_ptr(stats_ptr);

    count = st->count;
    pr_info("percpu: count before increase: %d\n", count);
    count = count + 1;
    pr_info("percpu: count after increase: %d\n", count);
    st->count = count;
    cpuno = smp_processor_id();

    /* re-enable kernel preemption */
    put_cpu_ptr(stats_ptr);

    return (void *)((cpuno << 16) & count);
}
Exemplo n.º 2
0
static struct cgroup_cpu_stat *cgroup_cpu_stat_account_begin(struct cgroup *cgrp)
{
	struct cgroup_cpu_stat *cstat;

	cstat = get_cpu_ptr(cgrp->cpu_stat);
	u64_stats_update_begin(&cstat->sync);
	return cstat;
}
Exemplo n.º 3
0
struct zcomp_strm *zcomp_stream_get(struct zcomp *comp)
{
	return *get_cpu_ptr(comp->stream);
}