From patchwork Fri Feb 21 04:04:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 231051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E297AC11D27 for ; Fri, 21 Feb 2020 04:04:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B00E124656 for ; Fri, 21 Feb 2020 04:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582257859; bh=5mIJtpI46Oskh+IAg3n6Md+XF3NXccWhtLrcbhRYqA4=; h=Date:From:To:Subject:List-ID:From; b=dSSF4OEjoG3pxRnpok4UYgtGb+eC97c3m0xt4q14RGyeAikzUS02ImWXJzpSKVerd CJHeLp4RsTfvkD67Gn/bIQb/MAFOGtPjNoNueRVqUZVhgIiCku23rdq0es0T34C28H SyhSnLUJdwr8LWnh9zo61VKsHCeHLxOsCDaFR7mQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbgBUEET (ORCPT ); Thu, 20 Feb 2020 23:04:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:35166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729229AbgBUEET (ORCPT ); Thu, 20 Feb 2020 23:04:19 -0500 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 885ED207FD; Fri, 21 Feb 2020 04:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582257858; bh=5mIJtpI46Oskh+IAg3n6Md+XF3NXccWhtLrcbhRYqA4=; h=Date:From:To:Subject:From; b=0zeqLBsCRyDrz7bAiso+vKVtSmiepm/FEsHxRBYVsxbF1nLT+DrrhW1UDKS45e3XF B2g+MqmgHjvCnwe/fSkqEtOE31pBrkEFzh1pOKYCcybhmBGALKAvfE1zCedeLZQ+9n 3U5rDY/gQH83qQt/nQ9nysgdocwlAetviuhymHV0= Date: Thu, 20 Feb 2020 20:04:18 -0800 From: akpm@linux-foundation.org To: vdavydov.dev@gmail.com, stable@vger.kernel.org, mhocko@suse.com, ktkhai@virtuozzo.com, hannes@cmpxchg.org, guro@fb.com, vvs@virtuozzo.com, akpm@linux-foundation.org, mm-commits@vger.kernel.org, linux-mm@kvack.org, torvalds@linux-foundation.org Subject: [patch 10/15] mm/memcontrol.c: lost css_put in memcg_expand_shrinker_maps() Message-ID: <20200221040418.LZDCt%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vasily Averin Subject: mm/memcontrol.c: lost css_put in memcg_expand_shrinker_maps() for_each_mem_cgroup() increases css reference counter for memory cgroup and requires to use mem_cgroup_iter_break() if the walk is cancelled. Link: http://lkml.kernel.org/r/c98414fb-7e1f-da0f-867a-9340ec4bd30b@virtuozzo.com Fixes: 0a4465d34028 ("mm, memcg: assign memcg-aware shrinkers bitmap to memcg") Signed-off-by: Vasily Averin Acked-by: Kirill Tkhai Acked-by: Michal Hocko Reviewed-by: Roman Gushchin Cc: Johannes Weiner Cc: Vladimir Davydov Cc: Signed-off-by: Andrew Morton --- mm/memcontrol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/memcontrol.c~memcg-lost-css_put-in-memcg_expand_shrinker_maps +++ a/mm/memcontrol.c @@ -409,8 +409,10 @@ int memcg_expand_shrinker_maps(int new_i if (mem_cgroup_is_root(memcg)) continue; ret = memcg_expand_one_shrinker_map(memcg, size, old_size); - if (ret) + if (ret) { + mem_cgroup_iter_break(NULL, memcg); goto unlock; + } } unlock: if (!ret)