[PATCH -mm 10/13] memcg, THP, swap: Avoid to duplicated charge THP in swap cache
From: Huang, Ying
Date: Thu May 25 2017 - 02:47:59 EST
- Next message: Huang, Ying: "[PATCH -mm 12/13] mm, THP, swap: Delay splitting THP after swapped out"
- Previous message: Huang, Ying: "[PATCH -mm 08/13] mm, THP, swap: Support to split THP for THP swapped out"
- In reply to: Huang, Ying: "[PATCH -mm 08/13] mm, THP, swap: Support to split THP for THP swapped out"
- Next in thread: Huang, Ying: "[PATCH -mm 12/13] mm, THP, swap: Delay splitting THP after swapped out"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: Huang Ying <ying.huang@xxxxxxxxx>
For a THP (Transparent Huge Page), tail_page->mem_cgroup is NULL. So
to check whether the page is charged already, we need to check the
head page. This is not an issue before because it is impossible for a
THP to be in the swap cache before. But after we add delaying
splitting THP after swapped out support, it is possible now.
Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Cc: "Kirill A . Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1f36bb61a6de..7de1fa07f77d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5372,7 +5372,7 @@ int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
* in turn serializes uncharging.
*/
VM_BUG_ON_PAGE(!PageLocked(page), page);
- if (page->mem_cgroup)
+ if (compound_head(page)->mem_cgroup)
goto out;
if (do_swap_account) {
--
2.11.0
- Next message: Huang, Ying: "[PATCH -mm 12/13] mm, THP, swap: Delay splitting THP after swapped out"
- Previous message: Huang, Ying: "[PATCH -mm 08/13] mm, THP, swap: Support to split THP for THP swapped out"
- In reply to: Huang, Ying: "[PATCH -mm 08/13] mm, THP, swap: Support to split THP for THP swapped out"
- Next in thread: Huang, Ying: "[PATCH -mm 12/13] mm, THP, swap: Delay splitting THP after swapped out"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]