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

C++ cpu_up函数代码示例

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

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



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

示例1: hotplug_online_all_work_fn

static void __cpuinit hotplug_online_all_work_fn(struct work_struct *work)
{
	int cpu;
	for_each_possible_cpu(cpu) {
		if (likely(!cpu_online(cpu))) {
			cpu_up(cpu);
			pr_info("auto_hotplug: CPU%d up.\n", cpu);
		}
	}
	schedule_delayed_work(&hotplug_unpause_work, HZ);
	schedule_delayed_work_on(0, &hotplug_decision_work, MIN_SAMPLING_RATE);
}
开发者ID:piasek1906,项目名称:Piasek-KK,代码行数:12,代码来源:auto_hotplug.c


示例2: wake_offline_cpus

/*
 * We need to make sure each present CPU is online.  The next kernel will scan
 * the device tree and assume primary threads are online and query secondary
 * threads via RTAS to online them if required.  If we don't online primary
 * threads, they will be stuck.  However, we also online secondary threads as we
 * may be using 'cede offline'.  In this case RTAS doesn't see the secondary
 * threads as offline -- and again, these CPUs will be stuck.
 *
 * So, we online all CPUs that should be running, including secondary threads.
 */
static void wake_offline_cpus(void)
{
	int cpu = 0;

	for_each_present_cpu(cpu) {
		if (!cpu_online(cpu)) {
			printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
			       cpu);
			cpu_up(cpu);
		}
	}
}
开发者ID:kozmikkick,项目名称:eternityprj-kernel-endeavoru-128,代码行数:22,代码来源:machine_kexec_64.c


示例3: main

int main(int argc, char *argv[])
{
	int ret = 0;
	int cpu = 1;
	unsigned int cpu_set = 1; /* Run on core0 */

#ifdef MPCTL_SERVER
	mpctl_server_init();
#endif

	mpdecision_server_init();

	ret = syscall(__NR_sched_setaffinity,0, sizeof(cpu_set), &cpu_set);
	if (ret < 0) {
		msg("Cannot set cpu affinity: %s\n", strerror(-ret));
		return ret;
	}

	core1_status = CORE_DOWN;
	cpu_up(1, core1_status);

	msg("Core1 status: %s\n", core1_status ? "online" : "offline");

	/* Priority ? */
	setpriority(PRIO_PROCESS, getpid(), -20);

	/* Command line overrides */
	parse_args(argc, argv);

	/* Enable kernel calculation of rq depth */
	write_file_uint32(RQ_POLL_MS, poll_ms);

	def_timer_fd = open(DEF_TIMER_MS, O_RDONLY);
	if (def_timer_fd < 0) {
		msg("Unable to open deferrable timer file\n");
		return -1;
	}

	pthread_create(&mp_decision, NULL, do_mp_decision, NULL);
	pthread_create(&hotplug_thread, NULL, do_hotplug, (void *)cpu);

	pthread_join(hotplug_thread, NULL);
	pthread_join(mp_decision, NULL);

	close(def_timer_fd);

	mpdecision_server_exit();

#ifdef MPCTL_SERVER
	mpctl_server_exit();
#endif
	return ret;
}
开发者ID:GTurn,项目名称:Matrix_Force,代码行数:53,代码来源:decision.c


示例4: store_online_control

