• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ put_cpu函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中put_cpu函数的典型用法代码示例。如果您正苦于以下问题:C++ put_cpu函数的具体用法?C++ put_cpu怎么用?C++ put_cpu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了put_cpu函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: vfp_sync_hwstate

void vfp_sync_hwstate(struct thread_info *thread)
{
	unsigned int cpu = get_cpu();

	/*
	 * If the thread we're interested in is the current owner of the
	 * hardware VFP state, then we need to save its state.
	 */
	if (vfp_current_hw_state[cpu] == &thread->vfpstate) {
		u32 fpexc = fmrx(FPEXC);

		/*
		 * Save the last VFP state on this CPU.
		 */
		fmxr(FPEXC, fpexc | FPEXC_EN);
		vfp_save_state(&thread->vfpstate, fpexc | FPEXC_EN);
		fmxr(FPEXC, fpexc);
	}

	put_cpu();
}
开发者ID:0x7678,项目名称:SJKernel-gn2,代码行数:21,代码来源:vfpmodule.c


示例2: od_init

static int od_init(struct dbs_data *dbs_data, bool notify)
{
    struct od_dbs_tuners *tuners;
    u64 idle_time;
    int cpu;

    tuners = kzalloc(sizeof(*tuners), GFP_KERNEL);
    if (!tuners) {
        pr_err("%s: kzalloc failed\n", __func__);
        return -ENOMEM;
    }

    cpu = get_cpu();
    idle_time = get_cpu_idle_time_us(cpu, NULL);
    put_cpu();
    if (idle_time != -1ULL) {
        /* Idle micro accounting is supported. Use finer thresholds */
        tuners->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
        /*
         * In nohz/micro accounting case we set the minimum frequency
         * not depending on HZ, but fixed (very low). The deferred
         * timer might skip some samples if idle/sleeping as needed.
        */
        dbs_data->min_sampling_rate = MICRO_FREQUENCY_MIN_SAMPLE_RATE;
    } else {
        tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD;

        /* For correct statistics, we need 10 ticks for each measure */
        dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO *
                                      jiffies_to_usecs(10);
    }

    tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
    tuners->ignore_nice_load = 0;
    tuners->powersave_bias = default_powersave_bias;
    tuners->io_is_busy = should_io_be_busy();

    dbs_data->tuners = tuners;
    return 0;
}
开发者ID:tohipfortheroom,项目名称:RPI-Kernels,代码行数:40,代码来源:cpufreq_ondemand.c


示例3: handle_IPI

irqreturn_t
handle_IPI (int irq, void *dev_id)
{
	int this_cpu = get_cpu();
	unsigned long *pending_ipis = &__ia64_per_cpu_var(ipi_operation);
	unsigned long ops;

	mb();	/* Order interrupt and bit testing. */
	while ((ops = xchg(pending_ipis, 0)) != 0) {
		mb();	/* Order bit clearing and data access. */
		do {
			unsigned long which;

			which = ffz(~ops);
			ops &= ~(1 << which);

			switch (which) {
			case IPI_CALL_FUNC:
				handle_call_data();
				break;

			case IPI_CPU_STOP:
				stop_this_cpu();
				break;
#ifdef CONFIG_KEXEC
			case IPI_KDUMP_CPU_STOP:
				unw_init_running(kdump_cpu_freeze, NULL);
				break;
#endif
			default:
				printk(KERN_CRIT "Unknown IPI on CPU %d: %lu\n",
						this_cpu, which);
				break;
			}
		} while (ops);
		mb();	/* Order data access and bit testing. */
	}
	put_cpu();
	return IRQ_HANDLED;
}
开发者ID:janrinze,项目名称:loox7xxport,代码行数:40,代码来源:smp.c


示例4: msm_spm_smp_set_vdd

static void msm_spm_smp_set_vdd(void *data)
{
	struct msm_spm_device *dev;
	struct msm_spm_vdd_info *info = (struct msm_spm_vdd_info *)data;

	if (msm_spm_L2_apcs_master)
		dev = &msm_spm_l2_device;
	else
		dev = &per_cpu(msm_cpu_spm_device, info->cpu);

	if (!dev->initialized)
		return;

	if (msm_spm_L2_apcs_master)
		get_cpu();

	dev->cpu_vdd = info->vlevel;
	info->err = msm_spm_drv_set_vdd(&dev->reg_data, info->vlevel);

	if (msm_spm_L2_apcs_master)
		put_cpu();
}
开发者ID:Blackburn29,项目名称:PsycoKernel,代码行数:22,代码来源:spm_devices.c


