From patchwork Tue Sep 4 22:47:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 10588093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76E9914BD for ; Tue, 4 Sep 2018 22:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6549F29DCE for ; Tue, 4 Sep 2018 22:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5940329EFC; Tue, 4 Sep 2018 22:47:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 700EC29DCE for ; Tue, 4 Sep 2018 22:47:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD2156B6FE2; Tue, 4 Sep 2018 18:47:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D82D46B6FE3; Tue, 4 Sep 2018 18:47:33 -0400 (EDT) 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 C4C976B6FE4; Tue, 4 Sep 2018 18:47:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id 952FB6B6FE2 for ; Tue, 4 Sep 2018 18:47:33 -0400 (EDT) Received: by mail-qk1-f199.google.com with SMTP id 3-v6so3690791qkj.13 for ; Tue, 04 Sep 2018 15:47:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:dkim-signature:from:to:cc:subject :date:message-id:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata; bh=ktMtlDp4+9he2eMHhMhkZU9POjaLOZkqUgYfvpDtsV8=; b=YH2eA/uPYEbaTp059C3WIDTDpqiHijpM3UMErWD/OnX7A0b+9Ps9lcgCWOuSsM1a87 J6ZJd/y4d+YAAW86cAYpoVY7uY8P2hvHmug6wr2uuVq7x2ywHMSLEIB8m+y6hmzchZWL KMLPAlRRqqriW4G1Na4PGJ2BUe1GA70YGscY9AseqibyoFWwnCcM4gbgN7o5C5qRMGi/ 8XduDHCw6W8B8JRi8ECfSH7AmStWh6JyjjWQf3gMFen70fuyIvii9vNh9g5s2MiFTTmE kJZg5PMJQbXJzs/+K4XiIliWvu3ouAIPyaGH9AhPp7+zO6bHLPWk2o9V1PgsPzwfCy5O ySWQ== X-Gm-Message-State: APzg51ASHDDbZUSl5VtNoUBmd67Ct8csa69pIwIJFN0I5ut9Sc011OsG jR2yXz1MePHxrYnWUvdg9IAQ9CEKVvKBqcRkHYhJpXIcuLCIR01uYxBblsSq+yK4xGKBgQKvfvb Oa8UdQLLhUbd/knbQPiUoZ07QBlnsEDXMrE08tdXnaePB4mXPCtO3iWl503sr2m3Srw== X-Received: by 2002:a0c:95f7:: with SMTP id t52-v6mr30819987qvt.246.1536101253308; Tue, 04 Sep 2018 15:47:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb+rLN9+s4eJXFLMNeFIA/9BgpLM+EKhP5FqgA+Q9qEhPRSVBrUrBvwhIJWYVGKfMkfw6kj X-Received: by 2002:a0c:95f7:: with SMTP id t52-v6mr30819953qvt.246.1536101252419; Tue, 04 Sep 2018 15:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536101252; cv=none; d=google.com; s=arc-20160816; b=tQ20gMHX+4kK4HCvFABixAZ09uJ7PS1X6NzSvOxikeTaADIu3DG/BklCvKavQ6Bfta KjBX9Hu6pYA7C4+/+X2Zi1gFOj7ccqwuh/+beg7S25Lm3WoLPSz7yylcqqn5BOrGAjMH Wzl7XhjZNAV11924ob4GfAcgSo4eRHMWKD3kPInT8+crFsmLGv5ePChwlC/hZFxauYEk kkEYjIISaibofdqVz5zclNrhdihrKST++Zywm9ViQQiQot/5Zs/9z+JfStQf4M/y0/KT OOXUmEA/sR8FH6epPv7GqXlxcg0y2zwWm60ptr1oshT/lEq+OdCP40oz653+VpsKXE4E UsgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:mime-version:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature; bh=ktMtlDp4+9he2eMHhMhkZU9POjaLOZkqUgYfvpDtsV8=; b=Exijicc2jMGyeLrpKbMJkEo4Y05AFcai7LAqL2uY31j3n1NEBC0nHg9Q1dNlqY9cX7 NJQ3Z+zazeUaRD9tnaH78d4c/zn6LrJ/ZJ+OJk/VEkUgrY2nLc4uNrBFBS0OjjmPgZM9 QZg0G4A49XxOquJofz77WvShhTQyA2/aGfLo2fCdbi74xpUO3w4j8fxh0uMUnKBZAo3g LAnl1cspBuKnLRmqMcQ7cRYiWtO7RmOCEIQpI6zjW57PDELu7UEI5h3I/Yk+/2D3mr6T AkDpfMU4i0DCjrF1DqzWaw8D8J4kjqCH2wIGr3fRcG5NFleoYBZ+uxCma2dq7zxPMNRG QMJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="lfNFK/hT"; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FwjVR4Tf; spf=pass (google.com: domain of prvs=27853e829c=guro@fb.com designates 67.231.145.42 as permitted sender) smtp.mailfrom="prvs=27853e829c=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com. [67.231.145.42]) by mx.google.com with ESMTPS id g129-v6si69023qkc.246.2018.09.04.15.47.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 15:47:32 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=27853e829c=guro@fb.com designates 67.231.145.42 as permitted sender) client-ip=67.231.145.42; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="lfNFK/hT"; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FwjVR4Tf; spf=pass (google.com: domain of prvs=27853e829c=guro@fb.com designates 67.231.145.42 as permitted sender) smtp.mailfrom="prvs=27853e829c=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w84MlSA5005144; Tue, 4 Sep 2018 15:47:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=ktMtlDp4+9he2eMHhMhkZU9POjaLOZkqUgYfvpDtsV8=; b=lfNFK/hT3Ii8mVQU58RRIBL1QSzIruZ/fXhO9r0jhmDC259lzM5uQVDtElXGfe+oZLA+ 6NGXMaAt92PsduVdQVr7Q6nDspdt/+HvPQncIH0ouHsEFBn+HAAPg2DMe5G38WnPZ2jW 2NNhujJVVyp//7qIENbmM5BFCsO58JarByE= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2ma1p7r909-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 04 Sep 2018 15:47:29 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.30) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 4 Sep 2018 18:47:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ktMtlDp4+9he2eMHhMhkZU9POjaLOZkqUgYfvpDtsV8=; b=FwjVR4Tf/LlXuvlA9CvIu+kU4AxZhFTUFmccQVfit1dJKup38TpYpX+7SgmMbx225HDh/8qXI5/wD3ZJejJGnvYK5zJx1GmIfA9Jch6ZNOkOCdcWNsC5zUCnfbVMfRRQ1jfJnIgObi+1AO/IU2kudu0hm2/oOfun0v0A9FmO6L8= Received: from tower.thefacebook.com (2620:10d:c090:200::6:bb1b) by SN1PR15MB0173.namprd15.prod.outlook.com (2a01:111:e400:58cf::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Tue, 4 Sep 2018 22:47:24 +0000 From: Roman Gushchin To: CC: , , Rik van Riel , Roman Gushchin , Josef Bacik , Johannes Weiner , Andrew Morton Subject: [PATCH v2] mm: slowly shrink slabs with a relatively small number of objects Date: Tue, 4 Sep 2018 15:47:07 -0700 Message-ID: <20180904224707.10356-1-guro@fb.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::6:bb1b] X-ClientProxiedBy: MWHPR1301CA0001.namprd13.prod.outlook.com (2603:10b6:301:29::14) To SN1PR15MB0173.namprd15.prod.outlook.com (2a01:111:e400:58cf::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ead529ae-d9a0-4c20-965e-08d612b86210 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:SN1PR15MB0173; X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0173;3:1dfnj9cAQAbkfBY25XEg5WdHw8bBGO9kYLemeA5P2RRfXHx4bH9YdOsnnONZnyRC8ZVNEridd85nzPuC9BZXswkJf2N7fBZ1f5pjmb54pwDkANFbhr44lxtUPUi7O3f/so1YOlEK4LkI1ooKGKTuLjNIqiQItcId6Z53B8XXlPt7LVL5rjvwvuXUyWk+TKj8eX2ydT36ESuyv/9o/PvenyXVbN6GAAXOlSNgaXB3IsRxlwrgIKFfKuvSOjJJroHb;25:tDeWY3Wr0+GnoYeAqfnJLAcGtWvVjdPBBgSHjY88EDn04Dq8Hrt2islLtwyVkqxwp195gNi4oEwU1JprJvG6DdsIZLIihjshCI49oUgC7+jiy7O2TYVuZ47HGBUB6zHS3qMS5sKSNSHv3fqoBLhypC5t9xWbBwo20x5AyKip1k7qLc/baO/NFPnRn5XUyhs3Fy2HkfQAajfFlQDaUsT3/FddBhQNoOKcKOiwnXAgSokZqoQCFate9x20d5h3daUYu8zCmbbqGeaJSv89102GEwrrwezNns1afhtYsYL9HTEmm83F851PrZWxf2Ms5doI1sklMlyGcJbU3IfQ0PqnrA==;31:p5lROtsdlqA+zkKIj72R2DVmZIQUtRpu8SvkTf8dqwy3g+/O80vNGmG/4xErxl05bs89mydxW5tjmDaJi+eoNQRqH5IvsNEJE5/k48XOSCDMec7UL65+9Z+gE4er7OOLgDQ6Cta6g2K9j738Zw9i7YrMv72sQotB5qktZ3RvbDjedpbXr1TFstAWjcO0ga6CV8wp9qI7iB2ZH21x7xNvZqCyoLlxdSMOiNkUxoac3ao= X-MS-TrafficTypeDiagnostic: SN1PR15MB0173: X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0173;20:MjIPSpzs7Y87VXUAdKZKOSHgvKEnUWDa8AzMyeakslMcY2EpJK1O4KdlzqFagljqxS9dEAVbeZSmdfi4w5MgA9Y3UflgT8J7S1GlPc+H3NOkrHL/jJLNjFNDaqbjU3dSMZRL0tKVnFFRS5y/iKA0WeD+u5Aizp4eLlgJMs3/ImZVi4hoKvYP6jMBvNPmVl5ihulRhEhpb8GumjEaa7dkwoXJGtCsGg2ErPo1tyG9tkFgNfAth/2B3xJh3Rl7BxTRZ/5WrgPePYSWG8zRMLcWPtzRTOpXNCJNt4TPgUIJN4eG/VgYA4TtrtVO1SrPB4c0weaXk5iCz6GPXpJZSAkQiWqug9kLkmlBPCS7F1rlkoNmGr7r1u87vyvAz9/tI6ja7HQ74d14sUE4CzfkqOhPziN0pzAG0W16lMYC3X53zs0MPKwqipxjHNXwOBlp4JC1f+yhiuWAfWyBanWsIDNd//TndINBPeLh/FJB2bZ+bx6rGbIfPHvKBuszpmlgn0yv;4:/+txh7JFofCYsCj9N/Jkru5wwBnp+F1yLqr2GUdZYFdWUfqqe7X5wvJtY0rO83HhN4PUXYPUoRIsKit37qEuZA5ma1JiVOL/O14GmPdrqXRkiVrbU7lP3dRQG1xq6oiDJBaEygkkt6NLIBAMzwf9Fy3RxwQs1+ds7PDnBBpkVV4ZEvqJcpopB6G+B0nejgeABouoqbVe022P3Tkgt7ESyvqa6BEk6G17o7deWP8S/O0jSyHe2Sbgsf+SAEwi21z9JFiBcnftgM3pvxnFj2C1BUY8pLArUyjoQwRW4f6/iOUseDXUxamcJyGqiY+3t03i X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(10201501046)(93006095)(93001095)(3231311)(11241501184)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016);SRVR:SN1PR15MB0173;BCL:0;PCL:0;RULEID:;SRVR:SN1PR15MB0173; X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(376002)(366004)(346002)(39860400002)(136003)(396003)(199004)(189003)(47776003)(4326008)(54906003)(6666003)(6116002)(6916009)(52396003)(69596002)(1076002)(51416003)(52116002)(5660300001)(16586007)(36756003)(7736002)(97736004)(305945005)(8676002)(81156014)(81166006)(316002)(6486002)(50466002)(25786009)(46003)(105586002)(6512007)(53936002)(53416004)(2361001)(106356001)(476003)(48376002)(186003)(478600001)(50226002)(8936002)(68736007)(2616005)(2351001)(86362001)(16526019)(386003)(6506007)(486006)(2906002)(6346003)(14444005)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR15MB0173;H:tower.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0173;23:3vUXrR4KA1w/JTYOTVPQHP8PQEUDLgV+vqqK8F1BgPa7ZF/2XHUUkLPdhzt4qW/Mzw7Af1HTobOWciakulXXbi1kM2pmA7ZzhCPK82AhvOqv+02hY42sVio3Vv3Sdqsx2pDsM86J3EJT/eTEAaDyiZR3ALFnbuLgeDeKj4Mj8WfDSC8Wi86Y2i9GL8gedvGT0ZpovLJTz3b6E3nIydmcueMLLUgLpKZXyJrFxfJsHFYHbGQdUbw9FlfQuulOaFOYF0j8XesCdl1GSSncNG8yWt5IpQpY8h17Sv/BNGQj/GrnEEHpCljaVDB1hrDttJqUtTiaZxn3//7aqYLOfiJOl6ET3toQt216LfN71pHHNLWwjSm5De7c9gAfdHERRNdAPaJYwR/fCK4ZIGrXrSuWcvpZ43+vo/qoxVbaWJ74Rtsa9c0vtVZmv+9fuJ1cpQTcyPB1a5z/U+CnxMy7wGcfd3Lq6kuxpdDe7RWj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: 1;SN1PR15MB0173;20:vaNZxijh8LuM4qMzJFx2amBPtH6HyFGO/sCQHBoE3Uo2B9S5Afip9Y4HLgwuG5le/r9yqgsvNwy1vjPjKAnNulm5TN9wYlIy1F9cX/hNBFPl5mJQT3OFxTHFbR3e/aXmGrQ+yQbPQ+0xyUY1ywCNMaZLukNcEJTIbzsa6Ujpbg0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 22:47:24.0293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ead529ae-d9a0-4c20-965e-08d612b86210 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR15MB0173 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-04_13:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe 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: X-Virus-Scanned: ClamAV using ClamSMTP Commit 9092c71bb724 ("mm: use sc->priority for slab shrink targets") changed the way how the target slab pressure is calculated and made it priority-based: delta = freeable >> priority; delta *= 4; do_div(delta, shrinker->seeks); The problem is that on a default priority (which is 12) no pressure is applied at all, if the number of potentially reclaimable objects is less than 4096 (1<<12). This causes the last objects on slab caches of no longer used cgroups to never get reclaimed, resulting in dead cgroups staying around forever. Slab LRU lists are reparented on memcg offlining, but corresponding objects are still holding a reference to the dying cgroup. If we don't scan them at all, the dying cgroup can't go away. Most likely, the parent cgroup hasn't any directly associated objects, only remaining objects from dying children cgroups. So it can easily hold a reference to hundreds of dying cgroups. If there are no big spikes in memory pressure, and new memory cgroups are created and destroyed periodically, this causes the number of dying cgroups grow steadily, causing a slow-ish and hard-to-detect memory "leak". It's not a real leak, as the memory can be eventually reclaimed, but it could not happen in a real life at all. I've seen hosts with a steadily climbing number of dying cgroups, which doesn't show any signs of a decline in months, despite the host is loaded with a production workload. It is an obvious waste of memory, and to prevent it, let's apply a minimal pressure even on small shrinker lists. E.g. if there are freeable objects, let's scan at least min(freeable, scan_batch) objects. This fix significantly improves a chance of a dying cgroup to be reclaimed, and together with some previous patches stops the steady growth of the dying cgroups number on some of our hosts. Signed-off-by: Roman Gushchin Acked-by: Rik van Riel Cc: Josef Bacik Cc: Johannes Weiner Cc: Andrew Morton --- mm/vmscan.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index fa2c150ab7b9..8544f4c5cd4f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -476,6 +476,17 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, delta = freeable >> priority; delta *= 4; do_div(delta, shrinker->seeks); + + /* + * Make sure we apply some minimal pressure even on + * small cgroups. This is necessary because some of + * belonging objects can hold a reference to a dying + * child cgroup. If we don't scan them, the dying + * cgroup can't go away unless the memory pressure + * (and the scanning priority) raise significantly. + */ + delta = max(delta, min(freeable, batch_size)); + total_scan += delta; if (total_scan < 0) { pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n",