static ssize_t __ref store_online_control(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{
	struct cpu *cpu = container_of(dev, struct cpu, dev);
	ssize_t ret;

	cpu_hotplug_driver_lock();
	switch (buf[0]) 
	{
		case '0': // control via sysfs
			ret = cpu_down(cpu->dev.id);
			if (!ret)
				kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
			online_control_mode[cpu->dev.id] = ONL_CONT_MODE_SYSFS;
			break;
			
		case '1': // forced online
			ret = cpu_up(cpu->dev.id);
			if (!ret)
				kobject_uevent(&dev->kobj, KOBJ_ONLINE);
			online_control_mode[cpu->dev.id] = ONL_CONT_MODE_ONLINE;
			break;
			
		case '2': // forced offline
			ret = cpu_down(cpu->dev.id);
			if (!ret)
				kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
			online_control_mode[cpu->dev.id] = ONL_CONT_MODE_OFFLINE;
			break;
			
		case '3': // only allowed for CPU core 4 - force offline but lock it to core 3
			if (cpu->dev.id == ID_CPU_CORE_4)
			{
				ret = cpu_down(cpu->dev.id);
				if (!ret)
					kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
				online_control_mode[cpu->dev.id] = ONL_CONT_MODE_LOCK4_3;
			}
			else
				ret = -EINVAL;
			break;
			
		default:
			ret = -EINVAL;
	}
	cpu_hotplug_driver_unlock();

	if (ret >= 0)
		ret = count;
	return ret;
}
开发者ID:DJLaMontagneIII-Legacy,项目名称:kernel_oneplus_msm8974,代码行数:52,代码来源:cpu.c


示例5: intelli_plug_work_fn

static void __cpuinit intelli_plug_work_fn(struct work_struct *work)
{
	unsigned int nr_run_stat, sampling_rate, online_cpus;
	unsigned int min_sampling_rate_jiffies = 0;

	if (intelli_plug_active == 1 && !excluded_governor) {
		online_cpus = num_online_cpus();
		nr_run_stat = calculate_thread_stats();

		if (!suspended) {
			switch (nr_run_stat) {
				case 1:
					if (persist_count > 0) {
						persist_count--;
					}
					else if (online_cpus == 2) {
						cpu_down(1);
					}
#ifdef DEBUG_INTELLI_PLUG
					pr_info("case 1: %u\n", persist_count);
#endif
					break;
				case 2:
					persist_count = DUAL_CORE_PERSISTENCE / CPU_DOWN_FACTOR;
					if (online_cpus == 1)
						cpu_up(1);
#ifdef DEBUG_INTELLI_PLUG
					pr_info("case 2: %u\n", persist_count);
#endif
					break;
				default:
					pr_err("Run Stat Error: Bad value %u\n", nr_run_stat);
					break;
			}
		}

		/* increase the sampling rate dynamically based on online cpus */
		min_sampling_rate_jiffies = msecs_to_jiffies(min_sampling_rate);
		sampling_rate = min_sampling_rate_jiffies * online_cpus;
	} else {
		/* increase the sampling rate for screen-off */
		sampling_rate = msecs_to_jiffies(min_sampling_rate) << 3;
#ifdef DEBUG_INTELLI_PLUG
		pr_info("intelli_plug is suspened!\n");
#endif
	}

#ifdef DEBUG_INTELLI_PLUG
	pr_info("sampling_rate is: %d\n", jiffies_to_msecs(sampling_rate));
#endif
	schedule_delayed_work_on(0, &intelli_plug_work, sampling_rate);
}
开发者ID:anewkirk,项目名称:AJK,代码行数:52,代码来源:intelli_plug.c


示例6: store_cpu_online_min

static ssize_t __ref store_cpu_online_min(struct kobject *a, struct attribute *b,
				  const char *buf, size_t count)
{
	int ret = 0;
	ret = set_pmqos_data(cpu_online_min_qos_array, PM_QOS_CPU_ONLINE_MIN, buf);
	if (ret)
		return ret;

	if (num_online_cpus() < pm_qos_request(PM_QOS_CPU_ONLINE_MIN))
		cpu_up(1);

	return count;
}
开发者ID:erickwill,项目名称:Gear_S_Kernel,代码行数:13,代码来源:cpufreq_pmqos.c


示例7: exynos_dm_hotplug_notifier

static int __ref exynos_dm_hotplug_notifier(struct notifier_block *notifier,
					unsigned long pm_event, void *v)
{
	int i, j;

	switch (pm_event) {
	case PM_SUSPEND_PREPARE:
		mutex_lock(&thread_lock);
		in_suspend_prepared = true;

		if (!dynamic_hotplug(CMD_NORMAL))
			prev_cmd = CMD_NORMAL;

		exynos_dm_hotplug_disable();
		if (dm_hotplug_task) {
			kthread_stop(dm_hotplug_task);
			dm_hotplug_task = NULL;
		}

		for (i = 4; i < 11; i++) {
			j = i;
			if (j >= 8) j = 11 - j;
			if (!cpu_online(j)) {
				cpu_up(j);
			}
		}

		mutex_unlock(&thread_lock);
		break;

	case PM_POST_SUSPEND:
		mutex_lock(&thread_lock);
		exynos_dm_hotplug_enable();

		dm_hotplug_task =
			kthread_create(on_run, NULL, "thread_hotplug");
		if (IS_ERR(dm_hotplug_task)) {
			mutex_unlock(&thread_lock);
			pr_err("Failed in creation of thread.\n");
			return -EINVAL;
		}

		in_suspend_prepared = false;

		wake_up_process(dm_hotplug_task);
		mutex_unlock(&thread_lock);
		break;
	}

	return NOTIFY_OK;
}
开发者ID:SM-G920Pold,项目名称:Vindicator-S6-Sprint,代码行数:51,代码来源:dm_cpu_hotplug.c


示例8: cpus_online_all

static inline void cpus_online_all(void)
{
    unsigned int cpu,j;

    for(j = suspend_cpu_num ; j < core_limit; j++)
    {
        cpu = cpuidx[j];
        if (cpu_is_offline(cpu))
            cpu_up(cpu);
    }

    pr_info("%s: all cpus were onlined\n", V4TKPLUG);
    if(DEBUG) print_cpus_all();
}
开发者ID:vadimtk,项目名称:moto-x-kernel,代码行数:14,代码来源:v4tkplug.c


示例9: enable_nonboot_cpus

void enable_nonboot_cpus(void)
{
	int cpu, error;

	printk("Thawing cpus ...\n");
	for_each_cpu_mask(cpu, frozen_cpus) {
		error = cpu_up(cpu);
		if (!error) {
			printk("CPU%d is up\n", cpu);
			continue;
		}
		printk("Error taking cpu %d up: %d\n", cpu, error);
		panic("Not enough cpus");
	}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:14,代码来源:smp.c


示例10: cpufreq_replug_thread

static void cpufreq_replug_thread(struct work_struct *cpufreq_replug_work)
{
	int cpu;

	/* For UX500 platform, PRCMU need to update CPU1 policy */
	msleep(3000);

	for_each_cpu_not(cpu, cpu_online_mask) {

	if (cpu == 0)
		continue;
		cpu_up(cpu);
	}
}
开发者ID:burak185,项目名称:i9070_kernel_CoCore-E,代码行数:14,代码来源:cpufreq_performance.c


示例11: online_all_fn

static inline void online_all_fn(struct work_struct *work)
{
	unsigned int cpu;

	for_each_cpu_not_adj(cpu, cpu_online_mask) {
		if (cpu == 0)
			continue;
		cpu_up(cpu);
#if DEBUG
		pr_info("CPU%u up.\n", cpu);
		pr_info("CPU(s) running: %u\n", num_online_cpus());
#endif
	}
}
开发者ID:oleid,项目名称:android_kernel_sony_apq8064_yuga_5.x,代码行数:14,代码来源:apq_hotplug.c


示例12: bcl_handle_hotplug

static void __ref bcl_handle_hotplug(struct work_struct *work)
{
	int ret = 0, _cpu = 0;

	mutex_lock(&bcl_hotplug_mutex);
	if (cpumask_empty(bcl_cpu_online_mask))
		bcl_update_online_mask();
#ifndef CONFIG_LGE_PM
	if  (bcl_soc_state == BCL_LOW_THRESHOLD
		|| bcl_vph_state == BCL_LOW_THRESHOLD)
#else
	if  (bcl_vph_state == BCL_LOW_THRESHOLD)
#endif
		bcl_hotplug_request = bcl_soc_hotplug_mask;
	else if (bcl_ibat_state == BCL_HIGH_THRESHOLD)
		bcl_hotplug_request = bcl_hotplug_mask;
	else
		bcl_hotplug_request = 0;

	for_each_possible_cpu(_cpu) {
		if ((!(bcl_hotplug_mask & BIT(_cpu))
			&& !(bcl_soc_hotplug_mask & BIT(_cpu)))
			|| !(cpumask_test_cpu(_cpu, bcl_cpu_online_mask)))
			continue;

		if (bcl_hotplug_request & BIT(_cpu)) {
			if (!cpu_online(_cpu))
				continue;
			ret = cpu_down(_cpu);
			if (ret)
				pr_err("Error %d offlining core %d\n",
					ret, _cpu);
			else
				pr_info("Set Offline CPU:%d\n", _cpu);
		} else {
			if (cpu_online(_cpu))
				continue;
			ret = cpu_up(_cpu);
			if (ret)
				pr_err("Error %d onlining core %d\n",
					ret, _cpu);
			else
				pr_info("Allow Online CPU:%d\n", _cpu);
		}
	}

	mutex_unlock(&bcl_hotplug_mutex);
	return;
}
开发者ID:TeamRegular,项目名称:android_kernel_lge_msm8992,代码行数:49,代码来源:battery_current_limit.c


示例13: do_core_control

static void __ref do_core_control(long temp)
{
	int i = 0;
	int ret = 0;

	if (!core_control_enabled)
		return;

	mutex_lock(&core_control_mutex);
	if (msm_thermal_info.core_control_mask &&
		temp >= msm_thermal_info.core_limit_temp_degC) {
		for (i = num_possible_cpus(); i > 0; i--) {
			if (!(msm_thermal_info.core_control_mask & BIT(i)))
				continue;
			if (cpus_offlined & BIT(i) && !cpu_online(i))
				continue;
			pr_info("%s: Set Offline: CPU%d Temp: %ld\n",
					KBUILD_MODNAME, i, temp);
			ret = cpu_down(i);
			if (ret)
				pr_err("%s: Error %d offline core %d\n",
					KBUILD_MODNAME, ret, i);
			cpus_offlined |= BIT(i);
			break;
		}
	} else if (msm_thermal_info.core_control_mask && cpus_offlined &&
		temp <= (msm_thermal_info.core_limit_temp_degC -
			msm_thermal_info.core_temp_hysteresis_degC)) {
		for (i = 0; i < num_possible_cpus(); i++) {
			if (!(cpus_offlined & BIT(i)))
				continue;
			cpus_offlined &= ~BIT(i);
			pr_info("%s: Allow Online CPU%d Temp: %ld\n",
					KBUILD_MODNAME, i, temp);
			/*
			 * If this core is already online, then bring up the
			 * next offlined core.
			 */
			if (cpu_online(i))
				continue;
			ret = cpu_up(i);
			if (ret)
				pr_err("%s: Error %d online core %d\n",
						KBUILD_MODNAME, ret, i);
			break;
		}
	}
	mutex_unlock(&core_control_mutex);
}
开发者ID:sparkmbox,项目名称:singh-kernel,代码行数:49,代码来源:msm_thermal.c


示例14: update_core_config

static int update_core_config(unsigned int cpunumber, bool up)
{
	int ret = -EINVAL;
	unsigned int nr_cpus = num_online_cpus();
	int max_cpus = tegra_cpq_max_cpus();
	int min_cpus = tegra_cpq_min_cpus();

#if CPUQUIET_DEBUG_VERBOSE
	pr_info(CPUQUIET_TAG "%s\n", __func__);
#endif
				
	if (cpq_state == TEGRA_CPQ_DISABLED || cpunumber >= nr_cpu_ids)
		return ret;

	/* sync with tegra_cpuquiet_work_func 
	 else if we are currently switching to LP and an up
	 comes we can end up with more then 1 core up and
	 governor stopped and !lp mode */
    if (!mutex_trylock (&hotplug_lock)){
#if CPUQUIET_DEBUG_VERBOSE
		pr_info(CPUQUIET_TAG "%s failed to get hotplug_lock\n", __func__);
#endif
        return -EBUSY;
	}
			
	if (up) {
		if(is_lp_cluster()) {
			ret = -EBUSY;
		} else {
			if (nr_cpus < max_cpus){
				show_status("UP", 0, cpunumber);
				ret = cpu_up(cpunumber);
			}
		}
	} else {
		if (is_lp_cluster()) {
			ret = -EBUSY;
		} else {
			if (nr_cpus > 1 && nr_cpus > min_cpus){
				show_status("DOWN", 0, cpunumber);
				ret = cpu_down(cpunumber);
			}
		}
	}

	mutex_unlock(&hotplug_lock);
			
	return ret;
}
开发者ID:hyl,项目名称:enrc2b-kernel-BLADE,代码行数:49,代码来源:cpuquiet.c


示例15: hotplug_online_single_work_fn

static void hotplug_online_single_work_fn(struct work_struct *work)
{
        int cpu;

        for_each_possible_cpu(cpu) {
                if (cpu) {
                        if (!cpu_online(cpu)) {
                                cpu_up(cpu);
                                pr_info("auto_hotplug: CPU%d up.\n", cpu);
                                break;
                        }
                }
        }
        schedule_delayed_work_on(0, &hotplug_decision_work, MIN_SAMPLING_RATE);
}
开发者ID:perillamint,项目名称:Kite2,代码行数:15,代码来源:auto_hotplug.c


示例16: hotplug_online_all_work_fn

static void hotplug_online_all_work_fn(struct work_struct *work)
{
        int cpu;
        for_each_possible_cpu(cpu) {
                if (likely(!cpu_online(cpu))) {
                        cpu_up(cpu);
                        pr_info("auto_hotplug: CPU%d up.\n", cpu);
                }
        }
        /*
         * Pause for 2 seconds before even considering offlining a CPU
         */
        schedule_delayed_work(&hotplug_unpause_work, HZ * 2);
        schedule_delayed_work_on(0, &hotplug_decision_work, MIN_SAMPLING_RATE);
}
开发者ID:perillamint,项目名称:Kite2,代码行数:15,代码来源:auto_hotplug.c


示例17: sleepy_plug_resume

static void __cpuinit sleepy_plug_resume(struct power_suspend *handler)
{
	mutex_lock(&sleepy_plug_mutex);
	/* keep cores awake long enough for faster wake up */
	suspended = false;
	mutex_unlock(&sleepy_plug_mutex);

	/* wake up everyone */
	num_of_active_cores = 2;

	cpu_up(1);

	queue_delayed_work_on(0, sleepy_plug_wq, &sleepy_plug_work,
		msecs_to_jiffies(10));
}
开发者ID:BrateloSlava,项目名称:SaveEnergy-3,代码行数:15,代码来源:sleepy_plug.c


示例18: enable_fast_hotplug

static int enable_fast_hotplug(const char *val, const struct kernel_param *kp){
	int cpu;
	int ret = param_set_bool(val, kp);
	if(!fast_hotplug_enabled){
		pr_info(HOTPLUG_INFO_TAG"Fast hotplug disabled\n");
		mutex_lock(&mutex);
		flush_workqueue(hotplug_wq);
		for_each_possible_cpu(cpu){
			if(cpu == 0)
				continue;
			cpu_up(cpu);
		}
		is_sleeping = true;
		mutex_unlock(&mutex);
	} else {
开发者ID:JessicaThornsby,项目名称:android_kernel_sony_msm8974ac,代码行数:15,代码来源:fast_hotplug.c


示例19: up_one

/* Iterate through possible CPUs and bring online the first offline found */
static inline void up_one(void)
{
	unsigned int cpu;

	/* All CPUs are online, return */
	if (num_online_cpus() == max_online)
		goto out;

	cpu = cpumask_next_zero(0, cpu_online_mask);
	if (cpu < nr_cpu_ids)
		cpu_up(cpu);
out:
	down_timer = 0;
	up_timer = 0;
}
开发者ID:Nowadays,项目名称:Vindicator,代码行数:16,代码来源:blu_plug.c


示例20: smp_init

/* Called by boot processor to activate the rest. */
static void __init smp_init(void)
{
	unsigned int cpu;

	/* FIXME: This should be done in userspace --RR */
	for_each_present_cpu(cpu) {
		if (num_online_cpus() >= setup_max_cpus)
			break;
		if (!cpu_online(cpu))
			cpu_up(cpu);
	}

	/* Any cleanup work */
	printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
	smp_cpus_done(setup_max_cpus);
}
开发者ID:badcompany1982,项目名称:android_kernel_zte_V768,代码行数:17,代码来源:main.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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