Received: by 10.192.165.156 with SMTP id m28csp211588imm; Tue, 17 Apr 2018 08:55:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/undd69x0tc9QD8ETvLNd9tUuO7BZX5ZUO4ZH5dYApRUL3UXtEBiqgNAzOBF3e8QsmXsHn X-Received: by 10.167.131.203 with SMTP id j11mr2499916pfn.101.1523980521872; Tue, 17 Apr 2018 08:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523980521; cv=none; d=google.com; s=arc-20160816; b=oOwLQOy+Ryk7F6EjCkmGr4l8jFtBhvwR0n0mH3kGnFAxZ0sirTOLr8OTtoUKPGJVN8 i1zIRx9lMz4MAvS0jtEK6Xs9bFhr0LjyNC7dLwMmaehfdoGifvz7t4jgn0aesWGC7xq7 kNVwQYk5AcU9QfZUSOTQI7VBMAK1RpqTle+3mDw0e1sgh2fG/FwvpgrV4BlAUEB+Boug 9fjCPVT11ixSkiMyz7iJ62hhSM02RBfKBbefGgAu1i2xvao/GPZia4jfix1JOTQDmkJc 9t58LvHVBmXrdctRHqFOhOthN3HQeNerE1uEN2XYdzh5sBYpuZeVdb2VP+9Fi0Lnmh2t smIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=o6WUavMMLUatrDLSAkC9oMKGUkC8bW5fSjvcvMbRVRQ=; b=CZjpt1azu+Ndup2dtiS263jHu1XRJRPsgoNcO6Ctyyrp+x06g3FrOlISGA/mWlwkZa xRnbLrsrK/qd3gcXbJE4ue0CHS0Swf2cLoMFgubPDss2f7ZjNXlBmCNPVnN3tNTCL5Ur zHBY0l1yLnqFghZV7BV/Aqcb5luFZB9Nf1WeuC7tqG/CqnL5nH9a8KRGKm8IrQZ4NnMg xduG8gl95kvpNDyXyEODqaL2d3j3/oElDi3qzLNs/s50kUILGEhss+T5wwp4xFAIzqHZ 7AyyLIx4OGsZvbpigw8wL7F5ZXVdGizKNXJbZ+QqKF+avM0NTf/15GaWxGs4tJnaRKNT RSRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=X0MmQw+w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si4131582pge.5.2018.04.17.08.55.07; Tue, 17 Apr 2018 08:55:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=X0MmQw+w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753139AbeDQPx3 (ORCPT + 99 others); Tue, 17 Apr 2018 11:53:29 -0400 Received: from mail-db5eur01on0102.outbound.protection.outlook.com ([104.47.2.102]:59063 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752714AbeDQPx1 (ORCPT ); Tue, 17 Apr 2018 11:53:27 -0400 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=o6WUavMMLUatrDLSAkC9oMKGUkC8bW5fSjvcvMbRVRQ=; b=X0MmQw+wXRWw4eTKxcjBvYf5D6GHltI6MpqHcwxiuxGgpre30XVWFdsawrnBWXNLlkLyzO2BtcJoHNNJh4v+3X33CFxZtlViDGPpG+fFX1ad3MdSsnx++R5cGbwnGQCcIAt3OzLIzXBts8wDdhvglhbfrh+6Fv0jCA9Tz8n2hzc= Received: from localhost.localdomain (195.214.232.6) by AM5PR0801MB1332.eurprd08.prod.outlook.com (2603:10a6:203:1f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.12; Tue, 17 Apr 2018 15:53:21 +0000 Subject: [PATCH v2 02/12] memcg: Refactoring in mem_cgroup_alloc() 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, hillf.zj@alibaba-inc.com, 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, 17 Apr 2018 21:53:11 +0300 Message-ID: <152399119121.3456.11227643824792399905.stgit@localhost.localdomain> In-Reply-To: <152397794111.3456.1281420602140818725.stgit@localhost.localdomain> References: <152397794111.3456.1281420602140818725.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P189CA0030.EURP189.PROD.OUTLOOK.COM (2603:10a6:7:53::43) To AM5PR0801MB1332.eurprd08.prod.outlook.com (2603:10a6:203:1f::10) 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:AM5PR0801MB1332; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1332;3:nLKaqvEGDDfsSPKtnCuHxobXXfEX3Xrt0TLC1h6CtXzIBcb7yEgsSjOKlO8amISiHJVFBdVLeWXIS9RGZP9Fo/6iQmKMdZkcOOWJ8fWiawXa3rYHT/MzQPsTF0P5X/WSnzzhI9waL9vB2fgBUckKuwIe0FgJblAlKfkFZOQ/Gz+MLxGrC/k0JOPPaxNTlcN/WdVloa6stRw/wZ4e9YYtPl+5rrUVlTD5TO04o4au4loWgwvc05VlJLFoH2i4RCZp;25:oJabwgYadzTxb28RaoB++iNx7PS3P91V5j1rIp4Dz3UImNe/rZn2yOqZVxr9IdAxQSDX+N2RMl110IB4JbW5lFew1gsr7qf9QU7BdgD18nJ814N+Yy/1G8qSZYcFh2A50L8b3yZyxZIWuQbPgd77SeXDEYrfOLTGYkcsVr4b6hSb4idH1n+HEOPD7w20MEonFFATCx+ciLquI23sGULpNZKqF9FOLyW2UKIVy/b0AIJ6nlYNqNZRV4LhhdNe+eJzOVFfdayWvj9mp6dV51aftxCgx4ZxfMmc8hpbpXqrN1DeVyMVSq7zahtEi6e07cBYjADf00lGu29PpK14BiWEpQ==;31:KKdtvcjovIn6vf41KK6UXo9hlAgWxtObcTluFRQA/D0/WYTvtzSG9xXwa+2kRW3CuaA6If7ytI/KZ+9xzlSsuuOTS2R1jKF5e1hzNCItq2mLMADR2TSBLsYiAvHS8XT+YTXPIgPIkGH7oJtkD7yJD/otiDIyhJZyfxseYRCXtNT/Uw/Cb+DV8zH22Xt8FX9gqk08EJwi8EKGMEoLkfNoGLzZ/BqoQ0rLcrOlKVstu0A= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1332: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1332;20:NVmQGegpu/vOsyFNeddpIYL44CEsohkMjJDvqH2OjzrozwSff0BNDIp+DKADa3P5OC3BjyCnC41ST/NU/cD0d/al0driNExIW3Q9uwouHbJQlz8wZQMNVm17a0nP9tN0zLNRUANfJE2MXzIdPGa7VTUcPQbrlsYfn4+lN6pGiBY5egwiSt7Fh14cA0VEhxLvHWE/CJoBriohgFRN85CObdtacCHjdrH4nr0DdGZa1pdB6mm2j8HUtgslFXzOS7QcQKpRQSa4qrlFhZCiVqab14piL25NvVEs4RZpG1Tnm66SeodewcDbNw+IC1RH66mSrnSLg10vz7SvSwOXPjnQN7lD6EKseRMFVnk53eMucTrQfkTM0o85PKYWfnbIgrvhXoWOMTYlnFKE1kIAVXe2iSgNMlsHgwr0CjwhgjCTK0Gcj9DWB+vtxIm0St3VdF6o1mMFq4zQEWHk/5DDyYsj/q3lHF7qBA0MqWU2xgf3txER+1sVFbs2G09phwvxjlk7;4:rf+g/FHp9mnfUOdP0P2ykhtt8ewzxJdFQL/OF1IOGMAtCztLgOlovwGouWF+2yvB4DihStyN2bYgfvstlSraMtGtTZI5nkHbFkHq/zHpPm4t1sFVXiZJCNTMy0l4zF5pgPueiNHaDI1HvRYUgooyyn9+L28lhUB1qLboLXZQuQsuZpYWLx/4mhmTNF6mD0xK0pb+ITZgqn+kJsmqfyBfGQp4s2oUm7nW5LnvRc5TEA0shJNxYSdpCjwf7/rgfIsNbamYTltUHFqgq5M97mPdEg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231232)(944501359)(52105095)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:AM5PR0801MB1332;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB1332; X-Forefront-PRVS: 0645BEB7AA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(376002)(366004)(396003)(346002)(39380400002)(39850400004)(199004)(189003)(2486003)(81166006)(81156014)(8676002)(11346002)(47776003)(956004)(58126008)(476003)(55236004)(9686003)(50466002)(53936002)(55016002)(68736007)(2906002)(86362001)(446003)(8936002)(6116002)(7696005)(3846002)(76176011)(186003)(16526019)(26005)(486006)(39060400002)(23676004)(66066001)(316002)(33896004)(6506007)(59450400001)(386003)(52116002)(105586002)(6666003)(6636002)(106356001)(230700001)(25786009)(103116003)(478600001)(97736004)(7416002)(7736002)(5660300001)(305945005)(61506002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB1332;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?MTtBTTVQUjA4MDFNQjEzMzI7MjM6RzFuNWZSK3VGN0tWNWFGeTNNRUY3cStG?= =?utf-8?B?a1p1M2hFeFo1SFQzWHZudXU5NGwyd3JEbjJzZFpXSzJXdTMyOE1ldG4wWDhU?= =?utf-8?B?czVJN3hvZXJCTEZYODZheUR4dGVBSVFhdlo3blAraDJ6TzcyR2ZuN0VMTU80?= =?utf-8?B?dGZUcUlQNGNGYzBiZkhFaEg2UlNOV0xjZ2xDaVEvV1YvRmJxNUpFK1ZvaWNa?= =?utf-8?B?eUt0TmdNNWxJYkREQTdiS0E1Z1J3N3BKZzlGTGx4MCtvV0UyMHBMNW9wT0Iz?= =?utf-8?B?ZDJaRFNyVGJSTE1ocXJyOWdhbEZOKzFZOTI1bzZNL0kzWkliS2ZWOSs0S0I4?= =?utf-8?B?TEF1eGpYd0pOdDJqSzcrRW9iSXp3NFh4ZXBSd0lPR1lBeVN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R4MnqN/8i1LJxiOz3KoyI7fRPXXrGAoM09JugKH3I= X-MS-Office365-Filtering-Correlation-Id: 9872b1af-9140-4177-4f79-08d5a47b5980 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2018 15:53:21.5151 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9872b1af-9140-4177-4f79-08d5a47b5980 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1332 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call alloc_mem_cgroup_per_node_info() and IDR allocation later. This is preparation for next patches, which will require this two actions are made nearby (they will be done under read lock, and here we place them together to minimize the time, it's held). Signed-off-by: Kirill Tkhai --- mm/memcontrol.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 448db08d97a0..d99ea5680ffe 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4383,20 +4383,10 @@ static struct mem_cgroup *mem_cgroup_alloc(void) if (!memcg) return NULL; - memcg->id.id = idr_alloc(&mem_cgroup_idr, NULL, - 1, MEM_CGROUP_ID_MAX, - GFP_KERNEL); - if (memcg->id.id < 0) - goto fail; - memcg->stat_cpu = alloc_percpu(struct mem_cgroup_stat_cpu); if (!memcg->stat_cpu) goto fail; - for_each_node(node) - if (alloc_mem_cgroup_per_node_info(memcg, node)) - goto fail; - if (memcg_wb_domain_init(memcg, GFP_KERNEL)) goto fail; @@ -4415,7 +4405,16 @@ static struct mem_cgroup *mem_cgroup_alloc(void) #ifdef CONFIG_CGROUP_WRITEBACK INIT_LIST_HEAD(&memcg->cgwb_list); #endif - idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); + for_each_node(node) + if (alloc_mem_cgroup_per_node_info(memcg, node)) + goto fail; + + memcg->id.id = idr_alloc(&mem_cgroup_idr, memcg, + 1, MEM_CGROUP_ID_MAX, + GFP_KERNEL); + if (memcg->id.id < 0) + goto fail; + return memcg; fail: mem_cgroup_id_remove(memcg);