lkml.org 
[lkml]   [2015]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/4] mm, procfs: account for shmem swap in /proc/pid/smaps
From
On Wed, Mar 11, 2015 at 10:10 PM, Vlastimil Babka <vbabka@suse.cz> wrote:
> On 03/11/2015 01:30 PM, Konstantin Khlebnikov wrote:
>>
>> On Thu, Feb 26, 2015 at 4:51 PM, Vlastimil Babka <vbabka@suse.cz> wrote:
>>>
>>> Currently, /proc/pid/smaps will always show "Swap: 0 kB" for shmem-backed
>>> mappings, even if the mapped portion does contain pages that were swapped
>>> out.
>>> This is because unlike private anonymous mappings, shmem does not change
>>> pte
>>> to swap entry, but pte_none when swapping the page out. In the smaps page
>>> walk, such page thus looks like it was never faulted in.
>>
>>
>> Maybe just add count of swap entries allocated by mapped shmem into
>> swap usage of this vma? That's isn't exactly correct for partially
>> mapped shmem but this is something weird anyway.
>
>
> Yeah for next version I want to add a patch optimizing for the (hopefully)
> common cases:
>
> 1. SHMEM_I(inode)->swapped is 0 - no need to consult radix tree
> 2. shmem inode is mapped fully (I hope it's ok to just compare its size and
> mapping size) - just use the value of SHMEM_I(inode)->swapped like you
> suggest
>

BTW using radix tree iterator you can count swap entries without
touching page->count.

Also long time ago I've suggested to mark swap entries in shmem with
one of radix tree tag -- tagged iterator is much faster for sparse trees.
(just for this case it's overkill but these tags can speedup swapoff)


\
 
 \ /
  Last update: 2015-03-11 21:21    [W:0.178 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site