Re: [PATCH 2/2] proc: report page->index instead of pfn for non-linearmappings in /proc/pid/pagemap

From: Pavel Emelyanov
Date: Fri Apr 27 2012 - 09:37:21 EST


On 04/27/2012 04:39 PM, Konstantin Khlebnikov wrote:
> Currently there is no way to find out current layout of non-linear mapping.
> Also there is no way to distinguish ordinary file mapping from non-linear mapping.
>
> Now in pagemap non-linear pte can be recognized as present swapped file-backed,
> or as non-present non-swapped file-backed for non-present non-linear file-pte:
>
> present swapped file data description
> 0 0 0 null non-present
> 0 0 1 page-index non-linear file-pte
> 0 1 0 swap-entry anon-page in swap, migration or hwpoison
> 0 1 1 swap-entry file-page in migration or hwpoison
> 1 0 0 page-pfn present private-anon or special page
> 1 0 1 page-pfn present file or shared-anon page
> 1 1 0 none impossible combination
> 1 1 1 page-index non-linear file-page
>
> [ the last unused combination 1-1-0 can be used for special pages, if anyone want this ]

This means that

a) Any application doing if (pme & PAGE_IS_XXX) checks will get ... broken
b) In order to determine that a mapping is non-linear we'll have to scan it
ALL and check. Currently in CRIU we just don't read the pagemap for shared
file maps but will have to. This is not very optimal. I'd prefer having
this linear/nonlinear info in /proc/pid/smaps or smth like this.

> Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
> Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Hugh Dickins <hughd@xxxxxxxxxx>
> Cc: Rik van Riel <riel@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/