当前位置: 首页>>代码示例>>C++>>正文


C++ cpumask_first函数代码示例

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


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

示例1: pcrypt_do_parallel

static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
			      struct padata_pcrypt *pcrypt)
{
	unsigned int cpu_index, cpu, i;
	struct pcrypt_cpumask *cpumask;

	cpu = *cb_cpu;

	rcu_read_lock_bh();
	cpumask = rcu_dereference_bh(pcrypt->cb_cpumask);
	if (cpumask_test_cpu(cpu, cpumask->mask))
			goto out;

	if (!cpumask_weight(cpumask->mask))
			goto out;

	cpu_index = cpu % cpumask_weight(cpumask->mask);

	cpu = cpumask_first(cpumask->mask);
	for (i = 0; i < cpu_index; i++)
		cpu = cpumask_next(cpu, cpumask->mask);

	*cb_cpu = cpu;

out:
	rcu_read_unlock_bh();
	return padata_do_parallel(pcrypt->pinst, padata, cpu);
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:28,代码来源:pcrypt.c

示例2: for_each_cpu

	/*
	 * This needs a separate iteration over the cpus because we rely on all
	 * topology_sibling_cpumask links to be set-up.
	 */
	for_each_cpu(i, cpu_sibling_setup_mask) {
		o = &cpu_data(i);

		if ((i == cpu) || (has_mp && match_die(c, o))) {
			link_mask(topology_core_cpumask, cpu, i);

			/*
			 *  Does this new cpu bringup a new core?
			 */
			if (cpumask_weight(
			    topology_sibling_cpumask(cpu)) == 1) {
				/*
				 * for each core in package, increment
				 * the booted_cores for this new cpu
				 */
				if (cpumask_first(
				    topology_sibling_cpumask(i)) == i)
					c->booted_cores++;
				/*
				 * increment the core count for all
				 * the other cpus in this package
				 */
				if (i != cpu)
					cpu_data(i).booted_cores++;
			} else if (i != cpu && !c->booted_cores)
				c->booted_cores = cpu_data(i).booted_cores;
		}
		if (match_die(c, o) && !topology_same_node(c, o))
			primarily_use_numa_for_topology();
	}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:34,代码来源:smpboot.c

示例3: rtas_event_scan

static void rtas_event_scan(struct work_struct *w)
{
    unsigned int cpu;

    do_event_scan();

    get_online_cpus();

    cpu = cpumask_next(smp_processor_id(), cpu_online_mask);
    if (cpu >= nr_cpu_ids) {
        cpu = cpumask_first(cpu_online_mask);

        if (first_pass) {
            first_pass = 0;
            event_scan_delay = 30*HZ/rtas_event_scan_rate;

            if (surveillance_timeout != -1) {
                pr_debug("rtasd: enabling surveillance\n");
                enable_surveillance(surveillance_timeout);
                pr_debug("rtasd: surveillance enabled\n");
            }
        }
    }

    schedule_delayed_work_on(cpu, &event_scan_work,
                             __round_jiffies_relative(event_scan_delay, cpu));

    put_online_cpus();
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:29,代码来源:rtasd.c

示例4: tick_do_broadcast

/*
 * Broadcast the event to the cpus, which are set in the mask (mangled).
 */
static void tick_do_broadcast(struct cpumask *mask)
{
	int cpu = smp_processor_id();
	struct tick_device *td;

	/*
	 * Check, if the current cpu is in the mask
	 */
	if (cpumask_test_cpu(cpu, mask)) {
		cpumask_clear_cpu(cpu, mask);
		td = &per_cpu(tick_cpu_device, cpu);
		td->evtdev->event_handler(td->evtdev);
	}

	if (!cpumask_empty(mask)) {
		/*
		 * It might be necessary to actually check whether the devices
		 * have different broadcast functions. For now, just use the
		 * one of the first device. This works as long as we have this
		 * misfeature only on x86 (lapic)
		 */
		td = &per_cpu(tick_cpu_device, cpumask_first(mask));
		td->evtdev->broadcast(mask);
	}
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:28,代码来源:tick-broadcast.c

示例5: pcrypt_aead_init_tfm

static int pcrypt_aead_init_tfm(struct crypto_tfm *tfm)
{
	int cpu, cpu_index;
	struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
	struct pcrypt_instance_ctx *ictx = crypto_instance_ctx(inst);
	struct pcrypt_aead_ctx *ctx = crypto_tfm_ctx(tfm);
	struct crypto_aead *cipher;

	ictx->tfm_count++;

	cpu_index = ictx->tfm_count % cpumask_weight(cpu_online_mask);

	ctx->cb_cpu = cpumask_first(cpu_online_mask);
	for (cpu = 0; cpu < cpu_index; cpu++)
		ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask);

	cipher = crypto_spawn_aead(crypto_instance_ctx(inst));

	if (IS_ERR(cipher))
		return PTR_ERR(cipher);

	ctx->child = cipher;
	tfm->crt_aead.reqsize = sizeof(struct pcrypt_request)
		+ sizeof(struct aead_givcrypt_request)
		+ crypto_aead_reqsize(cipher);

	return 0;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:28,代码来源:pcrypt.c

示例6: disable_nonboot_cpus

int disable_nonboot_cpus(void)
{
	int cpu, first_cpu, error = 0;
#ifdef CONFIG_ARM_EXYNOS_MP_CPUFREQ
	int lated_cpu;
#endif

#ifdef CONFIG_ARM_EXYNOS_MP_CPUFREQ
	if (exynos_boot_cluster == CA7)
		lated_cpu = NR_CA7;
	else
		lated_cpu = NR_CA15;
#endif

	cpu_maps_update_begin();
	first_cpu = cpumask_first(cpu_online_mask);
	/*
	 * We take down all of the non-boot CPUs in one shot to avoid races
	 * with the userspace trying to use the CPU hotplug at the same time
	 */
	cpumask_clear(frozen_cpus);

	printk("Disabling non-boot CPUs ...\n");
	for_each_online_cpu(cpu) {
#if defined(CONFIG_ARM_EXYNOS_MP_CPUFREQ)
		if (cpu == first_cpu || cpu == lated_cpu)
#else
		if (cpu == first_cpu)
#endif
			continue;
		error = _cpu_down(cpu, 1);
		if (!error)
			cpumask_set_cpu(cpu, frozen_cpus);
		else {
			printk(KERN_ERR "Error taking CPU%d down: %d\n",
				cpu, error);
			break;
		}
	}

#ifdef CONFIG_ARM_EXYNOS_MP_CPUFREQ
	if (num_online_cpus() > 1) {
		error = _cpu_down(lated_cpu, 1);
		if (!error)
			cpumask_set_cpu(lated_cpu, frozen_cpus);
		else
			printk(KERN_ERR "Error taking CPU%d down: %d\n",
				lated_cpu, error);
	}
#endif
	if (!error) {
		BUG_ON(num_online_cpus() > 1);
		/* Make sure the CPUs won't be enabled by someone else */
		cpu_hotplug_disabled = 1;
	} else {
		printk(KERN_ERR "Non-boot CPUs are not disabled\n");
	}
	cpu_maps_update_done();
	return error;
}
开发者ID:duki994,项目名称:SM-G850_Kernel_LP,代码行数:60,代码来源:cpu.c

示例7: dmar_msi_set_affinity

static int dmar_msi_set_affinity(struct irq_data *data,
				 const struct cpumask *mask, bool force)
{
	unsigned int irq = data->irq;
	struct irq_cfg *cfg = irq_cfg + irq;
	struct msi_msg msg;
	int cpu = cpumask_first(mask);

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

	if (irq_prepare_move(irq, cpu))
		return -1;

	dmar_msi_read(irq, &msg);

	msg.data &= ~MSI_DATA_VECTOR_MASK;
	msg.data |= MSI_DATA_VECTOR(cfg->vector);
	msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
	msg.address_lo |= MSI_ADDR_DEST_ID_CPU(cpu_physical_id(cpu));

	dmar_msi_write(irq, &msg);
	cpumask_copy(data->affinity, mask);

	return 0;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:26,代码来源:msi_ia64.c

示例8: send_IPI_mask_x2apic_cluster

static void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector)
{
    unsigned int cpu = smp_processor_id();
    cpumask_t *ipimask = per_cpu(scratch_mask, cpu);
    const cpumask_t *cluster_cpus;
    unsigned long flags;

    mb(); /* See above for an explanation. */

    local_irq_save(flags);

    cpumask_andnot(ipimask, &cpu_online_map, cpumask_of(cpu));

    for ( cpumask_and(ipimask, cpumask, ipimask); !cpumask_empty(ipimask);
          cpumask_andnot(ipimask, ipimask, cluster_cpus) )
    {
        uint64_t msr_content = 0;

        cluster_cpus = per_cpu(cluster_cpus, cpumask_first(ipimask));
        for_each_cpu ( cpu, cluster_cpus )
        {
            if ( !cpumask_test_cpu(cpu, ipimask) )
                continue;
            msr_content |= per_cpu(cpu_2_logical_apicid, cpu);
        }

        BUG_ON(!msr_content);
        msr_content = (msr_content << 32) | APIC_DM_FIXED |
                      APIC_DEST_LOGICAL | vector;
        apic_wrmsr(APIC_ICR, msr_content);
    }

    local_irq_restore(flags);
}
开发者ID:HPSI,项目名称:xen-v4v,代码行数:34,代码来源:x2apic.c

示例9: for_each_cpu

	/*
	 * This needs a separate iteration over the cpus because we rely on all
	 * cpu_sibling_mask links to be set-up.
	 */
	for_each_cpu(i, cpu_sibling_setup_mask) {
		o = &cpu_data(i);

		if ((i == cpu) || (has_mp && match_mc(c, o))) {
			link_mask(core, cpu, i);

			/*
			 *  Does this new cpu bringup a new core?
			 */
			if (cpumask_weight(cpu_sibling_mask(cpu)) == 1) {
				/*
				 * for each core in package, increment
				 * the booted_cores for this new cpu
				 */
				if (cpumask_first(cpu_sibling_mask(i)) == i)
					c->booted_cores++;
				/*
				 * increment the core count for all
				 * the other cpus in this package
				 */
				if (i != cpu)
					cpu_data(i).booted_cores++;
			} else if (i != cpu && !c->booted_cores)
				c->booted_cores = cpu_data(i).booted_cores;
		}
	}
开发者ID:CobraJet93,项目名称:kernel-3.10.54,代码行数:30,代码来源:smpboot.c

示例10: next_cpu_for_irq

static int next_cpu_for_irq(struct irq_data *data)
{

#ifdef CONFIG_SMP
	int cpu;
	int weight = cpumask_weight(data->affinity);

	if (weight > 1) {
		cpu = smp_processor_id();
		for (;;) {
			cpu = cpumask_next(cpu, data->affinity);
			if (cpu >= nr_cpu_ids) {
				cpu = -1;
				continue;
			} else if (cpumask_test_cpu(cpu, cpu_online_mask)) {
				break;
			}
		}
	} else if (weight == 1) {
		cpu = cpumask_first(data->affinity);
	} else {
		cpu = smp_processor_id();
	}
	return cpu;
#else
	return smp_processor_id();
#endif
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:28,代码来源:octeon-irq.c

示例11: update_top_cache_domain

static void update_top_cache_domain(int cpu)
{
	struct sched_domain_shared *sds = NULL;
	struct sched_domain *sd;
	int id = cpu;
	int size = 1;

	sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES);
	if (sd) {
		id = cpumask_first(sched_domain_span(sd));
		size = cpumask_weight(sched_domain_span(sd));
		sds = sd->shared;
	}

	rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
	per_cpu(sd_llc_size, cpu) = size;
	per_cpu(sd_llc_id, cpu) = id;
	rcu_assign_pointer(per_cpu(sd_llc_shared, cpu), sds);

	sd = lowest_flag_domain(cpu, SD_NUMA);
	rcu_assign_pointer(per_cpu(sd_numa, cpu), sd);

	sd = highest_flag_domain(cpu, SD_ASYM_PACKING);
	rcu_assign_pointer(per_cpu(sd_asym, cpu), sd);
}
开发者ID:guribe94,项目名称:linux,代码行数:25,代码来源:topology.c

示例12: conplat_misc_init

void conplat_misc_init(void)
{
    g_product_type = drv_get_product_type();
    g_device_id = drv_get_device_id();
    g_if_port_sum = drv_get_slot_max_port();
    drv_get_max_slot(&g_if_slot_sum);
    
    g_control_cpu_first = cpumask_first(cpu_control_mask);
    g_control_cpu_num = num_control_cpus();
    g_data_cpu_first = cpumask_first(cpu_data_mask);
    g_data_cpu_num = num_data_cpus();
    g_cpu_num = g_control_cpu_num + g_data_cpu_num;
        
    printk("conplat_misc_init:control_cpu_first = %d, control_cpu_num = %d\n",g_control_cpu_first, g_control_cpu_num);
    printk("conplat_misc_init:data_cpu_first = %d, data_cpu_num = %d\n",g_data_cpu_first, g_data_cpu_num);
 
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:17,代码来源:misc.c

示例13: sn_set_affinity_irq

static int sn_set_affinity_irq(struct irq_data *data,
			       const struct cpumask *mask, bool force)
{
	struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;
	unsigned int irq = data->irq;
	nasid_t nasid;
	int slice;

	nasid = cpuid_to_nasid(cpumask_first(mask));
	slice = cpuid_to_slice(cpumask_first(mask));

	list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
				 sn_irq_lh[irq], list)
		(void)sn_retarget_vector(sn_irq_info, nasid, slice);

	return 0;
}
开发者ID:LittleForker,项目名称:linux-2.6,代码行数:17,代码来源:irq.c

示例14: get_stagger

/* this assigns a "stagger" to the current CPU, which is used throughout
   the code in this module as an extra array offset, to select the "even"
   or "odd" part of all the divided resources. */
static unsigned int get_stagger(void)
{
#ifdef CONFIG_SMP
	int cpu = smp_processor_id();
	return cpu != cpumask_first(__get_cpu_var(cpu_sibling_map));
#endif
	return 0;
}
开发者ID:3null,项目名称:fastsocket,代码行数:11,代码来源:op_model_p4.c

示例15: tick_handover_do_timer

/*
 * Transfer the do_timer job away from a dying cpu.
 *
 * Called with interrupts disabled.
 */
static void tick_handover_do_timer(int *cpup)
{
	if (*cpup == tick_do_timer_cpu) {
		int cpu = cpumask_first(cpu_online_mask);

		tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
			TICK_DO_TIMER_NONE;
	}
}
开发者ID:longqzh,项目名称:chronnOS,代码行数:14,代码来源:tick-common.c


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