On Wed, 4 Jul 2018, Jan Kara wrote: > > So this seems unsolvable without having the caller specify that it knows the > > page type, and that it is therefore safe to decrement page->dma_pinned_count. > > I was hoping I'd found a way, but clearly I haven't. :) > > Well, I think the misconception is that "pinned" is a fundamental property > of a page. It is not. "pinned" is a property of a page reference (i.e., a > kind of reference that can be used for DMA access) and page gets into > "pinned" state if it has any reference of "pinned" type. And when you > realize this, it is obvious that you just have to have a special api for > getting and dropping references of this "pinned" type. For getting we > already have get_user_pages(), for putting we have to create the api... Maybe we can do something by creating a special "pinned" bit in the pte? If it is a RDMA reference then set that pinned bit there. Thus any of the references could cause a pin. Since the page struct does not contain that information we therefore have to scan through the ptes to figure out if a page is pinned? If so then we would not need a special function for dropping the reference. References to a page can also be created from devices mmu. Maybe we could at some point start to manage them in a similar way to the page tables of the processor? The mmu notifiers are a bit awkward if we need closer mm integration. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html