Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Aug 1998 19:18:24 -0400 (EDT)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        bf20761@binghamton.edu, freebsd-hackers@FreeBSD.ORG
Subject:   Re:  Virtual Memory for buffer
Message-ID:  <199808172318.TAA18758@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> The virtual memory of buffer is allocated from buffer_map in getnewbuf() 
> by calling vm_map_findspace() and vm_map_insert(). Its address is saved in
> b_kvasize and (sometimes) b_data.  These are fine.  However, when
> allocbuf() extend VMIO buffer size, it *truncates* b_data to a page
> boundary before entering buffer pages into KVA.
> 
> I wonder if virtual address space is not always allocated on page
> boundary, then it is possible that after the PTE has changed to point to
> our buffer page, those virtual addresses that does not belong to us and
> yet in the same virtual page could lose their mappings because we truncate
> the b_data.
> 
> I hope someone can clarify this for me.  Thanks a lot.
> 
> -------------------------------------------------- 
> | Zhihui Zhang, http://cs.binghamton.edu/~zzhang |
> | Dept. of Computer Science,  SUNY at Binghamton |
> --------------------------------------------------
> 
A buffer's kva space is always allocated on a page boundary. Most of the
time b_data and b_kvabase are the same, only for buffers that are not page
aligned (e.g. buffers belong to VMIO enabled block device or directory vnode),
b_data and b_kvabase are different, trunc_page(b_data) should always be
b_kvabase though. The buffer still owns the virtual space between b_kvabase
and b_data, so nothing would lose its mapping.

-lq

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808172318.TAA18758>