Message ID | 20190619112010.13505-1-aryabinin@virtuozzo.com |
---|---|
State | New |
Series | "mm/memcontrol: don't reparent forever if counter leaked." |
Headers | show
Delivered-To: criupatchwork@gmail.com Received: from gmail-imap.l.google.com [74.125.131.108] by patchwork.criu.org with IMAP (fetchmail-6.3.26) for <root@localhost> (single-drop); Wed, 19 Jun 2019 13:22:17 +0200 (CEST) Received: by 2002:a6b:3a06:0:0:0:0:0 with SMTP id h6csp560107ioa; Wed, 19 Jun 2019 04:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFWg755zW6bkxDKdjqDcpGgchkmp8OaEZT/Hsq8yWlchpPKqj7ih0jut5QtgGodB2k5sQl X-Received: by 2002:a2e:864d:: with SMTP id i13mr3954233ljj.92.1560943331134; Wed, 19 Jun 2019 04:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560943331; cv=none; d=google.com; s=arc-20160816; b=h5tD5TJjEHgLhoEBDw5ps81KbtBbajfA224cMg8EevHe27Li9K/aEYWkKmiDrFkfQz x/x7ch/EY+UpTfW7bK7J+OTN5L6M2qfUj5QZLqklVxULOQR3DObk+xhDPeVVoBRye/wQ CYHCdUigFgTyYvMo/I6+Yl+DYbtGGwsZJIcX9kfuPlMkXBONJfVeh5CHn1WBC1ayFhwk Fr4eSV47enlimG9U8FcUaIdESmLStbGBnjxX3A4GvEHyiN0XkcTU8DiQyQ939FbiwzpT FxOfCw7IIJXWssnlZ9XZL8RTI6hauuvsHbFPA0eezIqKnTaqkDZJgEUKWk+lKzYUZivO lYug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from; bh=ZnI2xWPv/kbpk/odLYc1ydnN3IFZzwXT7+q/tHvda7c=; b=g3N26HlPkBsPJEsd7TxqUH5nXj8Ab7JElOui+BKCexJK7eu8k1di3qTwNBcIeEtkge fPi7+u6QtUeAC+kXFzai/qxRUEQ5qOYB62B7ihRtttHLnWtq005RBqtATszIrRWv+y7B 72OALWgimje5N1OUAyOBeua1dQEJeQy9AsW+xMCmsrer3YVa55TDAK+mv0s5XEM+1wFE nfbNXWk9p5/yhxSSvYY0yeE5Io+Kkb3idsYn6xQFMKjzkAHgFui4SUZQqClfDJ6MD2l+ t6CTEehg5VUlPGz69aRlrgSPAZJa2L8q5nuCex+hImV6uxPGBGXxKMO2Hp+R9whTQNCt AjHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devel-bounces@openvz.org designates 185.231.241.50 as permitted sender) smtp.mailfrom=devel-bounces@openvz.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: <devel-bounces@openvz.org> Received: from mail.openvz.org (mail.openvz.org. [185.231.241.50]) by mx.google.com with ESMTPS id f1si18888592ljg.192.2019.06.19.04.22.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 04:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of devel-bounces@openvz.org designates 185.231.241.50 as permitted sender) client-ip=185.231.241.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devel-bounces@openvz.org designates 185.231.241.50 as permitted sender) smtp.mailfrom=devel-bounces@openvz.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from localhost.localdomain (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id x5JBK4Sj020427; Wed, 19 Jun 2019 14:20:09 +0300 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01lp2055.outbound.protection.outlook.com [104.47.1.55]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id x5JBK10M020422 for <devel@openvz.org>; Wed, 19 Jun 2019 14:20:02 +0300 Received: from AM4PR08CA0078.eurprd08.prod.outlook.com (2603:10a6:205:2::49) by DB8PR08MB5322.eurprd08.prod.outlook.com (2603:10a6:10:fa::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.10; Wed, 19 Jun 2019 11:20:03 +0000 Received: from DB5EUR01FT045.eop-EUR01.prod.protection.outlook.com (2a01:111:f400:7e02::209) by AM4PR08CA0078.outlook.office365.com (2603:10a6:205:2::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.17 via Frontend Transport; Wed, 19 Jun 2019 11:20:03 +0000 Authentication-Results: spf=pass (sender IP is 185.231.240.75) smtp.mailfrom=virtuozzo.com; openvz.org; dkim=none (message not signed) header.d=none; openvz.org; dmarc=pass action=none header.from=virtuozzo.com; Received-SPF: Pass (protection.outlook.com: domain of virtuozzo.com designates 185.231.240.75 as permitted sender) receiver=protection.outlook.com; client-ip=185.231.240.75; helo=relay.sw.ru; Received: from relay.sw.ru (185.231.240.75) by DB5EUR01FT045.mail.protection.outlook.com (10.152.4.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13 via Frontend Transport; Wed, 19 Jun 2019 11:20:03 +0000 Received: from [172.16.25.12] (helo=i7.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from <aryabinin@virtuozzo.com>) id 1hdYdG-0007F4-6G; Wed, 19 Jun 2019 14:20:02 +0300 From: Andrey Ryabinin <aryabinin@virtuozzo.com> To: <devel@openvz.org> Date: Wed, 19 Jun 2019 14:20:10 +0300 Message-ID: <20190619112010.13505-1-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: SFV:SKI; SFV:SKN; SFS:; DIR:INB; SFP:; SCL:-1; SRVR:DB8PR08MB5322; H:relay.sw.ru; FPR:; SPF:None; LANG:en; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0be59fa7-363a-4b97-701a-08d6f4a81329 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4709080)(1401327)(2017052603328); SRVR:DB8PR08MB5322; X-MS-TrafficTypeDiagnostic: DB8PR08MB5322: X-MS-Exchange-PUrlCount: 1 X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LsfmXwhshTX5KXqgvj9hQweFVHG60OLVzYJhFZgS1dBfHINwYgxYZ60Uv9DU?= =?us-ascii?Q?M8QI+GjaSK7AFPwoZfCf/KJJ2XtEUk4pe+AbLz+la+fl93bhqifpWXSPmvA9?= =?us-ascii?Q?9ZFYZw2EBvLbEz4uk96gKtSpg+n3czFHQ1X4p2CngpKrYNxXuxZoU2dT9j6E?= =?us-ascii?Q?hAY/SinYV4T1jdBj7Q8IvJzOfBcofRJhUcAxWWiqPiWsI3Sft1fVD+gccfqF?= =?us-ascii?Q?F4Ik1TwvoRPqVGhR0GR1WxEI5h1gXoeZZaI3OQyYREL/TH/CZRZNvi6ZB2Jg?= =?us-ascii?Q?FbA3UyL5ZiS10jN/MsW+xAZOQJJjwrsgU+c87oOALbJXiCFJX068+fnUnF7g?= =?us-ascii?Q?/mBNWf468kdxF9nO3rKG+Ej7JFuA9CTHXIxyk/9JJEhwMT4/hM21HVbRauZ4?= =?us-ascii?Q?1A0+fOdysjDTvd7vfmxDKJ9+OncVSsJZULvqoCZizhSqxYuKirIAta4YEzRp?= =?us-ascii?Q?aXF1fwP2rD+FKlaHnL+T5XbqfTsVbhg0O2/1C9CtGagjY1FK+0JcOmSqmfyL?= =?us-ascii?Q?1fN7SMR0K5GpBMxUSC4A10d0AZhuZwrudtPAahzvzGi+pa9E2/XJbuUO9Koh?= =?us-ascii?Q?V9rM4ttdF3ozBcId2E1v/+6tPnjv8FccVrou6h8aGXWL7SxLEoT5WkZOZzQx?= =?us-ascii?Q?xBZIOTRXKli9QJsGMe1KIX1Ib83O4iVkBXQCbdlWfUDU+wzOkANqHNvG2w8c?= =?us-ascii?Q?OHayl0WqEwgJg0P/xqed4on+6kd4joPgagmUebC6Bbk7dbd0tVmFgY2cpELU?= =?us-ascii?Q?FoVsd2iJIUK9vlXM8uWy5I354ET1UmbHZDE5exj+j+HDq6wDGhccY9DLIb6b?= =?us-ascii?Q?1zNHnFy7ObT0tORbdlVeDbP1Cmahce9gidhj1f1HaLgd85t+O/9YFUVfIPDl?= =?us-ascii?Q?VQNdlEy+Pey1WFnsSvZwYqCbtrahHj7JPvp9eWSmxtoI+gw4+wusEsQdX7qJ?= =?us-ascii?Q?B6wUL+CYjkCKmmbQ/H8rZ2Rk5l2e88HuasohtEyV6J1ZmXOed7TsJ7vEbMBE?= =?us-ascii?Q?OOYEHvhG0Ml1II5vSGrfPQvrZUM7oY1mBm7VGnFYDjvDCl8=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2019 11:20:03.2629 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0be59fa7-363a-4b97-701a-08d6f4a81329 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0bc7f26d-0264-416e-a6fc-8352af79c58f; Ip=[185.231.240.75]; Helo=[relay.sw.ru] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5322 X-MS-Exchange-CrossPremises-OriginalClientIPAddress: 185.231.240.75 X-MS-Exchange-CrossPremises-SCL: -1 X-MS-Exchange-CrossPremises-AuthSource: DB5EUR01FT045.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossPremises-AuthAs: Anonymous X-MS-Exchange-CrossPremises-TransportTrafficType: Email X-MS-Exchange-CrossPremises-TransportTrafficSubType: X-MS-Exchange-CrossPremises-Antispam-ScanContext: DIR:Originating; SFV:SKN; SKIP:0; X-MS-Exchange-CrossPremises-Processed-By-Journaling: Journal Agent X-OrganizationHeadersPreserved: DB8PR08MB5322.eurprd08.prod.outlook.com Subject: [Devel] [PATCH rh7] mm/memcontrol: don't reparent forever if counter leaked. X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development <devel.openvz.org> List-Unsubscribe: <https://lists.openvz.org/mailman/options/devel>, <mailto:devel-request@openvz.org?subject=unsubscribe> List-Archive: <http://lists.openvz.org/pipermail/devel/> List-Post: <mailto:devel@openvz.org> List-Help: <mailto:devel-request@openvz.org?subject=help> List-Subscribe: <https://lists.openvz.org/mailman/listinfo/devel>, <mailto:devel-request@openvz.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d11aa24ed207..edc6bebc1f34 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4290,6 +4290,8 @@ static void mem_cgroup_force_empty_list(struct mem_cgroup *memcg, static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg) { int node, zid; + /* Protection from leaked memcg->memory counter. */ + int reparent_attempts = 10; do { /* This is for making all *used* pages to be on LRU. */ @@ -4321,8 +4323,8 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg) * right after the check. RES_USAGE should be safe as we always * charge before adding to the LRU. */ - } while (page_counter_read(&memcg->memory) - - page_counter_read(&memcg->kmem) > 0); + } while ((page_counter_read(&memcg->memory) - + page_counter_read(&memcg->kmem) > 0) && reparent_attempts--); } /*
In case of leaked memcg->memory counter mem_cgroup_reparent_charges() may stuck forever under global cgroup_mutex making the whole system unusable. I don't see reson for 'while ((memory - kmem) > 0)' loop, IMO memory should be equal to kmem after the first iteration. And if not it's a leak, but just in case make several attempts. https://pmc.acronis.com/browse/VSTOR-24241 Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> --- mm/memcontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)