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

C++ idle_cpu函数代码示例

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

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



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

示例1: rtcc_idle_handler

/*
 * RTCC idle handler, called when CPU is idle
 */
static int rtcc_idle_handler(struct notifier_block *nb, unsigned long val, void *data)
{
	if (likely(!atomic_read(&krtccd_enabled)))
		return 0;

	if (likely(atomic_read(&need_to_reclaim) == 0))
		return 0;

	// To prevent RTCC from running too frequently
	if (likely(time_before(jiffies, prev_jiffy + rtcc_reclaim_jiffies)))
		return 0;

	if (unlikely(atomic_read(&kswapd_running) == 1))
		return 0;

	if (unlikely(idle_cpu(task_cpu(krtccd)) && this_cpu_loadx(3) == 0) || rtcc_boost_mode) {
		if (likely(atomic_read(&krtccd_running) == 0)) {
			atomic_set(&krtccd_running, 1);

			wake_up_process(krtccd);
			prev_jiffy = jiffies;
		}
	}

	return 0;
}
开发者ID:acorn-marvell,项目名称:brillo_pxa_kernel,代码行数:29,代码来源:rtcc.c


示例2: main

int main(void) {
	int i;

	/* TODO: run test_printk() */
	/*
	test_printk();
*/
	disable_interrupt();
	init_pcbs();
	setup_irq(8, irq0_handle);
	setup_irq(0x80, irq1_handle);
	setup_irq(9, keyboard_int);
	/*
	kthread_create(test1_a, stack1+KSTACK_SIZE);
	kthread_create(test1_b, stack2+KSTACK_SIZE);
	kthread_create(test1_c, stack3+KSTACK_SIZE);
	kthread_create(test_thread_a, stack1+KSTACK_SIZE);
	kthread_create(test_thread_b, stack2+KSTACK_SIZE);
	
	kthread_create(test_msg_c, stack1+KSTACK_SIZE);
	kthread_create(test_msg_d, stack2+KSTACK_SIZE);
	
	kthread_create(test_thread_in_thread, stack1+KSTACK_SIZE);
	*/
	UserThread_create(0x2000);
	kthread_create(tty_driver, stack2+KSTACK_SIZE);
        enable_interrupt(); 
	
	while (1) {
		idle_cpu();
	}
}
开发者ID:rebornix,项目名称:MiniOS_Rebornix,代码行数:32,代码来源:main.c


示例3: _cpu_down

static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
{
	int err, nr_calls = 0;
	void *hcpu = (void *)(long)cpu;
	unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
	struct take_cpu_down_param tcd_param = {
		.mod = mod,
		.hcpu = hcpu,
	};

	if (num_online_cpus() == 1)
		return -EBUSY;

	if (!cpu_online(cpu))
		return -EINVAL;

	cpu_hotplug_begin();

	err = __cpu_notify(CPU_DOWN_PREPARE | mod, hcpu, -1, &nr_calls);
	if (err) {
		nr_calls--;
		__cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
		printk("%s: attempt to take down CPU %u failed\n",
				__func__, cpu);
		goto out_release;
	}

	err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
	if (err) {
		
		cpu_notify_nofail(CPU_DOWN_FAILED | mod, hcpu);

		goto out_release;
	}
	BUG_ON(cpu_online(cpu));

	while (!idle_cpu(cpu))
		cpu_relax();

	
	__cpu_die(cpu);

	
	cpu_notify_nofail(CPU_DEAD | mod, hcpu);

	check_for_tasks(cpu);

	#ifdef CONFIG_HTC_ACPU_DEBUG
	{
		unsigned int status = 0;
		msm_proc_comm(PCOM_BACKUP_CPU_STATUS, (unsigned*)&cpu, (unsigned*) &status);
	}
	#endif
out_release:
	cpu_hotplug_done();
	if (!err)
		cpu_notify_nofail(CPU_POST_DEAD | mod, hcpu);
	return err;
}
开发者ID:ivanmeler,项目名称:android_kernel_htc_g3u,代码行数:59,代码来源:cpu.c


示例4: panic

void panic(char *str) {
    /* TODO: you can modify it as your wish */
    disable_interrupt();
    printk("\n\n** Kernel panic: %s **\n", str);
    while (1) {
        idle_cpu();
    }
}
开发者ID:rebornix,项目名称:MiniOS_Rebornix,代码行数:8,代码来源:panic.c


示例5: irq_enter

/*
 * Enter an interrupt context.
 */
void irq_enter(void)
{
	__irq_enter();
#ifdef CONFIG_NO_HZ
	if (idle_cpu(smp_processor_id()))
		tick_nohz_update_jiffies();
#endif
}
开发者ID:Mr-Aloof,项目名称:wl500g,代码行数:11,代码来源:softirq.c


示例6: hrtimer_get_target

/*
 * Get the preferred target CPU for NOHZ
 */
static int hrtimer_get_target(int this_cpu, int pinned)
{
#ifdef CONFIG_NO_HZ
	if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu))
		return get_nohz_timer_target();
#endif
	return this_cpu;
}
开发者ID:RolanDroid,项目名称:lge_MonsterKernel-lproj,代码行数:11,代码来源:hrtimer.c


示例7: hrtimer_get_target

/*
 * Get the preferred target CPU for NOHZ
 */
static int hrtimer_get_target(int this_cpu, int pinned)
{
#ifdef CONFIG_NO_HZ
#ifdef CONFIG_SCHED_BFS
	if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu)) {
		int preferred_cpu = get_nohz_load_balancer();

		if (preferred_cpu >= 0)
			return preferred_cpu;
	}
#else
	if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu))
		return get_nohz_timer_target();
#endif
#endif
	return this_cpu;
}
开发者ID:voku,项目名称:neak-kernel-sgs2,代码行数:20,代码来源:hrtimer.c


示例8: thread_b

void thread_b(void){
	int tmp;
	while(1){
		tmp = cnt+1;
		printk("\ndata%d \n", tmp);
		cnt = tmp;
		for (tmp = 0; tmp < 20; tmp++);
		idle_cpu();
	}
}
开发者ID:archeart,项目名称:MiniOS,代码行数:10,代码来源:tests.c


示例9: rcu_debugfs_show

static int rcu_debugfs_show(struct seq_file *m, void *unused)
{
	int cpu, q, s[2], msecs;

	raw_local_irq_disable();
	msecs = div_s64(sched_clock() - rcu_timestamp, NSEC_PER_MSEC);
	raw_local_irq_enable();

	seq_printf(m, "%14u: #batches seen\n",
		rcu_stats.nbatches);
	seq_printf(m, "%14u: #barriers seen\n",
		atomic_read(&rcu_stats.nbarriers));
	seq_printf(m, "%14llu: #callbacks invoked\n",
		rcu_stats.ninvoked);
	seq_printf(m, "%14u: #callbacks left to invoke\n",
		atomic_read(&rcu_stats.nleft));
	seq_printf(m, "%14u: #msecs since last end-of-batch\n",
		msecs);
	seq_printf(m, "%14u: #passes forced (0 is best)\n",
		rcu_stats.nforced);
	seq_printf(m, "\n");

	for_each_online_cpu(cpu)
		seq_printf(m, "%4d ", cpu);
	seq_printf(m, "  CPU\n");

	s[1] = s[0] = 0;
	for_each_online_cpu(cpu) {
		struct rcu_data *rd = &rcu_data[cpu];
		int w = ACCESS_ONCE(rd->which) & 1;
		seq_printf(m, "%c%c%c%d ",
			'-',
			idle_cpu(cpu) ? 'I' : '-',
			rd->wait ? 'W' : '-',
			w);
		s[w]++;
	}
	seq_printf(m, "  FLAGS\n");

	for (q = 0; q < 2; q++) {
		for_each_online_cpu(cpu) {
			struct rcu_data *rd = &rcu_data[cpu];
			struct rcu_list *l = &rd->cblist[q];
			seq_printf(m, "%4d ", l->count);
		}
		seq_printf(m, "  Q%d%c\n", q, " *"[s[q] > s[q^1]]);
	}
	seq_printf(m, "\nFLAGS:\n");
	seq_printf(m, "  I - cpu idle, 0|1 - Q0 or Q1 is current Q, other is previous Q,\n");
	seq_printf(m, "  W - cpu does not permit current batch to end (waiting),\n");
	seq_printf(m, "  * - marks the Q that is current for most CPUs.\n");

	return 0;
}
开发者ID:ARMP,项目名称:samsung_kernel_cooper,代码行数:54,代码来源:jrcu.c


示例10: rcu_check_callbacks

/*
 * Check to see if the scheduling-clock interrupt came from an extended
 * quiescent state, and, if so, tell RCU about it.
 */
