Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1286717

Re: [PATCH mmotm] memcg: Ignore partial THP when moving task

From Johannes Weiner <hannes@cmpxchg.org>
Newsgroups linux.kernel
Subject Re: [PATCH mmotm] memcg: Ignore partial THP when moving task
Date 2015-12-08 18:40 +0100
Message-ID <qDup4-5jp-5@gated-at.bofh.it> (permalink)
References <qDu5I-5d4-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Dec 08, 2015 at 06:13:09PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> After "mm: rework mapcount accounting to enable 4k mapping of THPs"
> it is possible to have a partial THP accessible via ptes. Memcg task
> migration code is not prepared for this situation and uncharges the tail
> page from the original memcg while the original THP is still charged via
> the head page which is not mapped to the moved task. The page counter
> of the origin memcg will underflow when the whole THP is uncharged later
> on and lead to:
> WARNING: CPU: 0 PID: 1340 at mm/page_counter.c:26 page_counter_cancel+0x34/0x40()
> reported by Minchan Kim.
> 
> This patch prevents from the underflow by skipping any partial THP pages
> in mem_cgroup_move_charge_pte_range. PageTransCompound is checked when
> we do pte walk. This means that a process might leave a partial THP
> behind in the original memcg if there is no other process mapping it via
> pmd but this is considered acceptable because it shouldn't happen often
> and this is not considered a memory leak because the original THP is
> still accessible and reclaimable. Moreover the task migration has always
> been racy and never guaranteed to move all pages.
> 
> Reported-by: Minchan Kim <minchan@kernel.org>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> 
> Hi,
> this is a patch tested by Minchan in the original thread [1]. I have
> only replaced PageCompound with PageTransCompound because other similar
> fixes in mmotm used this one. The underlying implementation is the same.
> Johannes, I have kept your a-b but let me know if you are not OK with the
> changelog.

Looks good to me, thanks Michal. Please keep my Acked-by.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH mmotm] memcg: Ignore partial THP when moving task Michal Hocko <mhocko@kernel.org> - 2015-12-08 18:20 +0100
  Re: [PATCH mmotm] memcg: Ignore partial THP when moving task Johannes Weiner <hannes@cmpxchg.org> - 2015-12-08 18:40 +0100
  Re: [PATCH mmotm] memcg: Ignore partial THP when moving task Michal Hocko <mhocko@kernel.org> - 2015-12-09 10:10 +0100

csiph-web