コード例 #1
0
void
map_cpus_to_prstatus_kdump_cmprs(void)
{
	void **nt_ptr;
	int online, i, j, nrcpus;
	size_t size;

	if (!(online = get_cpus_online()) || (online == kt->cpus))
		return;

	if (CRASHDEBUG(1))
		error(INFO,
		    "cpus: %d online: %d NT_PRSTATUS notes: %d (remapping)\n",
			kt->cpus, online, dd->num_prstatus_notes);

	size = NR_CPUS * sizeof(void *);

	nt_ptr = (void **)GETBUF(size);
	BCOPY(dd->nt_prstatus_percpu, nt_ptr, size);
	BZERO(dd->nt_prstatus_percpu, size);

	/*
	 *  Re-populate the array with the notes mapping to online cpus
	 */
	nrcpus = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS : NR_CPUS);

	for (i = 0, j = 0; i < nrcpus; i++) {
		if (in_cpu_map(ONLINE, i))
			dd->nt_prstatus_percpu[i] = nt_ptr[j++];
	}

	FREEBUF(nt_ptr);
}
コード例 #2
0
static int autohotplug_smart_tryup(struct auto_cpu_hotplug_loadinfo *load)
{
	unsigned int tmp = CONFIG_NR_CPUS;
	int big_nr, little_nr, ret;

	if ((load->max_load != INVALID_LOAD)
			&& (load->max_load >= load_try_up)
			&& is_cpu_load_stable(load->max_cpu, STABLE_UP))
	{
		if (load->max_load >= load_try_boost) {
			if (get_bigs_under(load, load_save_up, NULL)) {
				return 0;
			} else {
				get_cpus_online(load, &little_nr, &big_nr);
				if (big_nr != 0) {
					if (try_up_big())
						ret = 1;
					else
						ret = try_up_little();

					if (ret)
						cpu_boost_lasttime = jiffies;
					return ret;
				} else {
					if (try_up_little())
						ret = 1;
					else
						ret = try_up_big();

					if (ret)
						cpu_boost_lasttime = jiffies;
					return ret;
				}
			}
		} else {
			if (get_cpus_under(load, load_save_up, &tmp)) {
				return 0;
			} else {
				if (try_up_little()) {
					return 1;
				} else {
					if (get_cpus_under(load, load_save_big_up, NULL))
						return 0;
					else
						return try_up_big();
				}
			}
		}
	}

	return 0;
}
コード例 #3
0
static int autohotplug_smart_trydown(struct auto_cpu_hotplug_loadinfo *load)
{
	int big_nr, little_nr;
	unsigned int first, to_down;

	get_cpus_online(load, &little_nr, &big_nr);
	if (get_cpus_under(load, load_try_down, &first) >= 2
				&& is_cpu_load_stable(first, STABLE_DOWN))
	{
		if (little_nr) {
			if (get_littles_under(load, load_try_down * 2, &to_down))
				return do_cpu_down(to_down);
		} else {
			return do_cpu_down(first);
		}
	}

	return 0;
}