[sheepdog] [PATCH v2] work queue: introduce dynamic roof to max nr threads

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Mar 5 01:33:10 CET 2013


>  
> +static inline uint64_t wq_get_roof(int tc)
> +{
> +	struct vnode_info *vinfo = get_vnode_info();
> +	int nr_nodes = vinfo->nr_nodes;
> +	uint64_t nr = 1;
> +
> +	put_vnode_info(vinfo);
> +	switch (tc) {
> +	case WQ_ORDERED:
> +		break;
> +	case WQ_DYNAMIC:
> +		/* FIXME 2 * nr_nodes threads. No rationale yet. */
> +		nr = nr_nodes * 2;
> +		break;
> +	case WQ_UNLIMITED:
> +		nr = SIZE_MAX;
> +		break;
> +	default:
> +		panic("Invalid threads control %d", tc);
> +	}
> +	return nr;
> +}
> +

get_vnode_info and put_vnode_info should be called only in the case of
WQ_DYNAMIC for code readability and performance (the cost of uatomic
operations is cheap though).

Thanks,

Kazutaka



More information about the sheepdog mailing list