[lkml]   [2019]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/2] mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm()

On Wed, Nov 06, 2019 at 02:51:30PM -0800, Roman Gushchin <> wrote:
> Let's fix it by switching from css_tryget_online() to css_tryget().
Is this a safe thing to do? The stack captures a kmem charge path, with
css_tryget() it may happen it gets an offlined memcg and carry out
charge into it. What happens when e.g. memcg_deactivate_kmem_caches is
skipped as a consequence?

> The problem is caused by an exiting task which is associated with
> an offline memcg. We're iterating over and over in the
> do {} while (!css_tryget_online()) loop, but obviously the memcg won't
> become online and the exiting task won't be migrated to a live memcg.
As discussed in other replies, the task is not yet exiting. However, the
access to memcg isn't through `current` but `mm->owner`, i.e. another
task of a threadgroup may have got stuck in an offlined memcg (I don't
have a good explanation for that though).

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2019-11-13 17:30    [W:0.305 / U:3.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site