From: "Jean-Sébastien Pédron" <jean-sebastien.pedron@dumbbell.fr>
To: dri-devel@lists.freedesktop.org
Subject: Questions about TTM buffer object maping
Date: Thu, 11 Jul 2013 02:27:05 +0200 [thread overview]
Message-ID: <51DDFBD9.7000703@dumbbell.fr> (raw)
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?
When a buffer object is moved, what happens to the mapping?
In particular, I see in ttm_bo_move_accel_cleanup() that the ttm
structure can be transferred to ghost_obj, which is destroyed shortly
after. This ends up in ttm_put_pages() which uses __free_page(), for
each page of the buffer object. At this stage, is the ghost object
already munmap()'d? Or does __free_page() unmap a page implicitly (ie.
remove it from VMA)?
Sorry if my questions are stupid, I'm rather new to memory management.
--
Jean-Sébastien Pédron
next reply other threads:[~2013-07-11 0:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 0:27 Jean-Sébastien Pédron [this message]
2013-07-11 1:00 ` Questions about TTM buffer object maping Jerome Glisse
2013-07-11 6:24 ` Daniel Vetter
2013-07-11 14:06 ` Jerome Glisse
2013-07-11 21:43 ` Jean-Sébastien Pédron
2013-07-11 21:51 ` Jerome Glisse
2013-07-11 21:51 ` David Herrmann
2013-07-11 22:04 ` Jean-Sébastien Pédron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51DDFBD9.7000703@dumbbell.fr \
--to=jean-sebastien.pedron@dumbbell.fr \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).