示例5: ovs_flow_stats_clear

void ovs_flow_stats_clear(struct sw_flow *flow)
{
	int cpu, cur_cpu;

	if (!flow->stats.is_percpu) {
		stats_reset(flow->stats.stat);
	} else {
		cur_cpu = get_cpu();

		for_each_possible_cpu(cpu) {

			if (cpu == cur_cpu)
				local_bh_disable();

			stats_reset(per_cpu_ptr(flow->stats.cpu_stats, cpu));

			if (cpu == cur_cpu)
				local_bh_enable();
		}
		put_cpu();
	}
}
开发者ID:IDM350,项目名称:linux,代码行数:22,代码来源:flow.c


示例6: sys_ioperm

/*
 * this changes the io permissions bitmap in the current task.
 */
asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{
	struct thread_struct * t = &current->thread;
	struct tss_struct * tss;
	unsigned long *bitmap;

	if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
		return -EINVAL;
	if (turn_on && !capable(CAP_SYS_RAWIO))
		return -EPERM;

	/*
	 * If it's the first ioperm() call in this thread's lifetime, set the
	 * IO bitmap up. ioperm() is much less timing critical than clone(),
	 * this is why we delay this operation until now:
	 */
	if (!t->io_bitmap_ptr) {
		bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
		if (!bitmap)
			return -ENOMEM;

		memset(bitmap, 0xff, IO_BITMAP_BYTES);
		t->io_bitmap_ptr = bitmap;
	}

	/*
	 * do it in the per-thread copy and in the TSS ...
	 */
	set_bitmap(t->io_bitmap_ptr, from, num, !turn_on);
	tss = init_tss + get_cpu();
	if (tss->io_bitmap_base == IO_BITMAP_OFFSET) { /* already active? */
		set_bitmap(tss->io_bitmap, from, num, !turn_on);
	} else {
		memcpy(tss->io_bitmap, t->io_bitmap_ptr, IO_BITMAP_BYTES);
		tss->io_bitmap_base = IO_BITMAP_OFFSET; /* Activate it in the TSS */
	}
	put_cpu();
	return 0;
}
开发者ID:12019,项目名称:hg556a_source,代码行数:42,代码来源:ioport.c


示例7: profile_flip_buffers

static void profile_flip_buffers(void)
{
	int i, j, cpu;

	down(&profile_flip_mutex);
	j = per_cpu(cpu_profile_flip, get_cpu());
	put_cpu();
	on_each_cpu(__profile_flip_buffers, NULL, 0, 1);
	for_each_online_cpu(cpu) {
		struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[j];
		for (i = 0; i < NR_PROFILE_HIT; ++i) {
			if (!hits[i].hits) {
				if (hits[i].pc)
					hits[i].pc = 0;
				continue;
			}
			atomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);
			hits[i].hits = hits[i].pc = 0;
		}
	}
	up(&profile_flip_mutex);
}
开发者ID:gnensis,项目名称:linux-2.6.15,代码行数:22,代码来源:profile.c


示例8: vfp_flush_hwstate

void vfp_flush_hwstate(struct thread_info *thread)
{
    unsigned int cpu = get_cpu();

    /*
     * If the thread we're interested in is the current owner of the
     * hardware VFP state, then we need to save its state.
     */
    if (last_VFP_context[cpu] == &thread->vfpstate) {
        u32 fpexc = fmrx(FPEXC);

        fmxr(FPEXC, fpexc & ~FPEXC_EN);

        /*
         * Set the context to NULL to force a reload the next time
         * the thread uses the VFP.
         */
        last_VFP_context[cpu] = NULL;
    }

    put_cpu();
}
开发者ID:actiononmail,项目名称:linux-2.6,代码行数:22,代码来源:vfpmodule.c


示例9: exit_thread

/*
 * Free current thread data structures etc..
 */
void exit_thread(void)
{
	struct task_struct *me = current;
	struct thread_struct *t = &me->thread;
	unsigned long *bp = t->io_bitmap_ptr;
	struct fpu *fpu = &t->fpu;

	if (bp) {
		struct tss_struct *tss = &per_cpu(cpu_tss, get_cpu());

		t->io_bitmap_ptr = NULL;
		clear_thread_flag(TIF_IO_BITMAP);
		/*
		 * Careful, clear this in the TSS too:
		 */
		memset(tss->io_bitmap, 0xff, t->io_bitmap_max);
		t->io_bitmap_max = 0;
		put_cpu();
		kfree(bp);
	}

	fpu__drop(fpu);
}
开发者ID:JcShang,项目名称:linux-80211n-csitool,代码行数:26,代码来源:process.c


示例10: exit_thread

/*
 * Free current thread data structures etc..
 */
void exit_thread(void)
{
	/* The process may have allocated an io port bitmap... nuke it. */
	if (unlikely(test_thread_flag(TIF_IO_BITMAP))) {
		struct task_struct *tsk = current;
		struct thread_struct *t = &tsk->thread;
		int cpu = get_cpu();
		struct tss_struct *tss = &per_cpu(init_tss, cpu);

		kfree(t->io_bitmap_ptr);
		t->io_bitmap_ptr = NULL;
		clear_thread_flag(TIF_IO_BITMAP);
		/*
		 * Careful, clear this in the TSS too:
		 */
		memset(tss->io_bitmap, 0xff, tss->io_bitmap_max);
		t->io_bitmap_max = 0;
		tss->io_bitmap_owner = NULL;
		tss->io_bitmap_max = 0;
		tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET;
		put_cpu();
	}
}
开发者ID:maraz,项目名称:linux-2.6,代码行数:26,代码来源:process_32.c


示例11: ovs_flow_stats_clear

void ovs_flow_stats_clear(struct sw_flow *flow)
{
	int cpu, cur_cpu;

	cur_cpu = get_cpu();
	for_each_possible_cpu(cpu) {
		struct sw_flow_stats *stats = &flow->stats[cpu];

		if (cpu == cur_cpu)
			local_bh_disable();

		spin_lock(&stats->lock);
		stats->used = 0;
		stats->packet_count = 0;
		stats->byte_count = 0;
		stats->tcp_flags = 0;
		spin_unlock(&stats->lock);

		if (cpu == cur_cpu)
			local_bh_enable();
	}
	put_cpu();
}
开发者ID:fraant,项目名称:openvswitch,代码行数:23,代码来源:flow.c


示例12: vfp_pm_save_context

void vfp_pm_save_context(void)
{
	u32 fpexc = fmrx(FPEXC);
	unsigned int cpu = get_cpu();

	/* Save last_VFP_context if needed */
	if (last_VFP_context[cpu]) {
		/* Enable vfp to save context */
		if (!(fpexc & FPEXC_EN)) {
			vfp_enable(NULL);
			fmxr(FPEXC, fpexc | FPEXC_EN);
		}

		vfp_save_state(last_VFP_context[cpu], fpexc);

		/* disable, just in case */
		fmxr(FPEXC, fpexc & ~FPEXC_EN);

		last_VFP_context[cpu] = NULL;
	}

	put_cpu();
}
开发者ID:Bdaman80,项目名称:BDA-ACTV,代码行数:23,代码来源:vfpmodule.c


示例13: set_tls_desc

