From patchwork Tue Jul 3 15:09:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10504303 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 87ACF60325 for ; Tue, 3 Jul 2018 15:09:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73B8228AAF for ; Tue, 3 Jul 2018 15:09:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67E1728ACB; Tue, 3 Jul 2018 15:09:21 +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 C2B5E28AAF for ; Tue, 3 Jul 2018 15:09:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86FED6B0277; Tue, 3 Jul 2018 11:09:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 846026B0278; Tue, 3 Jul 2018 11:09:19 -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 719046B0279; Tue, 3 Jul 2018 11:09:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 20F716B0277 for ; Tue, 3 Jul 2018 11:09:19 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id v3-v6so1186188pfd.18 for ; Tue, 03 Jul 2018 08:09:19 -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=6twuSk8r54M+02pUaRUjI0X54DIwFiSuG+9u4VtMQs4=; b=ZHILPrLehvGkLlbg3lSL8RMVy46Qi/Da73AdQAz1Rs/177L8yscjC5MTxU3DQRxr2f U7fawOt3hqRGcy/w8xxgFzvg3umx7mhJ2E8FbPBniXDoDgtf8klI8OQNdEZc0GsAANoQ TDq0XCgZiZBrQJyClttVoZKEGGZ6cg12TMxEJclg0LqBWa1kZu/+r8AhXLeC0THaW1OK Y/vtA/iLNDVxA9gV2XUf5Z1lD5pi38mNOi8AtCKuYiuBc6zfjU/QzHlg/ljh0M0P+0s3 xVBw6q8p1I/oNaM67zE6Tp0Rozx1izS0DVhzOF0C5CjDSChlNq965So7NeSFERIQ05lB rWZA== X-Gm-Message-State: APt69E0HgFgXCO3pKi46vxFsKNitDsI8rAjJJPcF05idVZr17I14Ts51 RoCF5QwT414/Y+lE2zSNcWpMZsC4EH0GhN8arGeUcZco4Pw6dUw0pQ4YxEvK2/KhMSefnGoZf9n fenZWJB/y3sPmfyAPSEAe8YO6lRGCz3oODcCrnHNl2kWsemG62fCW/DWUsXFIjWgLUA== X-Received: by 2002:a17:902:b717:: with SMTP id d23-v6mr4723856pls.105.1530630558818; Tue, 03 Jul 2018 08:09:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd+XBdVGUQq5EQHrebYMBsDw1RoEVFCLAlR1dJWA+0rF6u0ufYM+G6g44ZklHiZa0ch0/Ob X-Received: by 2002:a17:902:b717:: with SMTP id d23-v6mr4723791pls.105.1530630557673; Tue, 03 Jul 2018 08:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530630557; cv=none; d=google.com; s=arc-20160816; b=mGyt58CJhUPdFTi1sP5cf1uXDlFIdgfs5U+uaaX0GSbYth97IcgmibnQTiSaETbCdR Hs1S06oHTDUoUN2Oa+AtOCeBvKz+ClCDFUG8qNfhx7B2RbOqplRkQ3XkEWd1Ju/pLGHe 5vCOlTBPpTJMm1+HgZMJZC2lovjSgz7Pnm2S8LoEzEJv5QeqQD7RHvslevGmemmtL28x Qlffvfgbd/PoTYUMl3ha0IJOUeb8rFfJLdgTZVcMmC5U8t7WAYlkrSmawYvCwW3Q6Ae0 sYAP1U7UXs78rCwOlrlNAH6HWBVKKgkT0HmiCoNQSFl8oEXBBuSUPCY/AxYxmHRvDauK 5A+Q== 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=6twuSk8r54M+02pUaRUjI0X54DIwFiSuG+9u4VtMQs4=; b=brhdXuSei7cMk/RB8RlEFubKX6rHv6CCc/joFU0u3s1lye+8Er821g1q7y6X/2wVF5 2BZlzxaGjxmrDXz9kZZIIvj7/A9gzay+im15QK7tPya7gj5FPFeG9Tdf5drV28smFC0M PzHB5rtqaGqiaqhszLkZ1oRz8bm9AjtuWi8I1FOp7DI1P3l1FuR+I5Ebda7yrzIlFPXp Nrtixhk4bQaukZio7pB1veLLg6HwTGfTGy0d0jdNlhP5InuVmkVQhNEWz/QzdKx69j1I 8Klw/3mmy7+w97VTPnyUgRBiuUtIqidFuwHbwa50vFjKRb6ICbONjbW+1cxac8vUuwYy iPQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=aEV+JvWF; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.137 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-ve1eur01on0137.outbound.protection.outlook.com. [104.47.1.137]) by mx.google.com with ESMTPS id v6-v6si1317450ply.300.2018.07.03.08.09.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jul 2018 08:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.137 as permitted sender) client-ip=104.47.1.137; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=aEV+JvWF; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.137 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=6twuSk8r54M+02pUaRUjI0X54DIwFiSuG+9u4VtMQs4=; b=aEV+JvWFtdFMUSD1pfPdbsphtEyJlQiS+UzSO14TzG7wbCd/PdbNOlhV5Bj3zhb7dEdWZy9wIz8SQfdYr0jYLetyd5fEm3fY+C+5srbIYjqtyZH6PCw2ntQkafdE33262GmM6zrRg/whyAF6SWTpWfMAfcgSEFNKjIPOH/N+7Nc= Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB1340.eurprd08.prod.outlook.com (2603:10a6:3:3a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.23; Tue, 3 Jul 2018 15:09:09 +0000 Subject: [PATCH v8 03/17] mm: Assign id to every memcg-aware shrinker From: Kirill Tkhai To: vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, 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, akpm@linux-foundation.org, ktkhai@virtuozzo.com Date: Tue, 03 Jul 2018 18:09:05 +0300 Message-ID: <153063054586.1818.6041047871606697364.stgit@localhost.localdomain> In-Reply-To: <153063036670.1818.16010062622751502.stgit@localhost.localdomain> References: <153063036670.1818.16010062622751502.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0701CA0066.eurprd07.prod.outlook.com (2603:10a6:3:9e::34) To HE1PR0801MB1340.eurprd08.prod.outlook.com (2603:10a6:3:3a::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aaa1c4bf-fc40-40a5-b486-08d5e0f6ee9b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1340; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1340; 3:kbHC/V07Hj218VMtq0+TEjRA2ecWAmoR/iRbu5IjwqzG/9gMK2bMmd6GnP+naaLQxpnaiz8t2WtPUrIg31N3fjmLg/uSgnVvyMOMwid8wKDo1klxQhPVUhuc8fYYp97yPVZI4uGBJV09II1BWjoRZvW9Uz5mHfJoE31IJdIs5vzEhfSn3L0BzEQZfthZqdyFR8R+TJwUKpyuJl3+91LmeWigaRuYMdLecmppNKawp6K8KYZAmUA0X/l9sCRTkmDa; 25:Nhf9fvYbI3YTIDNt01zRa62SiUsvb8ocfF9ElCFwPGctR9Epo2cg1Qhy07rDT635pOaubMJLBlEkDF+1Ey5vwZfAYZn/xrFMTgqx1phg4CEJbWxzQ6E3OGqZM046i+AeE1E/Dt7yok65fOrp8+cpsTk13Jrcz7TtL9Uclq+eHSNg0DYKf6Bsiugmf59J4vmJyXyDsKvPgVGgQiSvIF8eTZ642sIjq1e+YFxvlG5201/OgBuvxL8kzUV4ACTuHaXkJLO2qoKCoOHjz+2WscDwZcaGk2C2BihcspfPWn4MFqKJdTsP5x6o/dkjGOJH3nEnB+FYPkubUfSWa4ae7mRRvw==; 31:pR7n35X77UzpBPYJSrPjANsfj5YQ7z93eHKGv41A+xh4pjuwKBs1g1Mjq4c2HV2Tq4vZFxfkjPKqAG7AXyf6C+ck6/dAIaEYSphg4MAe406neEnYM4hNEKXh78oq/S4QRGYOkhhPqOjR/R/91pWK5ezf2T+DbQwMpCJl6pj+ZPtt2db6HVd/PKgFucRa7LSPwClhxBgBBgMsV+ruCGtxzugkicq2JUQpM1dvNokrPZI= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1340: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1340; 20:zVvTilWeO+GYWwbRPx4FVE7SD/0ETfr8uh6/Lvvecfts0oWeShvJwyT/a7aiHxRtHJiGyKsuv9shtmPTMuKT+rTtAFMy50te26w39h39WJwy/+f2AMfa1Xjp4EHUEXsxO5GyFRqAjWEyw9OZ69cBQC+4sPEmEXRdiX5j6OdBqBtZaLfX0R9TxledjVsVvSwAO1eMdZZtvVJ3VUA2HrlfCcYTc7We1rl1i3os3HJ7HnY11d/3sio1usaubGW2fPptuJsjovXr1Pzj4i8wWdyQlgK0FUQu5KRlMfS9k/oN1lhzGEUwD3/unJTLbYbmhDViN+1srgKg1qOyBGw1YzU00i97ExMrPH5f0ntwv7d3IIJEG1+o0OqPNOFSGTAKGKeOYK1o9T0LKJd8vPPP87S9C022WYgtWHEuDMGFFRNYlSyICuGHBuDEdlDhiu7xxTwM7bnEsZsyNo0MfdLGDpAigK/C04JX9I06WM99hrynDG0RCuHF/H9fSZtO1sEjMPAf; 4:krJTLUkOOgX5kSjTIYIKFkXzvM69g/oguGaSLkaHRUImJGfBqWl1T6A6OE4SYjnSAnkKAwkUnH0gPMsbPROklr9F8cF5bqRqpwL874tQTwAGi/TpdpkDXK/y3fZVryDDHuuI/98H2STsT5R5J84i71YGJdtdeJeBC/XAzF1KRjoXr8IfWYiZs7tipxAKtMqzAG9fguTJF2Lvdv16cYdIrQbXYeRY0aZVqRL4WOiBYRhflrh+t15P85laweJq1vw7ZH4jq2WDYiwKr8voyr5pvER0TCM5UI+hhB77OKw8/RgEjv9o5pS37U9W2XHkgZJL2EQjusl5DWlElp+qCRY3gSFMM5zwG4AZaDMpxiglapvxvPtCt+V3x1DRnC4Hr3uk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(211936372134217)(153496737603132); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB1340; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1340; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39850400004)(396003)(366004)(136003)(346002)(376002)(199004)(189003)(103116003)(6506007)(50466002)(956004)(5660300001)(486006)(105586002)(61506002)(14444005)(11346002)(3846002)(6116002)(53936002)(68736007)(55016002)(26005)(9686003)(476003)(386003)(7416002)(16526019)(446003)(7736002)(2486003)(58126008)(52116002)(316002)(23676004)(25786009)(97736004)(81156014)(8676002)(81166006)(186003)(2906002)(106356001)(76176011)(66066001)(47776003)(6666003)(230700001)(33896004)(8936002)(7696005)(39060400002)(478600001)(86362001)(305945005)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1340; 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?MTtIRTFQUjA4MDFNQjEzNDA7MjM6RDZrV1ZiWnhDOHdwaUdZQXBaeFd0dGll?= =?utf-8?B?SE5sVUtrRnBweFc3c01OKzdwN1FpVjhvYTJxY0VWOFVOcVZlYm01VlljWGhV?= =?utf-8?B?eXEvUWpiMmxRZG55YmxrcDNMcHdLL0c3aG5TS3FGM1grSHluKzZPbTVIeFJr?= =?utf-8?B?WjNCTWxBcWo0UnNYWXkvSksrMHUwNktTbzNCRi8zNlZ6UnhsdERMTzc0ZE9G?= =?utf-8?B?enhDYlZ0VThqVHFDNEo4dlMwQS9FOVU1TXNSOEd2UmJIbjh3TU1ud0VoZVVQ?= =?utf-8?B?UWFXUFVScFBEdFMxWmhYeUhNOHRVRGtUZyswM0o3MVhjcVREQlhNUE5sNjA0?= =?utf-8?B?SWhTblpnQ25hZy9vVG0wS28xSUd0d3BKZU9nTDBTOGR2bGYwVEZoMnZPWjNz?= =?utf-8?B?NnN4NXJkVmhjMjZ1ZVl5UjF3ZStkMWxQREdYM2ErTFhSVXVEWEozOEVwdytr?= =?utf-8?B?R096eERjaTg1TnNiUkxpTUxWRUhCb3dRclBHN25EN1B5RXZSL3BkbWRhZk5V?= =?utf-8?B?c1dCdXFqd0tMTkN1TnRZZmRTOTNjcG5iU0FUa1JFRmdZTWFreVNMM0o1NStQ?= =?utf-8?B?Ym1mZ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lGdYJ+pAJ5FkHyW+jwm6R8hQMzfjtzwhB4arCZeaAZqoS1RVf5TOGMrx7/mjPlYul8ts8xhnjIB9QwVwzz788gLYJAHvSRM/BUjzts5CKpuRkmHilTJQ4JdwkUnbI9EmYgggBQekSQ==; 5:doJp25AU/7ytveZwk8PDZETzwEwnTnrhjsMlUa2UMzBiMBWOHtGuNOQNOazqMVQd8jywUp7wzipxU9ZgCvlRWh30SEBysH8UcoR6RvfjORF/l9pmNCc2p9T5pHDytfsy35FyDv4WsArvg0gSga10mIanEl8oZJO4u7nKZa9Akwg=; 24:yBylMoWJSDgRWtDXOdQ6Mqyhg+Q6CTPyS+SK6koiGjmxMsz/+cwXlxDcySXUwtUmyuO1e+kzCVIdwrAmFACFAj03ap50Wxw0UFzDFVJUwqY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1340; 7:qaGKmnYarOR/wokuwVWYyo8wz2in6sVFR2HoIn67OWhNGMzE7BRgeVsfFX1nWUnP8OzkjzIEnTaXHK51K5Va2Ont52GrDG/OhXgvTpvk+08nHVrbvPBR1XdWjcidqJfJpVoGoFMa5xvhANGHyFBpEnKnwPx0W/Um+Y01s44Ly5vAAKGOBHo5aiLBnZowkeUNBzJT9LN0OFeQdF9KjGNGE6HEB2TVMIiOIImHAdeMiIhhUjh95Sv+Yzjb9xc+8/jH; 20:sMt5z3Cx3zIn70wsBIOg2njWA06h9Z/TELM9JuUXeQL4IGgfSMrPX7TrqdYpr/M0FD4JXgTwHKO/JNOQgEgrDGyJXnVScitkK5hVna/MZ/yPsvO/Djp9nTHuhSa/ij5dSn6xc8SwAY/lysi3fSuF/mc5T3QvjTigqTXKTKlUtcc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 15:09:09.8300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aaa1c4bf-fc40-40a5-b486-08d5e0f6ee9b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1340 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 Acked-by: Vladimir Davydov Tested-by: Shakeel Butt --- 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 8d2ffae4db28..f9ca6b57d72f 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);