projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mem-hotplug: alloc new page from a nearest neighbor node when mem-offline
[deliverable/linux.git]
/
mm
/
util.c
diff --git
a/mm/util.c
b/mm/util.c
index 917e0e3d0f8ee3a05edf78a665eace20635b3aa0..662cddf914af2048ab6c9c674f59d37a7aceba69 100644
(file)
--- a/
mm/util.c
+++ b/
mm/util.c
@@
-399,10
+399,12
@@
struct address_space *page_mapping(struct page *page)
}
mapping = page->mapping;
}
mapping = page->mapping;
- if ((unsigned long)mapping & PAGE_MAPPING_
FLAGS
)
+ if ((unsigned long)mapping & PAGE_MAPPING_
ANON
)
return NULL;
return NULL;
- return mapping;
+
+ return (void *)((unsigned long)mapping & ~PAGE_MAPPING_FLAGS);
}
}
+EXPORT_SYMBOL(page_mapping);
/* Slow path of page_mapcount() for compound pages */
int __page_mapcount(struct page *page)
/* Slow path of page_mapcount() for compound pages */
int __page_mapcount(struct page *page)
@@
-410,6
+412,12
@@
int __page_mapcount(struct page *page)
int ret;
ret = atomic_read(&page->_mapcount) + 1;
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))
page = compound_head(page);
ret += atomic_read(compound_mapcount_ptr(page)) + 1;
if (PageDoubleMap(page))
@@
-520,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);
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
/*
* shmem pages shouldn't be counted as free in this
@@
-528,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.
*/
* 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();
free += get_nr_swap_pages();
This page took
0.033772 seconds
and
5
git commands to generate.