Message ID | 20200730143439.22051-1-aryabinin@virtuozzo.com |
---|---|
State | New |
Series | "mm/memcg: fix cache growth above cache.limit_in_bytes" |
Headers | show
Delivered-To: criupatchwork@gmail.com Received: from imap.gmail.com [74.125.140.109] by patchwork.criu.org with IMAP (fetchmail-6.3.26) for <root@localhost> (single-drop); Thu, 30 Jul 2020 16:35:18 +0200 (CEST) Received: by 2002:a6b:1c8:0:0:0:0:0 with SMTP id 191csp2271608iob; Thu, 30 Jul 2020 07:35:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzduVAK6OQ9ggqQGs1xDFcgudwf+RwIL9jCwNCxpL3+G75TQjtMgd4HgKurdhCusbgtDUox X-Received: by 2002:a2e:9591:: with SMTP id w17mr1715845ljh.390.1596119713101; Thu, 30 Jul 2020 07:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596119713; cv=none; d=google.com; s=arc-20160816; b=dgatJ9Y5+tmKP7MST+b6Um/lr8bAJb2+gu8Up58OQCyNORKiivPW+Wv0F3Jy3WJf7C z8kGFhJtWCVwyFNC+5PaFIlPeFppKO9YqY7tInLIW/5HMy0QSODAj2jQ+7gmGG+zaEqe Qs8G/C6e/zwlBvMBjLFnadS2uN7WhSnu96874iDtiCMh24nVJIK8qSmfa6Qke1F4jhGP WRdRAPv50VpMwWQkVczBsyC4PNxZ0QfxNCsZxwEDvveTku6eKuHrgqAwbMdc6u3aZpcz LLUvOZLIxldm0LGAnSn5lMuWJaJbJ1xf2VEsyACi9b+04ReKwUxTDro+7waQWgxjwx9H /egA== 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 :cc:mime-version:references:in-reply-to:message-id:date:to:from; bh=QfB5oeS9A9p9/wevtkGTSzxJlVnGL+LTnYlw04v6oUs=; b=FlmXzeZUC5TIcXxmj8fKvFtXA727MvYh9vsxTbePnERCXxPNyF+qATDJ7vd6JfakW/ GNgkphIfdV2bLLFJxaXCBakVKWCtqGJgEO7HTXgMV4CKjcZNRoFtUsAQ2R0zNN8hCEXJ OYwfWPzAYiyNF0aaQUg/G7G6znMZmYxV6+wmZUjwpamjiMAIB4MG75CXZqdMFL2qXeiO PkrFyUYKI0Yk2plvBLzxotz2BVzFti1i/PmnFtXbffi+oYjnqi9BMqgVgbvuTh907Mr8 J9gcyYrzhQrJRQNZ161JSkds68+fedr9WyKmY43UF3XOb5iNq+OxQsZrOiS7Vn7JLCPJ M5pQ== 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 h11si2571592ljj.311.2020.07.30.07.35.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2020 07:35:13 -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 06UEYbur005543; Thu, 30 Jul 2020 17:34:39 +0300 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2177.outbound.protection.outlook.com [104.47.17.177]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 06UEYbTx005540 for <devel@openvz.org>; Thu, 30 Jul 2020 17:34:37 +0300 Received: from AM5PR1001CA0028.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::41) by DB7PR08MB3498.eurprd08.prod.outlook.com (2603:10a6:10:4c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Thu, 30 Jul 2020 14:34:40 +0000 Received: from HE1EUR01FT003.eop-EUR01.prod.protection.outlook.com (2603:10a6:206:2:cafe::9d) by AM5PR1001CA0028.outlook.office365.com (2603:10a6:206:2::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Thu, 30 Jul 2020 14:34:40 +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=relay3.sw.ru; Received: from relay3.sw.ru (185.231.240.75) by HE1EUR01FT003.mail.protection.outlook.com (10.152.0.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20 via Frontend Transport; Thu, 30 Jul 2020 14:34:39 +0000 Received: from [192.168.15.96] (helo=localhost.sw.ru) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from <aryabinin@virtuozzo.com>) id 1k19dY-0004Qx-Pd; Thu, 30 Jul 2020 17:34:24 +0300 From: Andrey Ryabinin <aryabinin@virtuozzo.com> To: devel@openvz.org Date: Thu, 30 Jul 2020 17:34:39 +0300 Message-Id: <20200730143439.22051-1-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200730135619.19888-1-aryabinin@virtuozzo.com> References: <20200730135619.19888-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81b182a9-8641-46f1-e26d-08d83495b10c X-MS-TrafficTypeDiagnostic: DB7PR08MB3498: X-Forefront-Antispam-Report: CIP:185.231.240.75; CTRY:RU; LANG:en; SCL:-1; SRV:; IPV:CAL; SFV:SKN; H:relay3.sw.ru; PTR:relay.sw.ru; CAT:NONE; SFTY:; SFS:; DIR:INB; SFP:; X-MS-Oob-TLC-OOBClassifiers: OLM:103; X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?J9/ATnZzvqXxHaUypDwFe2JVYVroSYMXXK2actSG0lFQvaOO7ukbah1PE+NY?= =?us-ascii?Q?KzIn1aICaOYf8QuQ0tZcVax7F63xXP/+dMmSo4Kv18RVUnmJ4PCGWqVd45Ue?= =?us-ascii?Q?1xM0MmSxx7rT08doA+5nbJgJdgLqIMnCVLqR9PnE0gKAAdfhwRNeS9Z6B6Ud?= =?us-ascii?Q?GML0uv9p1oxmxGGThaUvUZYB/wn/w7VVgfdxTwsdzY/inN2ZQvUQrImAIHhp?= =?us-ascii?Q?UrnzxBZz58IA6gD7t9SxoEP07bi57UjYrKRD/n9pOkwSuoIIQ04YSW7xNur6?= =?us-ascii?Q?Ovi/E5tRtQst0gSgr6GEBblYgTSFpKX57jkLlpmEzu0N+KWBVCnpS4nwtn19?= =?us-ascii?Q?AwgapzTS4MGfqQos4/ShYpQ343VA3gVtiJyKLtMXjFxoepUzlLqQeY3x0I03?= =?us-ascii?Q?IF6efJoFQs36+js49j0N3hrd6426K0i+xyBVR4//LFp/S2RkCY4N5uHaprOy?= =?us-ascii?Q?6PTPqNrmKT44kJ7QpproQUgVEoOulX3Z4sTS9wHvmijxyGIq5QtxJfyF4E4e?= =?us-ascii?Q?LIWGMWgrjvd1gsiinqk4ml7kzIqup3IClzkprdM+L/IPioyVX3vpqiimUVgL?= =?us-ascii?Q?EmmDw0+P7owzt+Lbb9DzFolpixAjwV6aBVCrxrMmqviMkRihsgiyhVYcPaM3?= =?us-ascii?Q?drIDIqVloT/loj1FaHF0G4sgXJ0KJGHJm1NNm5UE1CoqwlBQ/OKvGNzzraTm?= =?us-ascii?Q?fwdexaKX3eWJLmaRnrbAM1GtKvdMJfZW4fDsjxMcXWZe1eItNzZSsFRn7d0n?= =?us-ascii?Q?HQcEDIf5SkkAZW8LDnL6NYqzTDP8NWiPHvaIrAmotfVq2iu1jcXuyMLo+kGh?= =?us-ascii?Q?7QwMq03jrc3gAOAmPBx1zkDYJLx/J9hnb35/47hAzT+amEcEoC0gSnF50TdJ?= =?us-ascii?Q?o2Qp5mHHwVuYfc/mrKFY2kkuiAoAHpIuyyO7krBHi4a/VNKnIYbfzLWZzzxt?= =?us-ascii?Q?w1zQZ+6EJfiPClOG4CZ5+pb/ygM7SCZKn4YBBMKTf2FUSOyCIma+lEybsUMX?= =?us-ascii?Q?iIzLejkHFv/4PCe/Js1SlCh6KSeRbCBr8QcVK976rLaM2NI4O7bS0o/W+uwR?= =?us-ascii?Q?KjHBgWUyukzmdPfbp7J+1tSjFjiApw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 14:34:39.8088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81b182a9-8641-46f1-e26d-08d83495b10c 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=[relay3.sw.ru] X-MS-Exchange-CrossTenant-AuthSource: HE1EUR01FT003.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3498 X-MS-Exchange-CrossPremises-OriginalClientIPAddress: 185.231.240.75 X-MS-Exchange-CrossPremises-TransportTrafficType: Email X-MS-Exchange-CrossPremises-AuthSource: HE1EUR01FT003.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossPremises-AuthAs: Anonymous X-MS-Exchange-CrossPremises-SCL: -1 X-MS-Exchange-CrossPremises-Processed-By-Journaling: Journal Agent X-OrganizationHeadersPreserved: DB7PR08MB3498.eurprd08.prod.outlook.com Cc: den@virtuozzo.com Subject: [Devel] [PATCH rh7 v3] mm/memcg: fix cache growth above cache.limit_in_bytes 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 3cf200f506c3..e23e546fd00f 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3080,12 +3080,16 @@ static void reclaim_high(struct mem_cgroup *memcg, { do { + long cache_overused; + if (page_counter_read(&memcg->memory) > memcg->high) try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, 0); - if (page_counter_read(&memcg->cache) > memcg->cache.limit) - try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, - MEM_CGROUP_RECLAIM_NOSWAP); + cache_overused = page_counter_read(&memcg->cache) - + memcg->cache.limit; + if (cache_overused > 0) + try_to_free_mem_cgroup_pages(memcg, max(CHARGE_BATCH, cache_overused, + gfp_mask, MEM_CGROUP_RECLAIM_NOSWAP); } while ((memcg = parent_mem_cgroup(memcg))); }
Exceeding cache above cache.limit_in_bytes schedules high_work_func() which tries to reclaim 32 pages. If cache generated fast enough or it allows cgroup to steadily grow above cache.limit_in_bytes because we don't reclaim enough. Try to reclaim exceeded amount of cache instead. https://jira.sw.ru/browse/PSBM-106384 Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> --- Changes since v1: add bug link to changelog Changes since v2: Fix cache_overused check (We should check if it's positive). Made this stupid bug during cleanup, patch was tested without bogus cleanup, so it shoud work. mm/memcontrol.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)