From patchwork Thu May 10 09:52:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10391519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 854BD60153 for ; Thu, 10 May 2018 09:52:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716D71FF13 for ; Thu, 10 May 2018 09:52:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64F45289B7; Thu, 10 May 2018 09:52:54 +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 813A726E54 for ; Thu, 10 May 2018 09:52:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E03C6B05DD; Thu, 10 May 2018 05:52:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 58F126B05DE; Thu, 10 May 2018 05:52:52 -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 407FA6B05E0; Thu, 10 May 2018 05:52:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id E0C6B6B05DD for ; Thu, 10 May 2018 05:52:51 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id q15-v6so905364pff.17 for ; Thu, 10 May 2018 02:52:51 -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:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding:spamdiagnosticoutput :spamdiagnosticmetadata; bh=p5DKsGBLogdybKk+PH0BJTytBdygtv2nnc8duG6DFqQ=; b=kf8AbU/gWtn+aoyAZ3uVn1Xx2kngrLxPb4JjeSHpaMnPSG1kBB3kDx7eYOfub5NISN p79Y61ANS3HfERHp+nQftjQSXLF0+ccvXv0vJf7mqaBHwrVQhWPJHoeuLx2j9l1gr9Jn EjRxqYzZ+SfqKuGNy36I2sGTspXCfau0tYeLAK9Nxrib2OavHh+PPib8Zg1ibMlGSkNU 0apldeR7NYVdPZv7cBAWgVNtzyUxcSzj6vEPBdD2mpgvEUtfW3BWEELZ8JdLaQS1OERk vrhqWDRkxgbd+QD73uC1WU443zYxsuo40b1Z3n3NfCfubxYN61Lob+1sb0dQzHN9GRAT jjrA== X-Gm-Message-State: ALKqPwdWzBVACEqjwf7wdbv8gUh+KcB0qw0VtD0c4PrvCG1cJu6T6fPt zTyix25Mbg6p57qHNWjkR70B2y5G23ek2iTdosoHqwvhpwYRkLH3IUtJIxC9bVWLxzIqHOGj/Gj dPKci2gkREeSk8Ko8qqqFC0RPUndPb5a4MPAkeHNzCqGvriyNuTK1xfzFJsLv2fnWhg== X-Received: by 2002:a17:902:9a4c:: with SMTP id x12-v6mr697191plv.213.1525945971600; Thu, 10 May 2018 02:52:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpiyuuqlzmfEsPV+mxM+8OwD+dIKK3KDHMHcMvOAYGlhKjS93ZXbma9lgke1zyn8FPEKHJg X-Received: by 2002:a17:902:9a4c:: with SMTP id x12-v6mr697123plv.213.1525945970186; Thu, 10 May 2018 02:52:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525945970; cv=none; d=google.com; s=arc-20160816; b=u2e/O3qbyxeot2kCGOcPqeVYrpBhBiyy+txLQqEjg/4Vj/Zm4xrT37KP7HqYNMab5Q nNOvOC3bIFn5qoN4AtPSJBfFpKvZKD+BZA+NEw+q7SxqCA/kuzb7kng4SOEdnQhi5tsy xk4kVBizRMw5o22FtOaljhRfPQaSxIbLjJZUCW47GRLOoJUjNGqddHPSZ2XGCP92OPxw U/+k7E2DSEA87FTuX1yBdneedE1LgaG0R9lUuLPOElWkeMjvUyq5l/09jd23U5Bcl0pv t4FF0uA7+umZZs95/BQRakUOJIZ9fFJrokYFmTLI1YcuuLJ1k8zRaLydYfYC53T9VTjl jkXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput :content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:to:from:subject:dkim-signature :arc-authentication-results; bh=p5DKsGBLogdybKk+PH0BJTytBdygtv2nnc8duG6DFqQ=; b=x80Wk27u/qSidqfVVZI+y4ft2pl0le/pjooB8GFz+miTtFV8UQsnm/4lKDCp+e3GI4 9UBidcd8yDp3wlddXljH7npH9w+zGzVWQ5JrBcZYCG45KGrHTpvG65IYc3CaSe4VaVyC AJoTb1ZDNp5qlJtEg93gRF0tjyA5mTfIOgI0YbnaLuzhiq4I4v9J7WB2sOZXcGTpyEOc H5szVeyIJ26JgVHReacWP3wmC81adK9jshJ6JwK9OBoIXZ2bYKW/OUDlqB6ZP2+jvldS ORuctP5iMhaKR/Bc99nAJInGj4RKRqU858lSNjziSnSrzilFRwgGGEJUAg7Yu2Ye+ORY yANw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=MWAx7O+c; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.2.133 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0133.outbound.protection.outlook.com. [104.47.2.133]) by mx.google.com with ESMTPS id e90-v6si414199pfb.355.2018.05.10.02.52.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 May 2018 02:52:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.2.133 as permitted sender) client-ip=104.47.2.133; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=MWAx7O+c; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.2.133 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p5DKsGBLogdybKk+PH0BJTytBdygtv2nnc8duG6DFqQ=; b=MWAx7O+ckYHMwNFkeB/rSJkqVTPA20BSrmIttBi+7CUVI+m1gUUlV34+zFKahLY3MF9SHdKVAUrYCs8vlSSkav5w+2HGVY45CTSCael0s2BEGUt5htPuIAzk1YYwgSrExyWeWlMl+MH2exCH4UVE3kL0x5PG974agSaRWlKRdY8= Received: from localhost.localdomain (195.214.232.6) by HE1PR0801MB1339.eurprd08.prod.outlook.com (2603:10a6:3:3a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.18; Thu, 10 May 2018 09:52:39 +0000 Subject: [PATCH v5 03/13] mm: Assign memcg-aware shrinkers bitmap to memcg From: Kirill Tkhai To: akpm@linux-foundation.org, vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, ktkhai@virtuozzo.com, tglx@linutronix.de, pombredanne@nexb.com, stummala@codeaurora.org, gregkh@linuxfoundation.org, sfr@canb.auug.org.au, guro@fb.com, mka@chromium.org, penguin-kernel@I-love.SAKURA.ne.jp, chris@chris-wilson.co.uk, longman@redhat.com, minchan@kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, lirongqing@baidu.com, aryabinin@virtuozzo.com Date: Thu, 10 May 2018 12:52:36 +0300 Message-ID: <152594595644.22949.8473969450800431565.stgit@localhost.localdomain> In-Reply-To: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> References: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR0502CA0008.eurprd05.prod.outlook.com (2603:10a6:203:91::18) To HE1PR0801MB1339.eurprd08.prod.outlook.com (2603:10a6:3:3a::7) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1339; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1339; 3:aksJC6xDWcvR29u8vVl6Mkrgo5Yz4TUTBvqsHz5+rtwp1qD4AD2ClHPwZjj2elg21l+x3Uk7JSE0QYfjRHL/jnpCFgvyegLESorly7+WWAbmb1TclyIPZv5cB1ZyG8uZlz5NSFJzXiTqD09YH1kANLEzViwtaEZMu60HJJRsgHdBrJ2CzwNKoiv5N9asJocrVrCi526U2mMrYGxPPQ6K5S03GQ2IwvsXW8cLtScv3o+btA5ycBY5M2VBMN0IfLVa; 25:rsPPc/9Iv2dlHTYHrEeIPGDrNEeOBhQbMzV9wfcX6r33W9jQtwj1OkLNfVJ2hm2YdEapBtDe589PRVly+5xsk95IRCdqqwC6onnCKCKpozUG9BaJQeYsLJtk53IPWED31zfBTnSp7VWL3OXwA736mNRkF2h6DY16gBZQthUZN47Aoc0vvyo/jgjgEhjP4DrzO/Fsr+2/otma9qC7hDZtsjd60q6R0/EnVrV6s8G1ZCGvrqcweL8vxCcUHm5De4SAlfxqLSRX0EQj9w+lqYXycyqyxm5scbanlC9ZwzbZKPFX2P3r2K5X3jerN+fuLJn7pa5Up9GeNimnscXdGJL4Dg==; 31:ZCLJZGHPjSQYW3IxtXXEzzZnOh1w0OTB/KNgtshffg8H/mmoJZP/7ky1UlwKOlB5jNkhnqd5YhhKFkK2jutujlOU3GjqpO9D4yzdN2f1nLDRJNq2I2Ccuq2dSd/8hSOiKe3JVLsXJUfTnjb/7rp0e+Y1n0/2X+Kqt5gZ2AD4bE4K/qxGzBvmSEslhWxfGCr8uAC/EMo5/dWlD/r4MvhXvSC9C87JImfkuk5qUSmJLCA= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1339: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1339; 20:nwVgtSPoWTzwTWdCKop2XeJzqfwWHrD9fViCGtPlV1y1H10t/wzeyKkkjtaCaswts3ddpufoL7//J6+WYCjVulw/HBX45vUiqz+2Xv73c8NAPdrBRP7fyr2Wr9wwliu+84iCyqgsKX1ERH34SZIWCEMt6bAi55PKuTZbuRSE8QCac8LQHWjHC28aCauZHvPzix9cU0MSYM+uYHBNdqEdacsgt9u/pTJqAaoWly6JpBYSsQFs2janTQFcHTqSz9U4jkPdSpWpaX2riUkGfCYbgRQObcmssoIAhBirAQSZuFO2EOsXdIsX20MK86f9J5KIVPpRPa86tzwjbWTKodCt0GSHHeX99Ci+0Be39+deFWVSi3jMx1Ws+8LaUQvSfddUlhFtKSW9b7+sKecQ7qkUi3daH2XIHO61NjiwnaqBSnllBmvuD/U3LYYuEj13K/Hc59Sqa32jQmhRn78Pj4WoTaxUuRigYKg3YF/KxJftf/MHfezxqv1ED9yhv+CyZmjH; 4:P7XIu6feaLNwWm8kw9m77EKjN4rm61P+rN6qYCY4FaanUeqmehL7IbOk+yhNUy+ARcPLR+kvjl3BqUPdbTnPhzUE7XpJz4b7k9leNFgPcuAxpmlmgn7Fcy8yW/ApB4LWsgWf0gAJ9Hqz6liVp7JeT7SBnDmp6+YmqHyMdWdAl8b8QIigP4x2SALMrw6ei9dP+Rt6n8CywZvZh6FgoHnIHdSx76H1xAlSmidX1mtWwyqhuy+0tXA0g3jQUrpiu6ijKpP9j5l7QjaCysvmYKFDqtTVwtbv8WV5aR1ukqxKXpnXF9Yf+pxHVlDShxp5nQ37gmVJbs9Peou584VXenFrZ/uGQuJX3kEJCMY2ilCnI+I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851)(131327999870524); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0801MB1339; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1339; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(366004)(39380400002)(376002)(396003)(39850400004)(199004)(189003)(316002)(5660300001)(58126008)(52116002)(7696005)(7416002)(25786009)(7736002)(2486003)(478600001)(186003)(26005)(8936002)(106356001)(305945005)(81166006)(105586002)(76176011)(97736004)(103116003)(23676004)(16526019)(8676002)(81156014)(55236004)(3846002)(86362001)(575784001)(6116002)(446003)(11346002)(486006)(230700001)(66066001)(476003)(6636002)(6666003)(956004)(386003)(53936002)(6506007)(9686003)(50466002)(39060400002)(68736007)(55016002)(33896004)(2906002)(61506002)(47776003)(59450400001)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1339; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDFNQjEzMzk7MjM6cnBzYVMzcmVaTWRwKzdlTUY5Q0doTGtz?= =?utf-8?B?c0lleGowcnlHWThZZVRzbU15aFdrTTd5a25yRzc2a1l2bmNpUC9NbndDaXhP?= =?utf-8?B?NEwyc2xIVy9Vd2Z2dHdrTUl1WUdtYXJIT09RNERyV2QwZ1JyRVB6a0s0Q3pj?= =?utf-8?B?TFZYMHA2RHZ3ZCtvNDc3bk9DamtIMThNUitYVjdTUHU2UmpzU3RVTnpBeFpD?= =?utf-8?B?OTRCK2dBbVd0dFdSMzh3WXYrcERJU3o5MUdLSmtPUVN2L3RHSjhqc2tIenpi?= =?utf-8?B?N0xLOWh2VkV6Vzg1TS9YUThBNG9tWEVJQUlLUFg0TitBZCtsNzJRMGNEVUtO?= =?utf-8?B?Q0FYOUdEMkwvVGMzaFQ1NUdvZ0RXR2xEMkROY0JZUkhWOU1hQklXTkduRElS?= =?utf-8?B?d3lIcG4vRFpkTFZjUU9abGlUV2xEbFh4MGJ4U3R4MDh1clFzYnNnSFptV0tr?= =?utf-8?B?OTh4N0h6N1NYZWVzTzFZZVRVVmwzUVp2K0hXRSs1dHdiaWErVjZ6WExzb2c2?= =?utf-8?B?alQ3ZG0xTGJ6T2dWUk1FZmtQL0duSzJkMkM4UHVHV3MrUUFuSnc0bTJmTmVU?= =?utf-8?B?bXlmbXBoVFRqRmRrVUxOSkt0bUoyUjN2ZVhsOEwvS2JiQXJzMnRDS21EU0RE?= =?utf-8?B?V25vU1dvSUdPMlJlbnhJdk1aTmNpb1pNODZpc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mUwEknNAIW0CRZ+cJKL+w==; 5:qFTOSDVdjW03orNdcOhPH+otXcQ0eCLuXlpC4mBSUhUmXw8as69vHBODbALVzjKMr5sYyPmFBEWn4JakIgtCaY1NykVwNiQSaxMhffx71rxrZwen8uKW+VF/SuKcGNvZ+ifivKZFXYLulxd0rWtwLnTKCg05PTcaaummd4xVJg8=; 24:hXu9JaGssjKB4oyvFJzb0MXrmByYzdXodnYWNUen0pObW4jolQrn7M6xgGLtyeZ01LPBKZuTOluYOtpc2XmDJC3pt5eqpqxGDqt/od4Ls3Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1339; 7:BKdvButigbKipjPhI/3Qj2q3/7TTxSv1o5RnF38Uuv+4JuL7sIBK1GO4rw7CAxuDvJsJnjCy8s8XWGOrHwC6XCahcenAA/IN0vmReXud11UUIEhi+Lp2EfmuUKx+63jFIxl+zd4XWX79Xo6Ix2O4fVXmNUJmKGiy7c2+TnQ/Nvf2ZbWq7C2bG+uRZtBENdMsJ/g7EA2O/3fT+8kDawAlQzejBmpBMH68OjjnLJOms/rAnhCYjyGlMIIOjfvboTXr; 20:QyMCsPaH7DBd60enAPsBR4BQIwGubuHFl/YiQnfPsRn5QbLlb2+V97oGdsM00g0DFwqfCer8+16LTzrSwVLSN5yjpEJqQAej6eaGmsZEBFzkh84McRmudrlTrOZ0w3ZJXK8DIlRRlZyIEIrDgcoc7RIA2xZa++KGJbf6YH0y4JE= X-MS-Office365-Filtering-Correlation-Id: dcb70ac6-638b-4062-7484-08d5b65bc576 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 09:52:39.2696 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dcb70ac6-638b-4062-7484-08d5b65bc576 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1339 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 Imagine a big node with many cpus, memory cgroups and containers. Let we have 200 containers, every container has 10 mounts, and 10 cgroups. All container tasks don't touch foreign containers mounts. If there is intensive pages write, and global reclaim happens, a writing task has to iterate over all memcgs to shrink slab, before it's able to go to shrink_page_list(). Iteration over all the memcg slabs is very expensive: the task has to visit 200 * 10 = 2000 shrinkers for every memcg, and since there are 2000 memcgs, the total calls are 2000 * 2000 = 4000000. So, the shrinker makes 4 million do_shrink_slab() calls just to try to isolate SWAP_CLUSTER_MAX pages in one of the actively writing memcg via shrink_page_list(). I've observed a node spending almost 100% in kernel, making useless iteration over already shrinked slab. This patch adds bitmap of memcg-aware shrinkers to memcg. The size of the bitmap depends on bitmap_nr_ids, and during memcg life it's maintained to be enough to fit bitmap_nr_ids shrinkers. Every bit in the map is related to corresponding shrinker id. Next patches will maintain set bit only for really charged memcg. This will allow shrink_slab() to increase its performance in significant way. See the last patch for the numbers. Signed-off-by: Kirill Tkhai --- include/linux/memcontrol.h | 21 ++++++++ mm/memcontrol.c | 116 ++++++++++++++++++++++++++++++++++++++++++++ mm/vmscan.c | 16 ++++++ 3 files changed, 152 insertions(+), 1 deletion(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 6cbea2f25a87..e5e7e0fc7158 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -105,6 +105,17 @@ struct lruvec_stat { long count[NR_VM_NODE_STAT_ITEMS]; }; +#ifdef CONFIG_MEMCG_SHRINKER +/* + * Bitmap of shrinker::id corresponding to memcg-aware shrinkers, + * which have elements charged to this memcg. + */ +struct memcg_shrinker_map { + struct rcu_head rcu; + unsigned long map[0]; +}; +#endif /* CONFIG_MEMCG_SHRINKER */ + /* * per-zone information in memory controller. */ @@ -118,6 +129,9 @@ struct mem_cgroup_per_node { struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; +#ifdef CONFIG_MEMCG_SHRINKER + struct memcg_shrinker_map __rcu *shrinker_map; +#endif struct rb_node tree_node; /* RB tree node */ unsigned long usage_in_excess;/* Set to the value by which */ /* the soft limit is exceeded*/ @@ -1255,4 +1269,11 @@ static inline void memcg_put_cache_ids(void) #endif /* CONFIG_MEMCG && !CONFIG_SLOB */ +#ifdef CONFIG_MEMCG_SHRINKER +#define MEMCG_SHRINKER_MAP(memcg, nid) (memcg->nodeinfo[nid]->shrinker_map) + +extern int memcg_shrinker_nr_max; +extern int memcg_expand_shrinker_maps(int old_id, int id); +#endif /* CONFIG_MEMCG_SHRINKER */ + #endif /* _LINUX_MEMCONTROL_H */ diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 3df3efa7ff40..18e0fdf302a9 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -322,6 +322,116 @@ struct workqueue_struct *memcg_kmem_cache_wq; #endif /* !CONFIG_SLOB */ +#ifdef CONFIG_MEMCG_SHRINKER +int memcg_shrinker_nr_max; +static DEFINE_MUTEX(shrinkers_nr_max_mutex); + +static void memcg_free_shrinker_map_rcu(struct rcu_head *head) +{ + kvfree(container_of(head, struct memcg_shrinker_map, rcu)); +} + +static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg, + int size, int old_size) +{ + struct memcg_shrinker_map *new, *old; + int nid; + + lockdep_assert_held(&shrinkers_nr_max_mutex); + + for_each_node(nid) { + old = rcu_dereference_protected(MEMCG_SHRINKER_MAP(memcg, nid), true); + /* Not yet online memcg */ + if (old_size && !old) + return 0; + + new = kvmalloc(sizeof(*new) + size, GFP_KERNEL); + if (!new) + return -ENOMEM; + + /* Set all old bits, clear all new bits */ + memset(new->map, (int)0xff, old_size); + memset((void *)new->map + old_size, 0, size - old_size); + + rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, new); + if (old) + call_rcu(&old->rcu, memcg_free_shrinker_map_rcu); + } + + return 0; +} + +static void memcg_free_shrinker_maps(struct mem_cgroup *memcg) +{ + struct mem_cgroup_per_node *pn; + struct memcg_shrinker_map *map; + int nid; + + if (memcg == root_mem_cgroup) + return; + + mutex_lock(&shrinkers_nr_max_mutex); + for_each_node(nid) { + pn = mem_cgroup_nodeinfo(memcg, nid); + map = rcu_dereference_protected(pn->shrinker_map, true); + if (map) + call_rcu(&map->rcu, memcg_free_shrinker_map_rcu); + rcu_assign_pointer(pn->shrinker_map, NULL); + } + mutex_unlock(&shrinkers_nr_max_mutex); +} + +static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) +{ + int ret, size = memcg_shrinker_nr_max/BITS_PER_BYTE; + + if (memcg == root_mem_cgroup) + return 0; + + mutex_lock(&shrinkers_nr_max_mutex); + ret = memcg_expand_one_shrinker_map(memcg, size, 0); + mutex_unlock(&shrinkers_nr_max_mutex); + + if (ret) + memcg_free_shrinker_maps(memcg); + + return ret; +} + +static struct idr mem_cgroup_idr; + +int memcg_expand_shrinker_maps(int old_nr, int nr) +{ + int size, old_size, ret = 0; + struct mem_cgroup *memcg; + + old_size = old_nr / BITS_PER_BYTE; + size = nr / BITS_PER_BYTE; + + mutex_lock(&shrinkers_nr_max_mutex); + + if (!root_mem_cgroup) + goto unlock; + + for_each_mem_cgroup(memcg) { + if (memcg == root_mem_cgroup) + continue; + ret = memcg_expand_one_shrinker_map(memcg, size, old_size); + if (ret) + goto unlock; + } +unlock: + mutex_unlock(&shrinkers_nr_max_mutex); + return ret; +} +#else /* CONFIG_MEMCG_SHRINKER */ +static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) +{ + return 0; +} +static void memcg_free_shrinker_maps(struct mem_cgroup *memcg) { } +#endif /* CONFIG_MEMCG_SHRINKER */ + /** * mem_cgroup_css_from_page - css of the memcg associated with a page * @page: page of interest @@ -4471,6 +4581,11 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css) { struct mem_cgroup *memcg = mem_cgroup_from_css(css); + if (memcg_alloc_shrinker_maps(memcg)) { + mem_cgroup_id_remove(memcg); + return -ENOMEM; + } + /* Online state pins memcg ID, memcg ID pins CSS */ atomic_set(&memcg->id.ref, 1); css_get(css); @@ -4522,6 +4637,7 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css) vmpressure_cleanup(&memcg->vmpressure); cancel_work_sync(&memcg->high_work); mem_cgroup_remove_from_trees(memcg); + memcg_free_shrinker_maps(memcg); memcg_free_kmem(memcg); mem_cgroup_free(memcg); } diff --git a/mm/vmscan.c b/mm/vmscan.c index d691beac1048..d8a2870710e0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -174,12 +174,26 @@ static DEFINE_IDR(shrinker_idr); static int prealloc_memcg_shrinker(struct shrinker *shrinker) { - int id, ret; + int id, nr, ret; down_write(&shrinker_rwsem); ret = id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL); if (ret < 0) goto unlock; + + if (id >= memcg_shrinker_nr_max) { + nr = memcg_shrinker_nr_max * 2; + if (nr == 0) + nr = BITS_PER_BYTE; + BUG_ON(id >= nr); + + if (memcg_expand_shrinker_maps(memcg_shrinker_nr_max, nr)) { + idr_remove(&shrinker_idr, id); + goto unlock; + } + memcg_shrinker_nr_max = nr; + } + shrinker->id = id; ret = 0; unlock: