tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kmem-pool-uvm



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/12/11 12:07, Lars Heidieker wrote:
> On 06/09/11 02:01, Mindaugas Rasiukevicius wrote:
>> yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi) wrote:
>>>>> let me explain some background. currently there are a number
>>>>> of kernel_map related problems:
>>>>> 
>>>>> A-1. vm_map_entry is unnecessarily large for KVA allocation
>>>>> purpose.
>>>>> 
>>>>> A-2. kernel-map-entry-merging is there to solve A-1. but it
>>>>> introduced the allocate-for-free problem. ie. to free memory,
>>>>> you might need to split map-entries thus allocate some
>>>>> memory.
>>>>> 
>>>>> A-3. to solve A-2, there is map-entry-reservation mechanism.
>>>>> it's
>>>> complicated and broken.
>>>>> 
>>> <...>
>>> 
>>> i agree that having two allocator for KVA is bad. my idea is
>>> having just one. (kernel_va_arena) no allocation would be made by
>>> vm_map_entries for kernel_map. kernel_map is kept merely for
>>> fault handling.
>>> 
>>> essentially kva allocation would be:
>>> 
>>> va = vmem_alloc(kernel_va_arena, ...); if (pageable) create
>>> kernel_map entry for the va else ... return va;
> 
>> I like this a lot.  Seems an overall win.
> 
> 
> Yes, definitly it simplifies locking a lot. But I don't like the idea
> of mixing vmem and map entries. I think it's cleaner to have one 
> vm_map_entry spawning the entire heap which in turn is controlled by
> a vmem_arena. - From there on two options emerge: Making kmem(9)
> interrupt safe, which seems to have some runtime overhead or to
> retrofit malloc(9) (for the time it is still there) into the vmem 
> backed world.
> 
> Lars
> 

Hi,

i uploaded a new version of the kmem-pool-vmem-uvm patch:
ftp://ftp.netbsd.org/pub/NetBSD/misc/para/kmem-pool-vmem-uvm.patch      

vmem(9) is now in charge for controlling the entire kernel heap,
vmem_create is split into vmem_create and vmem_xcreate with different
import function signatures, this allows the use of vmem_alloc as an
import function.
vmem has two private arenas for it's internal purposes.

special kernel map entry support is removed, it's not required anymore
as well as map entry reservation not required any more as well.

pool(9) kmem(9) are now both backed by a quantum cached arena.
malloc(9) is replaced by small wrapper around kmem(9)

This is what my kernel_map looks like after having made a release build:
(8gb amd64)

$ pmap -R 0

 FFFF800000000000 239364K read/write/exec     [ anon ]
 FFFF80000E9C1000 4067176K read/write/exec     [ anon ]
 FFFF800106D9B000  16384K read/write/exec     [ pager_map ]
 FFFF800107D9B000     96K read/write/exec     [ anon ]
 FFFF800107DB3000   1200K read/write/exec     [ phys_map ]
 FFFF800107EDF000   8196K read/write/exec     [ anon ]
 FFFF8001086E0000   8192K read/write/exec     [ ubc_pager ]
 FFFF800108EE0000     68K read/write/exec     [ anon ]
 FFFF800108EF1000   2816K read/write/exec     [ uvm_aobj ]
  total          4343492K

The "big" entry in the second line thats the heap controlled by vmem.

no failed allocations any more due to allocation while map locked etc

$ vmstat -mv

vmstat: Kmem statistics are not being gathered by the kernel.
Memory resource pool statistics
Name        Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg
Maxpg Idle
aio_jobs_pool 128       0    0        0     0     0     0     0     0
inf    0
aio_lio_pool  40        0    0        0     0     0     0     0     0
inf    0
amappl        80     2636    0        0    53     0    53    53     0
inf    0
anonpl        32   274412    0        0  2178     0  2178  2178     0
inf    0
ataspl        96   692473    0   692473     1     0     1     1     0
inf    1
biopl        280     4023    0        0   288     0   288   288     0
inf    0
brtpl         56        0    0        0     0     0     0     0     0
inf    0
buf16k      16384   28091    0     4746  5990   153  5837  5837     1
  1    0
buf1k       1024        0    0        0     1     0     1     1     1
  1    1
buf2k       2048   179497    0     5924  5434     9  5425  5425     1
  1    0
buf32k      32768       0    0        0     1     0     1     1     1
  1    1
buf4k       4096     2745    0     1274   102     8    94    94     1
  1    0
buf512b      512        0    0        0     1     0     1     1     1
  1    1
buf64k      65536       0    0        0     1     0     1     1     1
  1    1
buf8k       8192     1504    0      726   129    29   100   100     1
  1    0
bufpl        280   199167    0        0 14227     0 14227 14227     0
inf    0
cryptkop     352        0    0        0     0     0     0     0     0
inf    0
cryptodesc    72        0    0        0     0     0     0     0     0
inf    0
cryptop      272        0    0        0     0     0     0     0     0
inf    0
csepl        208        0    0        0    17     0    17    17    17
inf   17
cwdi          64      173    0        0     3     0     3     3     0
inf    0
execargs    262144 710463    0   710463     4     0     4     4     0
 16    4
extent        40        0    0        0     0     0     0     0     0
inf    0
fcrpl        168        0    0        0     3     0     3     3     3
inf    3
fdfile        64     2549    0        0    41     0    41    41     0
inf    0
ffsdino1     128   419052    0        0 13518     0 13518 13518     0
inf    0
ffsdino2     256        0    0        0     0     0     0     0     0
inf    0
ffsino       256   419056    0        0 26191     0 26191 26191     0
inf    0
file         128      281    0        0    10     0    10    10     0
inf    0
filedesc     832      173    0        0    44     0    44    44     0
inf    0
fstrans       32      154    0        0     2     0     2     2     0
inf    0
igmppl        32        0    0        0     0     0     0     0     0
inf    0
in6pcbpl     232      155    0      144     1     0     1     1     0
inf    0
inmltpl       48        3    0        0     1     0     1     1     0
inf    0
inpcbpl      192      172    0      162     1     0     1     1     0
inf    0
ipfrenpl      64        0    0        0     0     0     0     0     0
inf    0
kcpuset       64        1    0        0     1     0     1     1     0
inf    0
kcredpl      192       70    0        0     4     0     4     4     0
inf    0
kmem-1024   1024     2370    0        0   593     0   593   593     0
inf    0
kmem-112     112      894    0        0    25     0    25    25     0
inf    0
kmem-128     128     1334    0        0    42     0    42    42     0
inf    0
kmem-16       16      988    0        0     4     0     4     4     0
inf    0
kmem-160     160      214    0        0     9     0     9     9     0
inf    0
kmem-192     192      191    0        0    10     0    10    10     0
inf    0
kmem-2048   2048     1225    0        0   613     0   613   613     0
inf    0
kmem-224     224       85    0        0     5     0     5     5     0
inf    0
kmem-24       24      232    0        0     2     0     2     2     0
inf    0
kmem-256     256      123    0        0     8     0     8     8     0
inf    0
kmem-32       32      486    0        0     4     0     4     4     0
inf    0
kmem-320     320      285    0        0    24     0    24    24     0
inf    0
kmem-384     384      328    0        0    33     0    33    33     0
inf    0
kmem-40       40     4810    0        0    48     0    48    48     0
inf    0
kmem-4096   4096       55    0        0    55     0    55    55     0
inf    0
kmem-448     448      127    0        0    15     0    15    15     0
inf    0
kmem-48       48     1021    0        0    13     0    13    13     0
inf    0
kmem-512     512       97    0        0    13     0    13    13     0
inf    0
kmem-56       56      306    0        0     5     0     5     5     0
inf    0
kmem-64       64     4264    0        0    67     0    67    67     0
inf    0
kmem-768     768      245    0        0    49     0    49    49     0
inf    0
kmem-8         8      790    0        0     2     0     2     2     0
inf    0
kmem-80       80     2021    0        0    40     0    40    40     0
inf    0
kmem-96       96      200    0        0     5     0     5     5     0
inf    0
ksiginfo      72       83    0        0     2     0     2     2     0
inf    0
ktrace       120        0    0        0     0     0     0     0     0
inf    0
kva-12288   12288     223    0        0    11     0    11    11     0
inf    0
kva-16384   16384      17    0        0     2     0     2     2     0
inf    0
kva-20480   20480      13    0        0     2     0     2     2     0
inf    0
kva-24576   24576       1    0        0     1     0     1     1     0
inf    0
kva-28672   28672       1    0        0     1     0     1     1     0
inf    0
kva-32768   32768       1    0        0     1     0     1     1     0
inf    0
kva-36864   36864       2    0        0     1     0     1     1     0
inf    0
kva-4096    4096   118955    0        0  1859     0  1859  1859     0
inf    0
kva-40960   40960       0    0        0     0     0     0     0     0
inf    0
kva-49152   49152       1    0        0     1     0     1     1     0
inf    0
kva-65536   65536   11462    0        0  2866     0  2866  2866     0
inf    0
kva-8192    8192      112    0        0     4     0     4     4     0
inf    0
lockf        112       12    0        0     1     0     1     1     0
inf    0
lwppl       1056      217    0        0    73     0    73    73     0
inf    0
mbpl         512      153    0        0    22     0    22    22     2
inf    2
mclpl       2048      149    0        0    79     0    79    79     4
65536    4
mqmsgpl     1024        0    0        0     0     0     0     0     0
inf    0
mutex         64   422019    0        0  6699     0  6699  6699     0
inf    0
ncache       192   419038    0        0 19955     0 19955 19955     0
inf    0
pcache       896       59    0        0    15     0    15    15     0
inf    0
pcachecpu     64      237    0        0     4     0     4     4     0
inf    0
pcglarge    1024     4852    0        0  1213     0  1213  1213     0
inf    0
pcgnormal    256     7359    0        0   460     0   460   460     0
inf    0
pdict128     184        0    0        0     0     0     0     0     0
inf    0
pdict16       72       24    0        8     1     0     1     1     0
inf    0
pdict32       88       10    0        2     1     0     1     1     0
inf    0
pdppl       4096      168    0        0   168     0   168   168     0
inf    0
pewpl         24        0    0        0     1     0     1     1     1
  1    1
phpool-0      56    41440    0      199   573     0   573   573     0
inf    0
phpool-1024  176        0    0        0     0     0     0     0     0
inf    0
phpool-128    64       70    0        0     2     0     2     2     0
inf    0
phpool-2048  304        0    0        0     0     0     0     0     0
inf    0
phpool-256    80        6    0        0     1     0     1     1     0
inf    0
phpool-4096  560        0    0        0     0     0     0     0     0
inf    0
phpool-512   112        2    0        0     1     0     1     1     0
inf    0
phpool-64     56     4970    0        0    70     0    70    70     0
inf    0
piperd       320      112    0        0    10     0    10    10     0
inf    0
pipewr       320      119    0        0    10     0    10    10     0
inf    0
plimitpl     216      123    0        0     7     0     7     7     0
inf    0
pmappl       392      168    0        0    17     0    17    17     0
inf    0
pnbufpl     1024       72    0        0    18     0    18    18     0
inf    0
procpl       656      161    0        0    27     0    27    27     0
inf    0
proparay      48        0    0        0     0     0     0     0     0
inf    0
propdata      40        0    0        0     0     0     0     0     0
inf    0
propdict      48      196    0       24     3     0     3     3     0
inf    0
propnmbr      56       26    0        7     1     0     1     1     0
inf    0
propstng      40      269    0       11     3     0     3     3     0
inf    0
pstatspl     448      161    0        0    18     0    18    18     0
inf    0
ptimerpl     264       11    0        5     1     0     1     1     0
inf    0
ptimerspl    280       11    0        5     1     0     1     1     0
inf    0
pvpl          40    38951    0        0   386     0   386   386     0
inf    0
ractx         32    68471    0        0   544     0   544   544     0
inf    0
rndsample    536    10808    0    10804     1     0     1     1     0
inf    0
rtentpl      272       27    0        0     2     0     2     2     0
inf    0
rttmrpl       64        0    0        0     0     0     0     0     0
inf    0
rwlock        64        0    0        0     0     0     0     0     0
inf    0
sackholepl    32        0    0        0     0     0     0     0     0
inf    0
sigacts     3088      173    0        0   173     0   173   173     0
inf    0
socket       584       41    0        0     6     0     6     6     0
inf    0
swp vnd      288        0    0        0     0     0     0     0     0
inf    0
swp vnx       32        0    0        0     0     0     0     0     0
inf    0
synpl        280        1    0        1     1     0     1     1     0
inf    1
tcpcbpl      792       17    0       12     2     0     2     2     0
inf    1
tcpipqepl     80        0    0        0     0     0     0     0     0
inf    0
tstilepl      96      217    0        0     6     0     6     6     0
inf    0
uaoeltpl      96        0    0        0     0     0     0     0     0
inf    0
uarea       12288     217    0        0   217     0   217   217     0
inf    0
ufsdir       264        4    0        0     1     0     1     1     0
inf    0
vmmpepl      136     5583    0        0   193     0   193   193     0
inf    0
vmsppl       368      168    0        0    16     0    16    16     0
inf    0
vnodepl      296   419079    0        0 32237     0 32237 32237     0
inf    0
wapblinopl    32   752908    0   752888     1     0     1     1     0
inf    0

In use 1206022K, total allocated 1224292K; utilization 98.5%


kind regards,
Lars


- -- 
- ------------------------------------

Mystische Erklärungen:
Die mystischen Erklärungen gelten für tief;
die Wahrheit ist, dass sie noch nicht einmal oberflächlich sind.

   -- Friedrich Nietzsche
   [ Die Fröhliche Wissenschaft Buch 3, 126 ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5IAxMACgkQcxuYqjT7GRZ9UwCeMazMDvYTns5LAq7K6TtiV5Ql
G6AAoMBtGvBfk4aniS8qrRt8EtYOjs1J
=moI/
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index