On Wed, Jul 10, 2013 at 09:00:33PM -0400, Jerome Glisse wrote: > On Wed, Jul 10, 2013 at 8:27 PM, Jean-Sébastien Pédron > <jean-sebastien.pedron@xxxxxxxxxxx> wrote: > > Hello, > > > > I'm trying to understand how TTM buffer object mapping works on Linux, to > > make this behave properly on FreeBSD. > > > > Here's what I think I understand: > > > > When a buffer object is mmap()'d, ttm_bo_vm_open() is called. When there's a > > page fault, the page is looked up and inserted in the VMA using > > vm_insert_mixed(). When a buffer object is munmap()'d, ttm_bo_vm_close() is > > called, which drops a reference. When the last reference is dropped, the > > buffer object is destroyed. > > > > What's still not clear to me is how munmap() works here. After talking about > > this on IRC with some people, I think that unmap_mapping_range() (called by > > ttm_bo_unmap_virtual_locked()) is equivalent to calling munmap() from > > userland. Is that true? > > Yes that's true. Afaik unmap_mapping_range only kills the ptes and doesn't remove the vma. So not equivalent to a munmap from userspace. It simply allows us to intercept the next access in the page fault handler and move the buffer back into place. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel