lkml.org 
[lkml]   [2009]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/4] Properly account for the number of page cache pages zone_reclaim() can reclaim
Date

> We are not talking about NR_TMPFS_PAGES, but NR_TMPFS_MAPPED :)
>
> We only need to account it in page_add_file_rmap() and page_remove_rmap(),
> I don't think they are too hot paths. And the relative cost is low enough.
>
> It will look like this.
>
> ---
> include/linux/mmzone.h | 1 +
> mm/rmap.c | 4 ++++
> 2 files changed, 5 insertions(+)
>
> --- linux.orig/include/linux/mmzone.h
> +++ linux/include/linux/mmzone.h
> @@ -99,6 +99,7 @@ enum zone_stat_item {
> NR_VMSCAN_WRITE,
> /* Second 128 byte cacheline */
> NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
> + NR_TMPFS_MAPPED,
> #ifdef CONFIG_NUMA
> NUMA_HIT, /* allocated in intended node */
> NUMA_MISS, /* allocated in non intended node */
> --- linux.orig/mm/rmap.c
> +++ linux/mm/rmap.c
> @@ -844,6 +844,8 @@ void page_add_file_rmap(struct page *pag
> {
> if (atomic_inc_and_test(&page->_mapcount)) {
> __inc_zone_page_state(page, NR_FILE_MAPPED);
> + if (PageSwapBacked(page))
> + __inc_zone_page_state(page, NR_TMPFS_MAPPED);
> mem_cgroup_update_mapped_file_stat(page, 1);
> }
> }
> @@ -894,6 +896,8 @@ void page_remove_rmap(struct page *page)
> mem_cgroup_uncharge_page(page);
> __dec_zone_page_state(page,
> PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED);
> + if (!PageAnon(page) && PageSwapBacked(page))
> + __dec_zone_page_state(page, NR_TMPFS_MAPPED);
> mem_cgroup_update_mapped_file_stat(page, -1);
> /*
> * It would be tidy to reset the PageAnon mapping here,

I think this patch looks good. thanks :)

but I have one request.
Could you please rename NR_FILE_MAPPED to NR_SWAP_BACKED_FILE_MAPPED?

I mean, mm/shmem isn't only used for tmpfs, but also be used ipc/shm and
/dev/zero.
NR_TMPFS_MAPPED seems a bit misleading.





\
 
 \ /
  Last update: 2009-06-11 05:29    [from the cache]
©2003-2011 Jasper Spaans