From patchwork Tue May 22 10:07:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10417835 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 541F06053B for ; Tue, 22 May 2018 10:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4144E1FF60 for ; Tue, 22 May 2018 10:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 356FD28BB6; Tue, 22 May 2018 10:08:01 +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 8444E1FF60 for ; Tue, 22 May 2018 10:08:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 937CD6B0007; Tue, 22 May 2018 06:07:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8E7A56B0008; Tue, 22 May 2018 06:07:59 -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 789276B000A; Tue, 22 May 2018 06:07:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f199.google.com (mail-qk0-f199.google.com [209.85.220.199]) by kanga.kvack.org (Postfix) with ESMTP id 451E66B0007 for ; Tue, 22 May 2018 06:07:59 -0400 (EDT) Received: by mail-qk0-f199.google.com with SMTP id h15-v6so18762343qkh.3 for ; Tue, 22 May 2018 03:07:59 -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=7dWNYWRFXSbvgVyuUtg35zpMAFMGtIRsYuXxkymnYXQ=; b=S2H4hZLnO8Oc0D8Zguk8CEI+w7ELCLgJGzKE+hodfyTVNYrByV2zrrkS6E32K5IkAd T3aRvUgtkqJOlAeyEglGLsq/DGfp35givpoJv3CBFVEbVGw1Yghu4MglhcF00OIDEqIK 2LaCiY7zar/UUJMtyUBgQewuE0iEG9ZgHpb27VcMooKbXS3Xlpi2bSLzMuFiJO9u5hbV OG6dDBU0tpnW6rgjv7XGkInieBd3CGcZBKakI4fev8DyO/LsETy3cF4mjqYNPmPrTNye ngMtVR2jgp7HTr2z57n2dMmsYrFos3QeTmdzvhS23XGhTVgSGEOoKgmnljRpBNGkFvcA GfSA== X-Gm-Message-State: ALKqPwfsYb7O4eKkXbtuF6adFjoWS50/ZC2IklhWJBJnqUddqcw2E8nf 4HziqQmrNQ4FRyfVXNETLaFVzWhxowbwkYHzfzm2KDTtIms5fOqtVCubFhpdFVFDygrklhib7KH 6AUN3/BFj1sLpQEH1P3LGS6ZGzwFTn4pNynWoZ89cyeRX/jUDObDzmnUQV7ej9RbqFQ== X-Received: by 2002:ac8:24d3:: with SMTP id t19-v6mr22740407qtt.345.1526983679068; Tue, 22 May 2018 03:07:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpy7MtyAFvJ0Hn0cVBWcu+X196d1t7SYIbLU78pddoURviMSdxF/hdaraA6r9FweYV9lYas X-Received: by 2002:ac8:24d3:: with SMTP id t19-v6mr22740366qtt.345.1526983678494; Tue, 22 May 2018 03:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526983678; cv=none; d=google.com; s=arc-20160816; b=xZUh5JOTWTAerD3O4MpvIjEjzfwwaZ/FCbBto5CECrvtCQbAWVBCxbtbXf7p8bXmhr VoNGoszR/5oqpx1q2k1TERzI/migrefy7dgrF+afWK6nZK6ZEWHpiEjA3nJy3cK4LXXK 5zPdYxKqULiQ/ilYuwKMmlVKEqJ89ktR+i4nXza1IKNbVy+9nyP0+gH0ztsWn760v7x+ cc0N2Icgiub/AdccL+zibc2aUYzgP9P6vYEK8eyErG2u6K1ZYlxaQF69/QSQLTkb9ZEH OysJUf4woft3hS540EVWVIlwB3YtF8TVb39OsZWvWc2euDqc8jY1O/ZCXYPfgSSsVH8w ZykQ== 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=7dWNYWRFXSbvgVyuUtg35zpMAFMGtIRsYuXxkymnYXQ=; b=tWggxvjocZNmHB1MCVBJmitNx6hO15aR4bxKD9PI5cVVJMxFzHu3q6IXfquzxm8bnV 9ArOJCLfow2a9r/Jn29b6URC9US9X10PAYMdRv8+1YKKWMcvTPyEt0w/vcUDTXENGjia y1s89fCYo1Kxk1M0TjHJ98VURuHPN9NmoXbQbOnB3oFnEsuSOif88hWcEsq0JDYe6DmB Td4yMhfEcCbpNpu8+ERYKVLYHHwUy9/w6wjKRf1vifW04n9aBCy7LNGWg9lYF3NNPz8t I/7QkVSjX94U88IDKOVcR+2RT9UTQ2t3T177i4i4fEMrVGA8P7KBblURrLIIQZjzxKI7 MQYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=cx2FcHiO; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.106 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0106.outbound.protection.outlook.com. [104.47.1.106]) by mx.google.com with ESMTPS id q24-v6si5552164qkq.104.2018.05.22.03.07.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 May 2018 03:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.106 as permitted sender) client-ip=104.47.1.106; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=cx2FcHiO; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.106 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:X-MS-Exchange-SenderADCheck; bh=7dWNYWRFXSbvgVyuUtg35zpMAFMGtIRsYuXxkymnYXQ=; b=cx2FcHiOXIyHbUeK7tiYMnjw54ymo8ggFYe63RMmqIihR4WUva0mMhfq1/9xlNuHVJJazcLNVdIDkWkZZ2tBHS7eYIrFHLyx1O5Dqv89ALX8cB4bAJG4PuJOstehe/T1K/htT8NdKRY9HK0Hk56rsHQb6ieqMZCGxI1iaA/gTTs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 10:07:47 +0000 Subject: [PATCH v7 03/17] mm: Assign id to every memcg-aware shrinker 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: Tue, 22 May 2018 13:07:43 +0300 Message-ID: <152698366374.3393.240092291013126670.stgit@localhost.localdomain> In-Reply-To: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> References: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR0201CA0009.eurprd02.prod.outlook.com (2603:10a6:203:3d::19) To HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) 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:HE1PR0801MB1338; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1338; 3:r0HEU/+vYVxnK/taCFJBqKj5Kwz2OtF9SGleUKlyx7ETH64vgj6EET2FMsCNXVW+sJgtBeg8J+tYE7JSqH1S1Y5ycZRR7ROOKLelTcrwg3MEbF0ImyjeMBELRwTeFxiuC26+MvkcNCLehjNHIQHOM+i4+ou1b1JjT+F0EzjAg1kn0T0ZkHQWAUicUi5Y4RVagSCulFPvn/nIx2qywdGv+u2/eLwgPNQ1frN7xwiT+6s8npIvJ/PEtCkDaPX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dO5PIWIIg28pMB4vtiKP6I33npifQqUYcigR1JE2N8erPc9CVwnXXsItXA2riq1TDRgys7ILohjb6t3lnLLHqjOw77Py76gCtYDfosqY+1EV8; 4:dJZUfrSqdvKeGwbQKpmoEUbC0XJJLpwouvqGiOMttfxHkreQAL+E4Ma2HanJK2UPRP9nhT7pOZK4V2Tr80eYXWqxQpN9vovApCxGJXZ1jQdj7IYEgEbfR1ncVOBx9TvtWeRZpFW1k/PnbrccNIUJMsDWHoZbJnw0TUQUgvnrqx9+qEjZKQtNp6A0AapqG6Pz3Lzny1CGESz1wbFP9jcUWq39rMERafgOAx6Tq/aY0gA5yN8AUpFLicAF/APQTmh2kChSP9IOS1VfbOAg75cg1Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB1338; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1338; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(376002)(39850400004)(396003)(366004)(346002)(39380400002)(189003)(199004)(50466002)(105586002)(6116002)(3846002)(81156014)(81166006)(106356001)(68736007)(25786009)(305945005)(6666003)(6636002)(486006)(8676002)(956004)(476003)(7696005)(23676004)(11346002)(52116002)(86362001)(2486003)(446003)(39060400002)(76176011)(9686003)(5660300001)(7736002)(53936002)(103116003)(97736004)(316002)(2906002)(58126008)(33896004)(61506002)(55236004)(7416002)(6506007)(386003)(8936002)(47776003)(478600001)(66066001)(26005)(230700001)(16526019)(55016002)(59450400001)(186003)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1338; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDFNQjEzMzg7MjM6UDczc05LRXB4bmJUTmE1UFR3a3hFN200?= =?utf-8?B?NnE5OTBTa2NONC9qcDgxWnpjTW1PZzJjZE9FbzZPNXpmalFUY2dyVGFwR1g5?= =?utf-8?B?cVhZSUxKYU8rVEZrTE9lazU3MlJzaDBLQmNEbUQ4cUFwWmhDcjNkSWZ5VUl3?= =?utf-8?B?VFpmZGFOMTVyYXMwYzl1TVZ4bnI5NzBNS242YVh3NjFONjB2aGNOY0RFK05i?= =?utf-8?B?WEFoK3F3M3BEeG9kREtYbWRreG1oL1R2YzVuN3crZmZ0amxsem1FQzVBcWdE?= =?utf-8?B?dTlCRXQrZ09CS0NqcEE4cHVNckJ5ZGhlWHZscDRPRHpkcFI3Ky83eXdxWFNm?= =?utf-8?B?VGxDNHdxYmJ4U09qdFdwV0ordmhoNUEwNFc2Z0ZobHFtTWRQb3czTUhXVy9I?= =?utf-8?B?TDJ4ejYxWUJ4RElqSUlRaUZlU2tONFNMaFFQemFoaEJTNmFPeHl1cS9oN1Bn?= =?utf-8?B?VUZtTlZJSmY1MHljMyt0T0FacWdSZk14RE1lL2lpbGpNWUQzbUV4N0pzZFY0?= =?utf-8?B?NEJxck5GNHo1cDkreTlzVU0rM2lsK0h1dStyVEd6UWpleEE0T2NRWWwrUkdE?= =?utf-8?B?c1VoMVQzZVpYbENUdWM5WE5vRisvSEZOeFZZOWxaQjNjNDdXTEd1Z0tLdGNT?= =?utf-8?B?WmVlK1pCRnlKSzVCM0tXMWlibFkyQXNJdHpTdTFLRHNPYXZ6TjI2TDZ3ZWo3?= =?utf-8?B?cHBPVWhMTndKeENzKzBlWEhYbEZNakR3NzQxQXFnK1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bFhCYm9TRGNGbVN2TmtlcnVYK042V21qMUla?= =?utf-8?B?dWo2MXFDRmg1YUx5dUhCTG5BNDI1M2JLYlEzMnIwbTN0R01kK09HYUh4cnU3?= =?utf-8?B?REhGdEhrdnMzWXFPUjBkWmRaRE5nUVJTa2xxQXZoMVREcWtQL2NCemNZUkpq?= =?utf-8?B?MEhkLzR2MUhJelZNUGpFejhRV003dHdXbVdjSDdYY285b3dWQT09?= X-Microsoft-Antispam-Message-Info: uMG32Hoe3II8qIN6bFeBaAciAkZpZDnYQEV9N0MMCLkHA9N+HI7Nq/fYN2u07U4kqG+zLwlUvw/kwB55X540xFRTL/tX4XpOsuGK1xADGNGCFwujpwEJ/qaDRdSHIMYCGMidl/MPsZMjbnAN6gbiHvpqCNKrhk9OKInPNsRNXi4CkfEGk55t2R+tKwGC7qah X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1338; 6:DCUy92rCZwXOUmixVpCC9XwBtR6YjKtXS9KA+7hCLgW//zNLEsLm7VT5pLXTQPYN+MXtKbFszuURaXBU3mU+75+5oIKpenh0fMGWDZNlFVJboPYpvsr1cjPteGGsFW/vniaOlza4d9jCE0CzpjOfX9QryOQT9VQ8cQ/nXKX2Py7VGUzyZuxFWw5mdn3aouAJxwI7sHZkaS4DqcxVK4FZmb6/NYTk82gZHE5DTCTmPVvASTo5mOdak8/HVzwB7hcz31mQUoMTnUvvMsJZCYUfdnICESxI7fbrsxGnPWsnaxw/isfsxBg8v3S1kM8tUYUNLunTTn/biZi1iEfZki0O5N/06uia2LL+QVQfoPDHEgZ7otOqWfLighLpm0AzT9b2bP8ljG6lxq/9dQT9TgaGXQLhSK4MZS7s6tHoykKEJuX6xGiddsSSl/+sLJva7rFjr9hquslnt5zczmavWwxw3A==; 5:m+aIFWvgnerN+r9TTcBGfxOVJWSV21D+On8JcB4/oCAOpI/s8CqBTc+spBSAfrVh4JejF66vLc6aPzG10HwN7Xg4caUj4xN+eoKsIiSK6bEGsbcPVhL/c+jhjqKfvxz1RCCZcH6PuFMCVCp+8I1+JhHSripv9FYnmLxQHS3w0Ts=; 24:xgZdY0LG6pFqGD/pHGgNJZG8UDpMYDGPnqfvL7wQ4guzLi68PEzRaRd67JzU0RvQSacm3VAMpcfy1FPnqZOfoSeCuMjOXjrpbBgpTle+mMw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1338; 7:gxCONSjjmYMMHzohc/MVS443VeKvlzAV6FsqBMTQxImy/2jd0Jzt+y+UJST/X5Uh8EeoCb1wZT+x5mKlpkMrdYlkZ/PGPU+ZCw9aENYRn0AzbouMou3SMte8skDH7v3nIcQJwwSdLcmB0redNyt3yLCWfp7WLctV8YMB0QlCU+MBmi5esiXMKiB3SHjlUOv3vW0QHE57vDfmY+JGlMzDx3HobPn+vrUoLjqE6Ley87mnCQMs1Cc64gh9r+z0mUHh; 20:+f5fDqas9GKdVQTmCr4ndKTCX+rvxxAutRIka1PE7t4cpX0Kcb8PMG9dAe50DvjJCCX6WJouRNU9Rrl3M+J90wKqvZiMFwm8TWRKFMctTk3S6mzrxWcxXxykUY19bWlQyye4WfAMl4qgXh4SDgMEikhsQaGzqXcvLPOAOy3T0JE= X-MS-Office365-Filtering-Correlation-Id: 5b7d3efb-b06f-4276-1272-08d5bfcbdfbd X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 10:07:47.4987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b7d3efb-b06f-4276-1272-08d5bfcbdfbd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1338 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 The patch introduces shrinker::id number, which is used to enumerate memcg-aware shrinkers. The number start from 0, and the code tries to maintain it as small as possible. This will be used as to represent a memcg-aware shrinkers in memcg shrinkers map. Since all memcg-aware shrinkers are based on list_lru, which is per-memcg in case of !CONFIG_MEMCG_KMEM only, the new functionality will be under this config option. Signed-off-by: Kirill Tkhai --- include/linux/shrinker.h | 4 +++ mm/vmscan.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 6794490f25b2..7ca9c18cf130 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -66,6 +66,10 @@ struct shrinker { /* These are for internal use */ struct list_head list; +#ifdef CONFIG_MEMCG_KMEM + /* ID in shrinker_idr */ + int id; +#endif /* objs pending delete, per node */ atomic_long_t *nr_deferred; }; diff --git a/mm/vmscan.c b/mm/vmscan.c index 50055d72f294..75b00e6ff9db 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -169,6 +169,49 @@ unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); static DECLARE_RWSEM(shrinker_rwsem); +#ifdef CONFIG_MEMCG_KMEM +static DEFINE_IDR(shrinker_idr); +static int shrinker_nr_max; + +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + int id, ret = -ENOMEM; + + down_write(&shrinker_rwsem); + id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL); + if (id < 0) + goto unlock; + + if (id >= shrinker_nr_max) + shrinker_nr_max = id + 1; + shrinker->id = id; + ret = 0; +unlock: + up_write(&shrinker_rwsem); + return ret; +} + +static void unregister_memcg_shrinker(struct shrinker *shrinker) +{ + int id = shrinker->id; + + BUG_ON(id < 0); + + down_write(&shrinker_rwsem); + idr_remove(&shrinker_idr, id); + up_write(&shrinker_rwsem); +} +#else /* CONFIG_MEMCG_KMEM */ +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + return 0; +} + +static void unregister_memcg_shrinker(struct shrinker *shrinker) +{ +} +#endif /* CONFIG_MEMCG_KMEM */ + #ifdef CONFIG_MEMCG static bool global_reclaim(struct scan_control *sc) { @@ -313,13 +356,30 @@ int prealloc_shrinker(struct shrinker *shrinker) shrinker->nr_deferred = kzalloc(size, GFP_KERNEL); if (!shrinker->nr_deferred) return -ENOMEM; + + if (shrinker->flags & SHRINKER_MEMCG_AWARE) { + if (prealloc_memcg_shrinker(shrinker)) + goto free_deferred; + } + return 0; + +free_deferred: + kfree(shrinker->nr_deferred); + shrinker->nr_deferred = NULL; + return -ENOMEM; } void free_prealloced_shrinker(struct shrinker *shrinker) { + if (!shrinker->nr_deferred) + return; + kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; + + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + unregister_memcg_shrinker(shrinker); } void register_shrinker_prepared(struct shrinker *shrinker) @@ -347,6 +407,8 @@ void unregister_shrinker(struct shrinker *shrinker) { if (!shrinker->nr_deferred) return; + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + unregister_memcg_shrinker(shrinker); down_write(&shrinker_rwsem); list_del(&shrinker->list); up_write(&shrinker_rwsem);