[Devel] [PATCH RHEL7 COMMIT] mm/memcg: add missing kmem charge

Konstantin Khorenko khorenko at virtuozzo.com
Thu Aug 31 11:54:00 MSK 2017


Please consider to release it as a ReadyKernel patch.

https://readykernel.com/

(required only for vz7.33.22 kernel)

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 08/31/2017 11:52 AM, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-514.26.1.vz7.35.5
> ------>
> commit 822bec288dcaf5f69c1ed3e64734230320c798ba
> Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
> Date:   Thu Aug 31 11:52:13 2017 +0300
>
>     mm/memcg: add missing kmem charge
>
>     Since de3a106e28d5 ("mm/memcg: reclaim memory on reaching kmem limit.")
>     if try_charge() decide to bypass memory limit, memcg_charge_kmem()
>     will charge only ->memory/->memsw but not ->kmem. This may lead to
>     deadlocks during cgroup destruction as condition:
>     	 (page_counter_read(&memcg->memory) -
>     	 page_counter_read(&memcg->kmem) > 0)
>
>     in mem_cgroup_reparent_charges() won't come true ever.
>
>     https://jira.sw.ru/browse/PSBM-70556
>
>     Fixes: de3a106e28d5 ("mm/memcg: reclaim memory on reaching kmem limit.")
>     Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
>     Reviewed-by:	Vasily Averin <vvs at virtuozzo.com>
> ---
>  mm/memcontrol.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 97824e2..09ce016 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3087,6 +3087,8 @@ int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp,
>  		page_counter_charge(&memcg->memory, nr_pages);
>  		if (do_swap_account)
>  			page_counter_charge(&memcg->memsw, nr_pages);
> +		page_counter_charge(&memcg->kmem, nr_pages);
> +
>  		ret = 0;
>  	}
>
> .
>


More information about the Devel mailing list