void rcu_check_callbacks(int cpu, int user)
{
	if (user ||
	    (idle_cpu(cpu) &&
	     !in_softirq() &&
	     hardirq_count() <= (1 << HARDIRQ_SHIFT)))
		rcu_sched_qs(cpu);
	else if (!in_softirq())
		rcu_bh_qs(cpu);
	rcu_preempt_check_callbacks();
}
开发者ID:Ntemis,项目名称:LG_X3_P880_v20a,代码行数:15,代码来源:rcutiny.c


示例11: rcu_check_callbacks

void rcu_check_callbacks(int cpu, int user)
{
	if (user || 
	    (idle_cpu(cpu) && !in_softirq() && 
				hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
		rcu_qsctr_inc(cpu);
		rcu_bh_qsctr_inc(cpu);
	} else if (!in_softirq())
		rcu_bh_qsctr_inc(cpu);
	tasklet_schedule(&per_cpu(rcu_tasklet, cpu));
}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:11,代码来源:rcupdate.c


示例12: test_server

void test_server(void){
	struct message ms;

	while (1){
		receive(&ms);
		printk("SERVER receive message (%d,%d,%d) from PID:%d", 
			ms.p1, ms.p2, ms.p3, ms.source);
		send(2, &ms);
		idle_cpu();
		}
}
开发者ID:archeart,项目名称:MiniOS,代码行数:11,代码来源:tests.c


示例13: rcu_check_callbacks

/*
 * Check to see if the scheduling-clock interrupt came from an extended
 * quiescent state, and, if so, tell RCU about it.
 */
void rcu_check_callbacks(int cpu, int user)
{
	if (!rcu_needs_cpu(0))
		return;	/* RCU doesn't need anything to be done. */
	if (user ||
	    (idle_cpu(cpu) &&
	     !in_softirq() &&
	     hardirq_count() <= (1 << HARDIRQ_SHIFT)))
		rcu_qsctr_inc(cpu);
	else if (!in_softirq())
		rcu_bh_qsctr_inc(cpu);
}
开发者ID:maxzoel,项目名称:FreeXperia,代码行数:16,代码来源:rcutiny.c


示例14: tick_irq_exit

static inline void tick_irq_exit(void)
{
#ifdef CONFIG_NO_HZ_COMMON
	int cpu = smp_processor_id();

	/* Make sure that timer wheel updates are propagated */
	if ((idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) {
		if (!in_interrupt())
			tick_nohz_irq_exit();
	}
#endif
}
开发者ID:adyjl,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:12,代码来源:softirq.c


示例15: __rcu_delimit_batches

/*
 * Check if the conditions for ending the current batch are true. If
 * so then end it.
 *
 * Must be invoked periodically, and the periodic invocations must be
 * far enough apart in time for the previous batch to become quiescent.
 * This is a few tens of microseconds unless NMIs are involved; an NMI
 * stretches out the requirement by the duration of the NMI.
 *
 * "Quiescent" means the owning cpu is no longer appending callbacks
 * and has completed execution of a trailing write-memory-barrier insn.
 */
static void __rcu_delimit_batches(struct rcu_list *pending)
{
       struct rcu_data *rd;
       struct rcu_list *plist;
       int cpu, eob, prev;

       if (!rcu_scheduler_active)
               return;

       rcu_stats.nlast++;

       /* If an NMI occured then the previous batch may not yet be
        * quiescent.  Let's wait till it is.
        */
       if (rcu_nmi_seen) {
               rcu_nmi_seen = 0;
               rcu_stats.nmis++;
               return;
       }

       /*
        * Find out if the current batch has ended
        * (end-of-batch).
        */
       eob = 1;
       for_each_online_cpu(cpu) {
               rd = &rcu_data[cpu];
               if (rd->wait) {
                       rd->wait = preempt_count_cpu(cpu) > idle_cpu(cpu);
                       if (rd->wait) {
                               eob = 0;
                               break;
                       }
               }
       }

       /*
        * Exit if batch has not ended.  But first, tickle all non-cooperating
        * CPUs if enough time has passed.
        */
       if (eob == 0) {
               if (rcu_wdog_ctr >= rcu_wdog_lim) {
                       rcu_wdog_ctr = 0;
                       rcu_stats.nforced++;
                       for_each_online_cpu(cpu) {
                               if (rcu_data[cpu].wait)
                                       force_cpu_resched(cpu);
                       }
               }
               rcu_wdog_ctr += rcu_hz_period_us;
               return;
       }
开发者ID:AdiPat,项目名称:android_kernel_htc_pico,代码行数:64,代码来源:jrcu.c


示例16: showacpu

static void showacpu(void *dummy)
{
	unsigned long flags;

	/* Idle CPUs have no interesting backtrace. */
	if (idle_cpu(smp_processor_id()))
		return;

	spin_lock_irqsave(&show_lock, flags);
	printk(KERN_INFO "CPU%d:\n", smp_processor_id());
	show_stack(NULL, NULL);
	spin_unlock_irqrestore(&show_lock, flags);
}
开发者ID:ASAZING,项目名称:Android-Kernel-Gt-s7390l,代码行数:13,代码来源:sysrq.c


示例17: irq_exit

/*
 * Exit an interrupt context. Process softirqs if needed and possible:
 */
void irq_exit(void)
{
	account_system_vtime(current);
	trace_hardirq_exit();
	sub_preempt_count(IRQ_EXIT_OFFSET);
	if (!in_interrupt() && local_softirq_pending())
		invoke_softirq();

#ifdef CONFIG_NO_HZ
	/* Make sure that timer wheel updates are propagated */
	if (!in_interrupt() && idle_cpu(smp_processor_id()) && !need_resched())
		tick_nohz_stop_sched_tick();
#endif
	preempt_enable_no_resched();
}
开发者ID:Mr-Aloof,项目名称:wl500g,代码行数:18,代码来源:softirq.c


示例18: test_sender

void test_sender(void){
	struct message ms;

	ms.p1 = 1;
	ms.p2 = 2;
	ms.p3 = 3;
	while (1){
		printk("SENDER send message (%d,%d,%d) to SERVER\n",
			ms.p1, ms.p2, ms.p3);

		invoke(SERVER, &ms);
		ms.p3++;
		idle_cpu();
		}
}
开发者ID:archeart,项目名称:MiniOS,代码行数:15,代码来源:tests.c


示例19: ccsp_safe_pause_timeout

/*{{{  void ccsp_safe_pause_timeout (sched_t *sched)*/
void ccsp_safe_pause_timeout (sched_t *sched)
{
	unsigned int sync;
	Time now;

	#ifdef DEBUG_RTS
	fprintf(stderr, "USERPROC: ccsp_safe_pause_timeout() entered\n");
	#endif

	if (sched->tq_fptr == NULL) {
		return;
	} else if (Time_PastTimeout (sched)) {
		return;
	}

	now = Time_GetTime(sched);
	if (Time_AFTER (sched->tq_fptr->time, now)) {
		unsigned int usecs = Time_MINUS (sched->tq_fptr->time, now);

		if (usecs < min_sleep) {
			while (!(sync = att_safe_swap (&(sched->sync), 0))) {
				int i = 10;
				
				while (i--) {
					idle_cpu ();
				}

				if (Time_PastTimeout (sched)) {
					break;
				}

				serialise ();
			}

			if (sync) {
				/* restore detected flags */
				att_safe_or (&(sched->sync), sync);
			}
		} else {
			ccsp_set_next_alarm (sched, usecs);
			ccsp_safe_pause (sched);
		}
	}

	#ifdef DEBUG_RTS
	fprintf(stderr, "USERPROC: ccsp_safe_pause_timeout() about to exit (return 0)\n");
	#endif
}
开发者ID:bsmr-misc-forks,项目名称:kroc,代码行数:49,代码来源:userproc.c


示例20: irq_exit

/*
 * Exit an interrupt context. Process softirqs if needed and possible:
 */
void irq_exit(void)
{
#ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED
	local_irq_disable();
#else
	WARN_ON_ONCE(!irqs_disabled());
#endif

	account_irq_exit_time(current);
	trace_hardirq_exit();
	sub_preempt_count(HARDIRQ_OFFSET);
	if (!in_interrupt() && local_softirq_pending())
		invoke_softirq();

#ifdef CONFIG_NO_HZ
	/* Make sure that timer wheel updates are propagated */
	if (idle_cpu(smp_processor_id()) && !in_interrupt() && !need_resched())
		tick_nohz_irq_exit();
#endif
	rcu_irq_exit();
}
开发者ID:jay-caoj,项目名称:linux-3.9.6,代码行数:24,代码来源:softirq.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ idle_regs函数代码示例发布时间:2022-05-30
下一篇:
C++ idle函数代码示例发布时间: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