/* We copy the events count, move the bits around and flip the index.  */
void prop_change_shift(struct prop_descriptor *pd, int shift)
/* We copy the events count, move the bits around and flip the index.  */
void prop_change_shift(struct prop_descriptor *pd, int shift)
{
	int index;
	int offset;
	u64 events;
	unsigned long flags;
	if (shift > PROP_MAX_SHIFT)
		shift = PROP_MAX_SHIFT;
	mutex_lock(&pd->mutex);
	index = pd->index ^ 1;
	offset = pd->pg[pd->index].shift - shift;
	if (!offset)
		goto out;
	pd->pg[index].shift = shift;
	local_irq_save(flags);
	events = percpu_counter_sum(&pd->pg[pd->index].events);
	if (offset < 0)
		events <<= -offset;
	else
		events >>= offset;
	percpu_counter_set(&pd->pg[index].events, events);
	smp_wmb();
	pd->index = index;
	local_irq_restore(flags);
	synchronize_rcu();
out:
	mutex_unlock(&pd->mutex);
}