From: "Huang, Ying" <ying.huang@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-nvdimm@lists.01.org, Huang Ying <ying.huang@intel.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Minchan Kim <minchan@kernel.org>,
Michal Hocko <mhocko@kernel.org>,
Andrea Arcangeli <aarcange@redhat.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH -mm -v2 09/12] memcg, THP, swap: Avoid to duplicated charge THP in swap cache
Date: Fri, 23 Jun 2017 15:13:00 +0800 [thread overview]
Message-ID: <20170623071303.13469-10-ying.huang@intel.com> (raw)
In-Reply-To: <20170623071303.13469-1-ying.huang@intel.com>
From: Huang Ying <ying.huang@intel.com>
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@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 99e96ae59cd3..123564bcdd77 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5407,7 +5407,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 prev parent reply other threads:[~2017-06-23 7:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 7:12 [PATCH -mm -v2 00/12] mm, THP, swap: Delay splitting THP after swapped out Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 01/12] mm, THP, swap: Support to clear swap cache flag for THP " Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 02/12] mm, THP, swap: Support to reclaim swap space " Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 03/12] mm, THP, swap: Make reuse_swap_page() works " Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 04/12] mm, THP, swap: Don't allocate huge cluster for file backed swap device Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 05/12] block, THP: Make block_device_operations.rw_page support THP Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 06/12] Test code to write THP to swap device as a whole Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 07/12] mm, THP, swap: Support to split THP for THP swapped out Huang, Ying
2017-06-23 7:12 ` [PATCH -mm -v2 08/12] memcg, THP, swap: Support move mem cgroup charge " Huang, Ying
2017-06-23 7:13 ` Huang, Ying [this message]
2017-06-23 7:13 ` [PATCH -mm -v2 10/12] memcg, THP, swap: Make mem_cgroup_swapout() support THP Huang, Ying
2017-06-23 7:13 ` [PATCH -mm -v2 11/12] mm, THP, swap: Delay splitting THP after swapped out Huang, Ying
2017-06-23 7:13 ` [PATCH -mm -v2 12/12] mm, THP, swap: Add THP swapping out fallback counting Huang, Ying
2017-07-21 23:21 ` [PATCH -mm -v2 00/12] mm, THP, swap: Delay splitting THP after swapped out Andrew Morton
2017-07-24 0:57 ` Huang, Ying
2017-07-24 2:46 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170623071303.13469-10-ying.huang@intel.com \
--to=ying.huang@intel.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=ross.zwisler@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).