Commit 62ba7442 authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

mm: memcg: remove unneeded shmem charge type

shmem page charges have not needed a separate charge type to tell them
from regular file pages since 08e552c6 ("memcg: synchronized LRU").
Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Wanpeng Li <liwp.linux@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 827a03d2
...@@ -379,7 +379,6 @@ static bool move_file(void) ...@@ -379,7 +379,6 @@ static bool move_file(void)
enum charge_type { enum charge_type {
MEM_CGROUP_CHARGE_TYPE_CACHE = 0, MEM_CGROUP_CHARGE_TYPE_CACHE = 0,
MEM_CGROUP_CHARGE_TYPE_ANON, MEM_CGROUP_CHARGE_TYPE_ANON,
MEM_CGROUP_CHARGE_TYPE_SHMEM, /* used by page migration of shmem */
MEM_CGROUP_CHARGE_TYPE_SWAPOUT, /* for accounting swapcache */ MEM_CGROUP_CHARGE_TYPE_SWAPOUT, /* for accounting swapcache */
MEM_CGROUP_CHARGE_TYPE_DROP, /* a page was unused swap cache */ MEM_CGROUP_CHARGE_TYPE_DROP, /* a page was unused swap cache */
NR_CHARGE_TYPE, NR_CHARGE_TYPE,
...@@ -2902,8 +2901,6 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, ...@@ -2902,8 +2901,6 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
if (unlikely(!mm)) if (unlikely(!mm))
mm = &init_mm; mm = &init_mm;
if (!page_is_file_cache(page))
type = MEM_CGROUP_CHARGE_TYPE_SHMEM;
if (!PageSwapCache(page)) if (!PageSwapCache(page))
ret = mem_cgroup_charge_common(page, mm, gfp_mask, type); ret = mem_cgroup_charge_common(page, mm, gfp_mask, type);
...@@ -3310,10 +3307,8 @@ void mem_cgroup_prepare_migration(struct page *page, struct page *newpage, ...@@ -3310,10 +3307,8 @@ void mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
*/ */
if (PageAnon(page)) if (PageAnon(page))
ctype = MEM_CGROUP_CHARGE_TYPE_ANON; ctype = MEM_CGROUP_CHARGE_TYPE_ANON;
else if (page_is_file_cache(page))
ctype = MEM_CGROUP_CHARGE_TYPE_CACHE;
else else
ctype = MEM_CGROUP_CHARGE_TYPE_SHMEM; ctype = MEM_CGROUP_CHARGE_TYPE_CACHE;
/* /*
* The page is committed to the memcg, but it's not actually * The page is committed to the memcg, but it's not actually
* charged to the res_counter since we plan on replacing the * charged to the res_counter since we plan on replacing the
...@@ -3407,10 +3402,6 @@ void mem_cgroup_replace_page_cache(struct page *oldpage, ...@@ -3407,10 +3402,6 @@ void mem_cgroup_replace_page_cache(struct page *oldpage,
*/ */
if (!memcg) if (!memcg)
return; return;
if (PageSwapBacked(oldpage))
type = MEM_CGROUP_CHARGE_TYPE_SHMEM;
/* /*
* Even if newpage->mapping was NULL before starting replacement, * Even if newpage->mapping was NULL before starting replacement,
* the newpage may be on LRU(or pagevec for LRU) already. We lock * the newpage may be on LRU(or pagevec for LRU) already. We lock
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment