From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751414AbcEMHcT (ORCPT ); Fri, 13 May 2016 03:32:19 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:17255 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbcEMHcS (ORCPT ); Fri, 13 May 2016 03:32:18 -0400 Message-ID: <573582DE.3030302@huawei.com> Date: Fri, 13 May 2016 15:31:42 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Aaron Lu CC: Linux MM , LKML Subject: Re: why the count nr_file_pages is not equal to nr_inactive_file + nr_active_file ? References: <573550D8.9030507@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.573582F5.0096,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f22053b268ace2ff5ae7f9a1b5c3a421 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/5/13 15:00, Aaron Lu wrote: > On 05/13/2016 11:58 AM, Xishi Qiu wrote: >> I find the count nr_file_pages is not equal to nr_inactive_file + nr_active_file. >> There are 8 cpus, 2 zones in my system. >> >> I think may be the pagevec trigger the problem, but PAGEVEC_SIZE is only 14. >> Does anyone know the reason? > > One thing I can see is the ram backed filesystem where the page is > counted as NR_FILE_PAGE but go into the anonymous LRU list instead of > the file LRU list. > > See function shmem_getpage_gfp. > > An example: > [aaron@aaronlu ~]$ head -11 /proc/vmstat > nr_free_pages 194472 > nr_alloc_batch 58 > nr_inactive_anon 483386 > nr_active_anon 298161 > nr_inactive_file 452791 > nr_active_file 1942376 > nr_unevictable 84 > nr_mlock 84 > nr_anon_pages 445332 > nr_mapped 93553 > nr_file_pages 2731481 > [aaron@aaronlu ~]$ fallocate -l 400M /dev/shm/test > [aaron@aaronlu ~]$ head -11 /proc/vmstat > nr_free_pages 94808 > nr_alloc_batch 838 > nr_inactive_anon 582385 > nr_active_anon 298371 > nr_inactive_file 452795 > nr_active_file 1942380 > nr_unevictable 84 > nr_mlock 84 > nr_anon_pages 445543 > nr_mapped 93658 > nr_file_pages 2830488 > > The nr_file_pages increased with nr_inactive_anon while the > nr_{in}active_file don't see much change. > > Regards, > Aaron > Hi Aaron, Thanks for your reply, but I find the count of nr_shmem is very small in my system. root@hi3650:/ # cat /proc/vmstat nr_free_pages 54192 nr_inactive_anon 39830 nr_active_anon 28794 nr_inactive_file 432444 nr_active_file 20659 nr_unevictable 2363 nr_mlock 0 nr_anon_pages 65249 nr_mapped 19742 nr_file_pages 462723 nr_dirty 20 nr_writeback 0 nr_slab_reclaimable 259333 nr_slab_unreclaimable 33463 nr_page_table_pages 3456 nr_kernel_stack 892 nr_unstable 0 nr_bounce 11 nr_vmscan_write 292032 nr_vmscan_immediate_reclaim 47204474 nr_writeback_temp 0 nr_isolated_anon 0 nr_isolated_file 0 nr_shmem 128 nr_dirtied 69574 nr_written 356299 nr_anon_transparent_hugepages 0 nr_free_cma 7519 nr_swapcache 41972 nr_dirty_threshold 6982 nr_dirty_background_threshold 99297