mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
mm: memcontrol: track move_lock state internally
The complexity of memcg page stat synchronization is currently leaking into the callsites, forcing them to keep track of the move_lock state and the IRQ flags. Simplify the API by tracking it in the memcg. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.cz> Reviewed-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
93aa7d9524
commit
6de226191d
4 changed files with 51 additions and 53 deletions
12
mm/rmap.c
12
mm/rmap.c
|
@ -1085,24 +1085,20 @@ void page_add_new_anon_rmap(struct page *page,
|
|||
void page_add_file_rmap(struct page *page)
|
||||
{
|
||||
struct mem_cgroup *memcg;
|
||||
unsigned long flags;
|
||||
bool locked;
|
||||
|
||||
memcg = mem_cgroup_begin_page_stat(page, &locked, &flags);
|
||||
memcg = mem_cgroup_begin_page_stat(page);
|
||||
if (atomic_inc_and_test(&page->_mapcount)) {
|
||||
__inc_zone_page_state(page, NR_FILE_MAPPED);
|
||||
mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED);
|
||||
}
|
||||
mem_cgroup_end_page_stat(memcg, &locked, &flags);
|
||||
mem_cgroup_end_page_stat(memcg);
|
||||
}
|
||||
|
||||
static void page_remove_file_rmap(struct page *page)
|
||||
{
|
||||
struct mem_cgroup *memcg;
|
||||
unsigned long flags;
|
||||
bool locked;
|
||||
|
||||
memcg = mem_cgroup_begin_page_stat(page, &locked, &flags);
|
||||
memcg = mem_cgroup_begin_page_stat(page);
|
||||
|
||||
/* page still mapped by someone else? */
|
||||
if (!atomic_add_negative(-1, &page->_mapcount))
|
||||
|
@ -1123,7 +1119,7 @@ static void page_remove_file_rmap(struct page *page)
|
|||
if (unlikely(PageMlocked(page)))
|
||||
clear_page_mlock(page);
|
||||
out:
|
||||
mem_cgroup_end_page_stat(memcg, &locked, &flags);
|
||||
mem_cgroup_end_page_stat(memcg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue