mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
memcg: fix memory migration of shmem swapcache
In the current implementation mem_cgroup_end_migration() decides whether the page migration has succeeded or not by checking "oldpage->mapping". But if we are tring to migrate a shmem swapcache, the page->mapping of it is NULL from the begining, so the check would be invalid. As a result, mem_cgroup_end_migration() assumes the migration has succeeded even if it's not, so "newpage" would be freed while it's not uncharged. This patch fixes it by passing mem_cgroup_end_migration() the result of the page migration. Signed-off-by: Daisuke Nishimura <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Acked-by: KAMEZAWA Hiroyuki <[email protected]> Acked-by: Balbir Singh <[email protected]> Cc: Minchan Kim <[email protected]> Reviewed-by: Johannes Weiner <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
17295c88a1
commit
50de1dd967
3 changed files with 5 additions and 7 deletions
|
|
@ -768,7 +768,7 @@ skip_unmap:
|
|||
|
||||
uncharge:
|
||||
if (!charge)
|
||||
mem_cgroup_end_migration(mem, page, newpage);
|
||||
mem_cgroup_end_migration(mem, page, newpage, rc == 0);
|
||||
unlock:
|
||||
unlock_page(page);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue