示例#1
0
文件: percpu.c 项目: 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);
}
示例#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;
}
示例#3
0
文件: zcomp.c 项目: AK101111/linux
struct zcomp_strm *zcomp_stream_get(struct zcomp *comp)
{
	return *get_cpu_ptr(comp->stream);
}