find_swap_entry sparse cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As part of restructuring code for memfd, I want clean up all the
sparse warnings in mm/shmem.c.  Most are straight forward, but I
am not sure about find_swap_entry.  Specifically the code:

	rcu_read_lock();
	radix_tree_for_each_slot(slot, root, &iter, 0) {
		if (*slot == item) {
			found = iter.index;
			break;
		}
		checked++;
		if ((checked % 4096) != 0)
			continue;
		slot = radix_tree_iter_resume(slot, &iter);
		cond_resched_rcu();
	}
	rcu_read_unlock();

The complaint is about that (*slot == item) comparison.

My first thought was to do the radix_tree_deref_slot(),
radix_tree_exception(), radix_tree_deref_retry() thing.
However, I was concerned that swap entries (which this routine
is looking for) are stored as exception entries?  So, perhaps
this should just use rcu_dereference_raw()?

Suggestions would be appreciated.

And, yes I do know that the XArray code would replace all this.
-- 
Mike Kravetz




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux