Messages in this thread | | | Date | Thu, 6 Feb 2020 10:27:04 -0500 | From | Johannes Weiner <> | Subject | Re: [PATCH 1/2] mm: Charge current memcg when no mm is set |
| |
On Wed, Feb 05, 2020 at 02:33:47PM -0800, Dan Schatzberg wrote: > This modifies the shmem and mm charge logic so that now if there is no > mm set (as in the case of tmpfs backed loop device), we charge the > current memcg, if set. > > Signed-off-by: Dan Schatzberg <dschatzberg@fb.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
It's a dependency for 2/2, but it's also an overdue cleanup IMO: it's always been a bit weird that memalloc_use_memcg() worked for kernel allocations but was silently ignored for user pages.
This patch establishes a precedence order for who gets charged:
1. If there is a memcg associated with the page already, that memcg is charged. This happens during swapin.
2. If an explicit mm is passed, mm->memcg is charged. This happens during page faults, which can be triggered in remote VMs (eg gup).
3. Otherwise consult the current process context. If it has configured a current->active_memcg, use that. Otherwise, current->mm->memcg.
Thanks Dan
| |