tech-kern archive

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

Re: making kmem more efficient



On 03/01/2012 06:04 PM, Eduardo Horvath wrote:
> On Thu, 1 Mar 2012, Lars Heidieker wrote:
> 
>> Hi,
>> 
>> this splits the lookup table into two parts, for smaller 
>> allocations and larger ones this has the following advantages:
>> 
>> - smaller lookup tables (less cache line pollution) - makes large 
>> kmem caches possible currently up to min(16384, 4*PAGE_SIZE) - 
>> smaller caches allocate from larger pool-pages if that reduces the 
>> wastage
>> 
>> any objections?
> 
> Why would you want to go larger than PAGE_SIZE?  At that point 
> wouldn't you just want to allocate individual pages and map them
> into the VM space?
> 
> Eduardo
> 

Allocations larger then PAGE_SIZE are infrequent (at the moment) that's
true.
Supporting larger pool-pages makes some caches more efficient eg 320/384
and some size possible like a byte 3072.

Having these allocators in place the larger then PAGE_SIZE caches are a
trivial extension.
All caches multiplies of PAGE_SIZE come for free they don't introduce
any additional memory overhead in terms of footprint, on memory pressure
they can always be freed from the cache and with having them in place
you save the TLB shoot-downs because of mapping and un-mapping them and
the allocation deallocation of the page frames.
So they are more then a magnitude faster.

(eg with DEBUG enabled we have slightly larger then PAGE_SIZE
allocations for readdir and the effect can be easily observed, not that
making DEBUG faster is the reason but thinking of different
blocksizes... requirements...)


Lars


Just some stats of a system (not up long) with those changes:
collected with "vmstat -mvWC"

> kmem-1024         1024        5789    0        5158    631    73    584    
> 408   176   4096   584     0   inf    3 0x800  89.6%
> kmem-112           112        1755    0         847    908    28     27      
> 1    26   4096    26     0   inf    0 0x800  95.5%
> kmem-12288       12288          70    0           0     70     0     70      
> 0    70  12288    70     0   inf    0 0x800 100.0%
> kmem-128           128        3411    0        2625    786   590     47      
> 4    43   4096    47     0   inf    0 0x800  57.1%
> kmem-16             16        2884    0        1745   1139   141      5      
> 0     5   4096     5     0   inf    0 0xc00  89.0%
> kmem-160           160         878    0         590    288    37     17      
> 4    13   4096    14     0   inf    1 0x800  86.5%
> kmem-16384       16384          19    0          11      8     0     19     
> 11     8  16384    18     0   inf    0 0x800 100.0%
> kmem-192           192         579    0         461    118     8      9      
> 3     6   4096     8     0   inf    0 0x800  92.2%
> kmem-2048         2048        2910    0        2572    338    38    618    
> 430   188   4096   596     0   inf   19 0x800  89.9%
> kmem-224           224         499    0         447     52    20      9      
> 5     4   4096     5     0   inf    1 0x800  71.1%
> kmem-24             24         907    0         697    210   130      2      
> 0     2   4096     2     0   inf    0 0xc00  61.5%
> kmem-256           256         385    0         351     34    14      9      
> 6     3   4096     6     0   inf    0 0x800  70.8%
> kmem-3072         3072          71    0          42     29     3     10      
> 2     8  12288     8     0   inf    0 0x800  90.6%
> kmem-32             32        1724    0        1194    530   110      5      
> 0     5   4096     5     0   inf    0 0xc00  82.8%
> kmem-320           320         928    0         456    472    38     11      
> 1    10  16384    11     0   inf    0 0x800  92.2%
> kmem-384           384         683    0         412    271    49     11      
> 1    10  12288    11     0   inf    0 0x800  84.7%
> kmem-40             40        5759    0        5342    417   297     47     
> 40     7   4096    47     0   inf    0 0xc00  58.2%
> kmem-4096         4096         147    0         115     32     0     52     
> 20    32   4096    45     0   inf    0 0x800 100.0%
> kmem-448           448        1028    0         902    126     9     24      
> 9    15   4096    18     0   inf    0 0x800  91.9%
> kmem-48             48        1634    0         688    946    74     12      
> 0    12   4096    12     0   inf    0 0xc00  92.4%
> kmem-512           512         386    0         359     27     5     12      
> 8     4   4096    10     0   inf    0 0x800  84.4%
> kmem-56             56        1324    0         963    361     4      5      
> 0     5   4096     5     0   inf    0 0xc00  98.7%
> kmem-6144         6144          11    0           0     11     1      6      
> 0     6  12288     6     0   inf    0 0x800  91.7%
> kmem-64             64        5157    0        4180    977  1263     38      
> 3    35   4096    38     0   inf    0 0x800  43.6%
> kmem-768           768         967    0         758    209    15     17      
> 3    14  12288    17     0   inf    0 0x800  93.3%
> kmem-8               8        2513    0        1563    950    74      2      
> 0     2   4096     2     0   inf    0 0xc00  92.8%
> kmem-80             80        2815    0         778   2037    54     41      
> 0    41   4096    41     0   inf    0 0x800  97.0%
> kmem-8192         8192          20    0           2     18     0     20      
> 2    18   8192    20     0   inf    0 0x800 100.0%
> kmem-96             96         783    0         637    146    22      6      
> 2     4   4096     5     0   inf    0 0x800  85.5%

> kmem-1024        6    15   40   19     12893     113401  88.6     9123109  
> 98.8
> kmem-112         0    15    1    3      3226       6484  50.2     2258274  
> 99.7
> kmem-12288       0    15    0    0        70         71   1.4          73   
> 2.7
> kmem-128         9    15   19   11      6897      62704  89.0     9250426  
> 99.3
> kmem-16          1    15    9    9      4947      99336  95.0    13399469  
> 99.3
> kmem-160         0    15    0    0      1696       1940  12.6      697378  
> 99.7
> kmem-16384       0    15    0    0        22         28  21.4          86  
> 67.4
> kmem-192         0    15    0    0      1352       1607  15.9      406650  
> 99.6
> kmem-2048        0    15   19    8      6699      30953  78.4     6750583  
> 99.5
> kmem-224         0    15    0    0      1171       1352  13.4      443516  
> 99.7
> kmem-24          0    15    0    1      1902       2485  23.5   142216029 
> 100.0
> kmem-256         0    15    0    0       995       1207  17.6      257438  
> 99.5
> kmem-3072        0    15    0    0       161        294  45.2     1214640 
> 100.0
> kmem-32          0    15    5    3      3421      20762  83.5     9513788  
> 99.8
> kmem-320         0    15    0    0      1637       1840  11.0     1970526  
> 99.9
> kmem-384         0    15    0    0      1337       1510  11.5      328267  
> 99.5
> kmem-40          0    15    3    3      7259      16131  55.0     5541615  
> 99.7
> kmem-4096        0    15    0    0       537        677  20.7     5069163 
> 100.0
> kmem-448         0    15    0    0      1824       5814  68.6     4358314  
> 99.9
> kmem-48          0    15    1    1      2739       3433  20.2      676504  
> 99.5
> kmem-512         0    15    0    0       917       1069  14.2      226999  
> 99.5
> kmem-56          0    15    3    4      2812      13259  78.8     3474597  
> 99.6
> kmem-6144        0    15    0    0        11         12   8.3          16  
> 25.0
> kmem-64          5    15   37   27     11557     280160  95.9    17047179  
> 98.4
> kmem-768         1    15    1    1      2392       4449  46.2     1178202  
> 99.6
> kmem-8           5    15    7   10      4574     136836  96.7    52790434  
> 99.7
> kmem-80          0    15    1    2      4179       6389  34.6     2603182  
> 99.8
> kmem-8192        0    15    0    0        20         22   9.1          32  
> 31.2
> kmem-96          0    15    0    1      1755       2353  25.4      613776  
> 99.6



Home | Main Index | Thread Index | Old Index