From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <5500932F.6030107@suse.cz> Date: Wed, 11 Mar 2015 20:10:39 +0100 From: Vlastimil Babka MIME-Version: 1.0 Subject: Re: [PATCH 2/4] mm, procfs: account for shmem swap in /proc/pid/smaps References: <1424958666-18241-1-git-send-email-vbabka@suse.cz> <1424958666-18241-3-git-send-email-vbabka@suse.cz> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-Archive: List-Post: To: Konstantin Khlebnikov Cc: "linux-mm@kvack.org" , Jerome Marchand , Linux Kernel Mailing List , Andrew Morton , linux-doc@vger.kernel.org, Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Cyrill Gorcunov , Randy Dunlap , linux-s390@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Peter Zijlstra , Paul Mackerras , Arnaldo Carvalho de Melo , Oleg Nesterov List-ID: On 03/11/2015 01:30 PM, Konstantin Khlebnikov wrote: > On Thu, Feb 26, 2015 at 4:51 PM, Vlastimil Babka 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbbCKTKt (ORCPT ); Wed, 11 Mar 2015 15:10:49 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50159 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752703AbbCKTKq (ORCPT ); Wed, 11 Mar 2015 15:10:46 -0400 Message-ID: <5500932F.6030107@suse.cz> Date: Wed, 11 Mar 2015 20:10:39 +0100 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Konstantin Khlebnikov CC: "linux-mm@kvack.org" , Jerome Marchand , Linux Kernel Mailing List , Andrew Morton , linux-doc@vger.kernel.org, Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Cyrill Gorcunov , Randy Dunlap , linux-s390@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , Peter Zijlstra , Paul Mackerras , Arnaldo Carvalho de Melo , Oleg Nesterov Subject: Re: [PATCH 2/4] mm, procfs: account for shmem swap in /proc/pid/smaps References: <1424958666-18241-1-git-send-email-vbabka@suse.cz> <1424958666-18241-3-git-send-email-vbabka@suse.cz> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/11/2015 01:30 PM, Konstantin Khlebnikov wrote: > On Thu, Feb 26, 2015 at 4:51 PM, Vlastimil Babka 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