Re: Remapping pages mapped to userspace (was: [PATCH 10 of 20] ipath- support for userspace apps using core driver)

From: Hugh Dickins
Date: Fri Mar 17 2006 - 13:17:29 EST

On Fri, 17 Mar 2006, Linus Torvalds wrote:
> Anyway, zap_page_range() would do what you want, but it's not exported,
> and I'm not convinced it's even something we want to export. You can only
> zap a page range from within the context of the zappee, not from an
> external module/driver.
> [ Maybe it works if somebody else calls it, maybe it doesn't. I wouldn't
> bet on it, and more importantly, I can pretty much _guarantee_ that a
> driver will get the "struct mm_struct" reference counting wrong. ]

But vmtruncate or unmap_mapping_range is quite used to operating on
whatever mm's have mapped the file, so should be a safe route. Except
here it's a device mapped VM_PFNMAP, so there might prove to be some
gotchas. I'd be happy to make a nopage fault on VM_PFNMAP give SIGBUS,
for sensible behaviour after the "truncate" - but recent history warns
we're liable then to discover some app expecting otherwise ;)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at