X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=mm%2Futil.c;h=662cddf914af2048ab6c9c674f59d37a7aceba69;hb=394e31d2ceb4b9eae25bd9ed8ea8cb19a40ff181;hp=b756ee36f7f00d05b8bbe96962dc27f3063407e8;hpb=bda807d4445414e8e77da704f116bb0880fe0c76;p=deliverable%2Flinux.git diff --git a/mm/util.c b/mm/util.c index b756ee36f7f0..662cddf914af 100644 --- a/mm/util.c +++ b/mm/util.c @@ -412,6 +412,12 @@ int __page_mapcount(struct page *page) int ret; ret = atomic_read(&page->_mapcount) + 1; + /* + * For file THP page->_mapcount contains total number of mapping + * of the page: no need to look into compound_mapcount. + */ + if (!PageAnon(page) && !PageHuge(page)) + return ret; page = compound_head(page); ret += atomic_read(compound_mapcount_ptr(page)) + 1; if (PageDoubleMap(page)) @@ -522,7 +528,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) { free = global_page_state(NR_FREE_PAGES); - free += global_page_state(NR_FILE_PAGES); + free += global_node_page_state(NR_FILE_PAGES); /* * shmem pages shouldn't be counted as free in this @@ -530,7 +536,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) * that won't affect the overall amount of available * memory in the system. */ - free -= global_page_state(NR_SHMEM); + free -= global_node_page_state(NR_SHMEM); free += get_nr_swap_pages();