From patchwork Tue Feb 11 11:20:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 11375231 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C76C14B4 for ; Tue, 11 Feb 2020 11:20:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 80C7F20714 for ; Tue, 11 Feb 2020 11:20:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80C7F20714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A51C96B02A9; Tue, 11 Feb 2020 06:20:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A023D6B02AB; Tue, 11 Feb 2020 06:20:35 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93F136B02AC; Tue, 11 Feb 2020 06:20:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 7C0456B02A9 for ; Tue, 11 Feb 2020 06:20:35 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2B69D181AC9CC for ; Tue, 11 Feb 2020 11:20:35 +0000 (UTC) X-FDA: 76477603230.11.truck61_4f77d05f8b0d X-Spam-Summary: 2,0,0,f640172a31e6fadb,d41d8cd98f00b204,vvs@virtuozzo.com,:hannes@cmpxchg.org:mhocko@kernel.org:vdavydov.dev@gmail.com:akpm@linux-foundation.org:ktkhai@virtuozzo.com:cgroups@vger.kernel.org:,RULES_HIT:41:152:355:379:800:854:960:973:988:989:1260:1277:1311:1313:1314:1345:1381:1437:1515:1516:1518:1534:1540:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2898:3138:3139:3140:3141:3142:3350:3865:3867:3868:3871:4321:5007:6119:6261:7903:8603:10004:10400:11026:11658:11914:12043:12048:12114:12297:12438:12555:12679:12760:12895:12986:13069:13311:13357:14096:14097:14181:14394:14721:21080:21451:21627:30054:30070,0,RBL:185.231.240.75:@virtuozzo.com:.lbl8.mailshell.net-62.2.3.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:294,LUA_SUMMARY:none X-HE-Tag: truck61_4f77d05f8b0d X-Filterd-Recvd-Size: 1868 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 11:20:33 +0000 (UTC) Received: from vvs-ws.sw.ru ([172.16.24.21]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j1TaN-0007J1-JY; Tue, 11 Feb 2020 14:20:12 +0300 From: Vasily Averin Subject: [PATCH] memcg: lost css_put in memcg_expand_shrinker_maps() To: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Kirill Tkhai , cgroups@vger.kernel.org, linux-mm@kvack.org Message-ID: Date: Tue, 11 Feb 2020 14:20:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Language: en-US X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: for_each_mem_cgroup() increases css reference counter for memory cgroup and requires to use mem_cgroup_iter_break() if the walk is cancelled. Cc: stable@vger.kernel.org Fixes commit 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 --- mm/memcontrol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6c83cf4..e2da615 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -409,8 +409,10 @@ int memcg_expand_shrinker_maps(int new_id) 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)