static void set_tls_desc(struct task_struct *p, int idx,
			 const struct user_desc *info, int n)
{
	struct thread_struct *t = &p->thread;
	struct desc_struct *desc = &t->tls_array[idx - GDT_ENTRY_TLS_MIN];
	int cpu;

	cpu = get_cpu();

	while (n-- > 0) {
		if (LDT_empty(info))
			desc->a = desc->b = 0;
		else
			fill_ldt(desc, info);
		++info;
		++desc;
	}

	if (t == &current->thread)
		load_TLS(t, cpu);

	put_cpu();
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:23,代码来源:tls.c


示例14: msm_idle_stats_timer

static enum hrtimer_restart msm_idle_stats_timer(struct hrtimer *timer)
{
	struct msm_idle_stats_device *stats_dev;
	unsigned int cpu;
	int64_t now;
	int64_t interval;

	stats_dev = container_of(timer, struct msm_idle_stats_device, timer);
	cpu = get_cpu();

	if (cpu != stats_dev->cpu) {
		if (msm_idle_stats_debug_mask & MSM_IDLE_STATS_DEBUG_MIGRATION)
			pr_info("%s: timer migrated from cpu%u to cpu%u\n",
				__func__, stats_dev->cpu, cpu);

		stats_dev->stats.event = MSM_IDLE_STATS_EVENT_TIMER_MIGRATED;
		goto timer_exit;
	}

	now = ktime_to_us(ktime_get());
	interval = now - stats_dev->stats.last_busy_start;

	if (stats_dev->stats.busy_timer > 0 &&
			interval >= stats_dev->stats.busy_timer - 1)
		stats_dev->stats.event =
			MSM_IDLE_STATS_EVENT_BUSY_TIMER_EXPIRED;
	else
		stats_dev->stats.event =
			MSM_IDLE_STATS_EVENT_COLLECTION_TIMER_EXPIRED;

timer_exit:
	atomic_set(&stats_dev->collecting, 0);
	wake_up_interruptible(&stats_dev->wait_q);

	put_cpu();
	return HRTIMER_NORESTART;
}
开发者ID:AKToronto,项目名称:IronBorn2,代码行数:37,代码来源:idle_stats.c


示例15: check_sal_cache_flush

static void __init
check_sal_cache_flush (void)
{
	unsigned long flags;
	int cpu;
	u64 vector;

	cpu = get_cpu();
	local_irq_save(flags);

	/*
	 * Schedule a timer interrupt, wait until it's reported, and see if
	 * SAL_CACHE_FLUSH drops it.
	 */
	ia64_set_itv(IA64_TIMER_VECTOR);
	ia64_set_itm(ia64_get_itc() + 1000);

	while (!ia64_get_irr(IA64_TIMER_VECTOR))
		cpu_relax();

	ia64_sal_cache_flush(3);

	if (ia64_get_irr(IA64_TIMER_VECTOR)) {
		vector = ia64_get_ivr();
		ia64_eoi();
		WARN_ON(vector != IA64_TIMER_VECTOR);
	} else {
		sal_cache_flush_drops_interrupts = 1;
		printk(KERN_ERR "SAL: SAL_CACHE_FLUSH drops interrupts; "
			"PAL_CACHE_FLUSH will be used instead\n");
		ia64_eoi();
	}

	local_irq_restore(flags);
	put_cpu();
}
开发者ID:mrtos,项目名称:Logitech-Revue,代码行数:36,代码来源:sal.c


示例16: od_init

static int od_init(struct dbs_data *dbs_data)
{
	struct od_dbs_tuners *tuners;
	u64 idle_time;
	int cpu;

	tuners = kzalloc(sizeof(*tuners), GFP_KERNEL);
	if (!tuners) {
		pr_err("%s: kzalloc failed\n", __func__);
		return -ENOMEM;
	}

	cpu = get_cpu();
	idle_time = get_cpu_idle_time_us(cpu, NULL);
	put_cpu();
	if (idle_time != -1ULL) {
		
		tuners->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
		dbs_data->min_sampling_rate = MICRO_FREQUENCY_MIN_SAMPLE_RATE;
	} else {
		tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD;

		
		dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO *
			jiffies_to_usecs(10);
	}

	tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
	tuners->ignore_nice_load = 0;
	tuners->powersave_bias = default_powersave_bias;
	tuners->io_is_busy = should_io_be_busy();

	dbs_data->tuners = tuners;
	mutex_init(&dbs_data->mutex);
	return 0;
}
开发者ID:SiddheshK15,项目名称:kernel_htc_820,代码行数:36,代码来源:cpufreq_ondemand.c


示例17: start_thread

void
start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
{
	int cpu;

	set_user_gs(regs, 0);

	regs->fs		= 0;
	regs->ds		= __USER_DS;
	regs->es		= __USER_DS;
	regs->ss		= __USER_DS;
	regs->cs		= __USER_CS;
	regs->ip		= new_ip;
	regs->sp		= new_sp;

	cpu = get_cpu();
	load_user_cs_desc(cpu, current->mm);
	put_cpu();

	/*
	 * Free the old FP and other extended state
	 */
	free_thread_xstate(current);
}
开发者ID:TheDudeWithThreeHands,项目名称:ubuntu-precise-lowlatency,代码行数:24,代码来源:process_32.c


示例18: __module_ref_addr_init

int __init __module_ref_addr_init(void) 
{ 	
	local_t * addr;
	unsigned int cpu = get_cpu();  //获取当前cpu ID 

    	/*addr 为指向当前模块引用计数的指针*/
	addr = __module_ref_addr( THIS_MODULE, cpu ); 
	printk("<0>addr: %lx\n", (unsigned long)addr);	
	
	printk("<0>originally,\n");  //输出初始时当前模块的引用计数
	printk("<0>refs of this module is: %d\n",module_refcount(THIS_MODULE));
	
	local_inc(addr);  //实现将addr所指向的内容加1
	printk("<0>after calling local_inc,\n");  
	printk("<0>refs of this module is: %d\n",module_refcount(THIS_MODULE));	

	local_dec(addr);  //实现将addr所指向的内容减1
	printk("<0>after calling local_dec,\n");
	printk("<0>refs of this module is: %d\n",module_refcount(THIS_MODULE));

	put_cpu();  //允许抢占 preempt_enable( )

	return 0; 
}
开发者ID:fjrti,项目名称:snippets,代码行数:24,代码来源:__module_ref_addr.c


示例19: kexec_prepare_cpus

static void kexec_prepare_cpus(void)
{
	wake_offline_cpus();
	smp_call_function(kexec_smp_down, NULL, /* wait */0);
	local_irq_disable();
	mb(); /* make sure IRQs are disabled before we say they are */
	get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;

	kexec_prepare_cpus_wait(KEXEC_STATE_IRQS_OFF);
	/* we are sure every CPU has IRQs off at this point */
	kexec_all_irq_disabled = 1;

	/* after we tell the others to go down */
	if (ppc_md.kexec_cpu_down)
		ppc_md.kexec_cpu_down(0, 0);

	/*
	 * Before removing MMU mappings make sure all CPUs have entered real
	 * mode:
	 */
	kexec_prepare_cpus_wait(KEXEC_STATE_REAL_MODE);

	put_cpu();
}
开发者ID:kozmikkick,项目名称:eternityprj-kernel-endeavoru-128,代码行数:24,代码来源:machine_kexec_64.c


示例20: hw_breakpoint_handler

static int __kprobes hw_breakpoint_handler(struct die_args *args)
{
	int cpu, i, rc = NOTIFY_STOP;
	struct perf_event *bp;
	unsigned int cmf, resume_mask;

	cmf = sh_ubc->triggered_mask();
	if (unlikely(!cmf))
		return NOTIFY_DONE;

	resume_mask = sh_ubc->active_mask();

	sh_ubc->disable_all();

	cpu = get_cpu();
	for (i = 0; i < sh_ubc->num_events; i++) {
		unsigned long event_mask = (1 << i);

		if (likely(!(cmf & event_mask)))
			continue;

		rcu_read_lock();

		bp = per_cpu(bp_per_reg[i], cpu);
		if (bp)
			rc = NOTIFY_DONE;

		sh_ubc->clear_triggered_mask(event_mask);

		if (!bp) {
			rcu_read_unlock();
			break;
		}

		if (bp->overflow_handler == ptrace_triggered)
			resume_mask &= ~(1 << i);

		perf_bp_event(bp, args->regs);

		
		if (!arch_check_bp_in_kernelspace(bp)) {
			siginfo_t info;

			info.si_signo = args->signr;
			info.si_errno = notifier_to_errno(rc);
			info.si_code = TRAP_HWBKPT;

			force_sig_info(args->signr, &info, current);
		}

		rcu_read_unlock();
	}

	if (cmf == 0)
		rc = NOTIFY_DONE;

	sh_ubc->enable_all(resume_mask);

	put_cpu();

	return rc;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:62,代码来源:hw_breakpoint.c



注:本文中的put_cpu函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ put_cred函数代码示例发布时间:2022-05-30
下一篇:
C++ put_compat_timespec函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap