On 02/03/2019 21:44, Ira Weiny wrote:
On Sat, Mar 02, 2019 at 12:24:35PM -0800, john.hubbard@xxxxxxxxx wrote:
From: John Hubbard <jhubbard@xxxxxxxxxx>
...
3. Dead code removal: the check for (user_virt & ~page_mask)
is checking for a condition that can never happen,
because earlier:
ÂÂÂÂ user_virt = user_virt & page_mask;
...so, remove that entire phrase.
ÂÂÂÂÂÂÂÂÂ bcnt -= min_t(size_t, npages << PAGE_SHIFT, bcnt);
ÂÂÂÂÂÂÂÂÂ mutex_lock(&umem_odp->umem_mutex);
ÂÂÂÂÂÂÂÂÂ for (j = 0; j < npages; j++, user_virt += PAGE_SIZE) {
-ÂÂÂÂÂÂÂÂÂÂÂ if (user_virt & ~page_mask) {
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ p += PAGE_SIZE;
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (page_to_phys(local_page_list[j]) != p) {
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ret = -EFAULT;
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ break;
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ }
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ put_page(local_page_list[j]);
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ continue;
-ÂÂÂÂÂÂÂÂÂÂÂ }
-
I think this is trying to account for compound pages. (ie page_mask could
represent more than PAGE_SIZE which is what user_virt is being incrimented by.)
But putting the page in that case seems to be the wrong thing to do?
Yes this was added by Artemy[1] now cc'ed.
Right, this is for huge pages, please keep it.
put_page() needed to decrement refcount of the head page.