Пример #1
0
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 void cgroup_cpu_stat_account_end(struct cgroup *cgrp,
					struct cgroup_cpu_stat *cstat)
{
	u64_stats_update_end(&cstat->sync);
	cgroup_cpu_stat_updated(cgrp, smp_processor_id());
	put_cpu_ptr(cstat);
}
Пример #3
0
void zcomp_stream_put(struct zcomp *comp)
{
	put_cpu_ptr(comp->stream);
}