Commit 0110f5cf authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: update drop_lazy_iovs to handle addresses outside IOVs

Currently drop_lazy_iovs presumes that the range that should be dropped
starts inside an IOV. This works fine with page faults and background pages
but will fail for mapping changes.

travis-ci: success for lazy-pages: add non-#PF events handling (rev2)
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 29fc1ad7
......@@ -340,12 +340,17 @@ static int drop_lazy_iovs(struct lazy_pages_info *lpi, unsigned long addr,
unsigned long start = iov->base;
unsigned long end = start + iov->len;
if (len <= 0)
if (len <= 0 || addr + len < start)
break;
if (addr < start || addr >= end)
if (addr >= end)
continue;
if (addr < start) {
len -= (start - addr);
addr = start;
}
/*
* The range completely fits into the current IOV.
* If addr equals iov_base we just "drop" the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment