[PATCH 18/31] powerpc/mm: Increase the pte frag size.

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Mon Sep 28 14:55:06 AEST 2015


Benjamin Herrenschmidt <benh at kernel.crashing.org> writes:

> On Mon, 2015-09-21 at 17:23 +0530, Aneesh Kumar K.V wrote:
>> The page that contain pte entries. Or the last level of the linux page
>> table. or we could call them pte fragments. We need to allocate one
>> full page at lowest level, because we want to use split ptlock. Now
>> for keeping the pte_t entries, we will just be using 2K space. Rest of
>> the space can be reused. We did that in commit 
>> 5c1f6ee9a31cbdac90bbb8ae1ba4475031ac74b4 . Now all those pmd entries
>> that have pte page (pte fragments) coming from the same 64K page
>> will also end up sharing the same ptlock.
>
> Ok, I'm still a bit confused between what we do today vs. what we do
> after your patch, can you provide a clear description (maybe with
> ASCII art) of what is used, how, an how much is wasted overall when
> not using subpages ?
>




       pmd table             
     +------------+             
     |  pmd entry \              64k linux page
     +------------+\          +-----------------+
     |            | \        /|    pte fragment |
     |            |  \      / |                 |
     |            |   \    /  |    8K size      |
     |            |    \  /   |                 |
     +------------+     \/    +-----------------+
                        /\    |                 |
                       /  \   |                 |
                      /    \  |                 |
                     /      \ |                 |
       pmd table    /        \|                 |
    +--------------/          +-----------------+
    |  pmd entry   |          |                 |
    +--------------+          |    pte fragment |
    |              |          |    8k size      |
    |              |          +-----------------+
    |              |            
    |              |
    +--------------+


Actual size of pte fragment needed to map a 16MB range is 2K.
(2K size consist of 256 entries (2*1024/8 each entry is 8 bytes))
256 * 64K  = 16MB

Now since we also need to track details of 4K subpages, we used to
use pte frag of size 4K. The second half 2K is used to track subpages.
For each 64K we need to track 16 subpages. We took 8 bytes per
each 64K. So we are able to track details of subpages for 16MB range
in 2K size.  That brings us to total pte frag size needed to map 16MB
to be 2K to track pte_t and 2K to track subpages = 4K.


Now what we are changing here is to update that to 8K. The 6K space in
the pte fragment (outside the 2K needed to track pte_t) is used to track
subpages here. The additional space enable us to use 8bits per subpage.

Total subpages in a 16MB range = 4096.
1 byte per subpage now. Hence we take 4K space for tracking subpages. 
Total space taken by pte_t and subpage tracking 2K + 4K = 6k. Inorder to
align it we increase that to 8K


-aneesh



More information about the Linuxppc-dev mailing list