[LTP] [PATCH v2 1/2] lib: move get_numcpus to librttest.[ch]

Cyril Hrubis chrubis@suse.cz
Fri Jan 17 17:17:40 CET 2025


Hi!
> +int get_numcpus(void)
> +{
> +	long numcpus_conf = sysconf(_SC_NPROCESSORS_CONF);
> +	size_t size = CPU_ALLOC_SIZE(numcpus_conf);
> +	cpu_set_t *cpuset = CPU_ALLOC(numcpus_conf);
> +
> +	CPU_ZERO_S(size, cpuset);
> +	/* Get the number of cpus accessible to the current process */
> +	sched_getaffinity(0, size, cpuset);
> +
> +	return CPU_COUNT_S(size, cpuset);
> +}

Can we please add another patch on the top that adds CPU_FREE() to this
function?

For this patch:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list