[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55005EBA.8080201@redhat.com>
Date: Wed, 11 Mar 2015 16:26:50 +0100
From: Jerome Marchand <jmarchan@...hat.com>
To: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
Konstantin Khlebnikov <koct9i@...il.com>,
Vlastimil Babka <vbabka@...e.cz>
CC: "linux-mm@...ck.org" <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-doc@...r.kernel.org, Hugh Dickins <hughd@...gle.com>,
Michal Hocko <mhocko@...e.cz>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Randy Dunlap <rdunlap@...radead.org>,
linux-s390@...r.kernel.org,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Paul Mackerras <paulus@...ba.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH 2/4] mm, procfs: account for shmem swap in /proc/pid/smaps
On 03/11/2015 04:03 PM, Konstantin Khlebnikov wrote:
> On 11.03.2015 15:30, Konstantin Khlebnikov wrote:
>> On Thu, Feb 26, 2015 at 4:51 PM, Vlastimil Babka <vbabka@...e.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.
>
> Something like that (see patch in attachment)
>
-8<---
diff --git a/mm/shmem.c b/mm/shmem.c
index cf2d0ca010bc..492f78f51fc2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1363,6 +1363,13 @@ static struct mempolicy *shmem_get_policy(struct
vm_area_struct *vma,
}
#endif
+static unsigned long shmem_get_swap_usage(struct vm_area_struct *vma)
+{
+ struct inode *inode = file_inode(vma->vm_file);
+
+ return SHMEM_I(inode)->swapped;
+}
+
int shmem_lock(struct file *file, int lock, struct user_struct *user)
{
struct inode *inode = file_inode(file);
-8<---
That will not work for shared anonymous mapping since they all share the
same vm_file (/dev/zero).
Jerome
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists