Re: [PATCH] mm: extend prefault helpers to fault in more than PAGE_SIZE

From: Hillf Danton
Date: Thu Feb 16 2012 - 08:32:09 EST


On Thu, Feb 16, 2012 at 8:01 PM, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote:
> @@ -416,17 +417,20 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
> Â Â Â Â * Writing zeroes into userspace here is OK, because we know that if
> Â Â Â Â * the zero gets there, we'll be overwriting it.
> Â Â Â Â */
> - Â Â Â ret = __put_user(0, uaddr);
> + Â Â Â while (uaddr <= end) {
> + Â Â Â Â Â Â Â ret = __put_user(0, uaddr);
> + Â Â Â Â Â Â Â if (ret != 0)
> + Â Â Â Â Â Â Â Â Â Â Â return ret;
> + Â Â Â Â Â Â Â uaddr += PAGE_SIZE;
> + Â Â Â }

What if
uaddr & ~PAGE_MASK == PAGE_SIZE -3 &&
end & ~PAGE_MASK == 2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/