Davide Ancri
|
[QNX7] x86_64 memory virtual <-> physical mapping upon allocation
|
Davide Ancri
10/18/2017 12:08 PM
post118125
|
[QNX7] x86_64 memory virtual <-> physical mapping upon allocation
hi all
I'm porting some code from qnx 6.5 to 7.0, where the kernel gets queried about the physical fragmentation of some memory
just allocated with the following:
mmap64( 0, length, PROT_READ, MAP_SHARED | MAP_ANON | MAP_NOINIT, NOFD, 0 )
All the virtual address space obtained with the mmap64() call gets scanned, calling many times mem_offset64() to get the
lenght of each physically contiguous chunk.
In qnx7, it seems that even if few physically contiguous blocks have been selected for serviceing a mmap64(), the phys -
> virtual mapping is performed in a reversed page-by-page order:
- first virtual page maps to last phys page
- second virtual page maps to second-last phys page
....
- last virtual page maps to first phys page
Here is the output of my mem_offset64() scanning iteration, for a 2 MB mmap64() :
chunk# phys_addr len(hex) len(dec)
0 0001862C000 1000 4096
1 0001862B000 1000 4096
2 0001862A000 1000 4096
3 00018629000 1000 4096
4 00018628000 1000 4096
5 00018627000 1000 4096
6 00018626000 1000 4096
......
506 00018419000 1000 4096
507 00018418000 1000 4096
508 00018417000 1000 4096
509 00018416000 1000 4096
510 00018415000 1000 4096
511 00018414000 1000 4096
This creates some problems to me (lot of stuff to describe virt->phys mapping), while in qnx6 even large mmap64() calls
gets satisfied with an reasonable number of physically contiguous chunks.
Is this a new memory allocation approach developed for qnx7? Or is this a symptom of problems/errors in my kernel build
or config?
Davide
|
|
|