Re: [PATCH v2 00/10] evacuate struct page from the block layer, introduce __pfn_t

From: Ingo Molnar
Date: Fri May 08 2015 - 01:38:13 EST



Al,

I was wondering about the struct page rules of
iov_iter_get_pages_alloc(), used in various places. There's no
documentation whatsoever in lib/iov_iter.c, nor in
include/linux/uio.h, and the changelog that introduced it only says:

commit 91f79c43d1b54d7154b118860d81b39bad07dfff
Author: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Date: Fri Mar 21 04:58:33 2014 -0400

new helper: iov_iter_get_pages_alloc()

same as iov_iter_get_pages(), except that pages array is allocated
(kmalloc if possible, vmalloc if that fails) and left for caller to
free. Lustre and NFS ->direct_IO() switched to it.

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

So if code does iov_iter_get_pages_alloc() on a user address that has
a real struct page behind it - and some other code does a regular
get_user_pages() on it, we'll have two sets of struct page
descriptors, the 'real' one, and a fake allocated one, right?

How does that work? Nobody else can ever discover these fake page
structs, so they don't really serve any 'real' synchronization purpose
other than the limited role of IO completion.

Thanks,

Ingo
--
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/