Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4246700imm; Fri, 18 May 2018 01:43:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqASATgodLt193XNYewyYoSWCvHE0mSUHS16jBDyaerCKMV6QBvTIDKeKdFR5xczfQzaRGW X-Received: by 2002:a63:8c19:: with SMTP id m25-v6mr6633644pgd.178.1526633025202; Fri, 18 May 2018 01:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526633025; cv=none; d=google.com; s=arc-20160816; b=rybfAFFThtv8VTjSQEO58wxue9MhbqhLTeQkkWK7o4D+4CBBEYw6002pUriiQqjPxZ 9dK7QTZEjAzbDPPto0LnvkK72k/HF0+piMpT/46g+gydW83UFi9xkC6yqGnabHWjlGvM sVpDZqYdD4jaNWHypJq3iSnxk6AT9MI+kAzJDfbRlTc27IYbH+yBcsp1sW/JAvjzQ+Sk Fy+fYuGji3SvT2vXUrps2+wHcU2DIUxh8Lvywm2YlOshXS7nNfyq/q9BabAwnHZK7LiN 8ydQoECXCpmR/kyPQz8Y/Ai5SfL8Mx651mlKBClnEDuzEVhnG3RRTDxrLk9JXDF8m9W6 zzmg== 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=b9UPD/IfIGGbOr+M4Lq691D/JgW5ZmeR0yu8brP/nJU=; b=saEWZYXUZ1++KMJX/IrQKF8o6cE5O0h0WfEJDKJ4bXevV/xS1fvPoCh16xoLTacw6Z BhFBdFklyIRvD348jLMUEf2kRp0C8WVtDbD+5gUCZr1LSv8dFmnO2ufBUU3rj8kImcfg CNkL3jGwT2sunGQyHCa91stzOCrDDhUBKZU+ZFhmqltpi5p9N1jz1gO2AiG1ZvvZZfOx Bve720XGqsbupQnkCuKs3R7npLvOMmj8WEuUjzMOIjIHZQDm4xn9PdiE3yVXxNw9BVYY 6S+3HhahQ3Zxz6AalifPh/lWiwCmP32PlGr4cQxT/9ZP1dVyFRmZ92o5PD/ka7Awn++4 4MfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=eRXAPltb; 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 61-v6si7098331plf.63.2018.05.18.01.43.31; Fri, 18 May 2018 01:43:45 -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=eRXAPltb; 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 S1753880AbeERInN (ORCPT + 99 others); Fri, 18 May 2018 04:43:13 -0400 Received: from mail-eopbgr50128.outbound.protection.outlook.com ([40.107.5.128]:17600 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752473AbeERInG (ORCPT ); Fri, 18 May 2018 04:43:06 -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:X-MS-Exchange-SenderADCheck; bh=b9UPD/IfIGGbOr+M4Lq691D/JgW5ZmeR0yu8brP/nJU=; b=eRXAPltb+QKl6DTylNWgbBQCTI2xhDcOiVMasBeLQWu2Kqa00o1/MJ/JYj8HGi+MCUFh+/5RdxfCUUiHEwQ+wdoITx/r7wG5OWuAoB1l4LI3FkGeZrSgWgGWnHm5lKqTCrO4SHi8clMpLKzhuC0Xzh6wy+sF0xO0oP85z92thzE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by DB6PR0801MB1333.eurprd08.prod.outlook.com (2603:10a6:4:a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Fri, 18 May 2018 08:42:59 +0000 Subject: [PATCH v6 07/17] fs: Refactoring in alloc_super() 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: Fri, 18 May 2018 11:42:55 +0300 Message-ID: <152663297580.5308.11314227717473130012.stgit@localhost.localdomain> In-Reply-To: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> References: <152663268383.5308.8660992135988724014.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: HE1PR0501CA0032.eurprd05.prod.outlook.com (2603:10a6:3:1a::42) To DB6PR0801MB1333.eurprd08.prod.outlook.com (2603:10a6:4:a::27) 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:DB6PR0801MB1333; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1333;3:P8FdrBSpb6Rruu3A2kxyUGEEoEKm0kT+8IRqXzOR/NmlDU8bK9fAmzooh5S+f5aLNmVfMMO2orStUWzgUuIONW7RentR/WuFRfsolzOt4h6QMISwEiD7B4I/5KEiq9WvFbnyRexZsrnXlLBu3oq2iuuxvLulUK1gojkQrXAuaMytvCQegRj4dbu72orQOB/yZscLsFkLKkepHvcdMq8/cXD62Zf3SExbrOLSjE/1LW8YlGCkkX07d6taz3XnJyNd;25:jG40VS8GxQdYBoQ2Ukvc9BGC4A8GgHPvcmD3Ke2o8l11rdOTNmo8y5b7oKvHLdGlRhYoSai8+c7VhIhd0eTze5fQd8st4Zxr02wSUdsAZ8uvauWUUaireY2r3nf3RclpVIil2PuDCRVqhuvguozg4mIr+iN8KT8y/3yLLOQvdFZRPSX6TqcU5LKGTJOK0VCu1aCKiYgNONASuJWAQSqcuE5tSxYyRIg14CxYhYgiUgj7tkLT2MBND7LQC7kT02S2uAgF7q+kbII8VRk4ct/mNB/LBgqE4vXodtCVwQenB8pTdO1JOs9Zo1omLkggFScWSyG7nvhoOWeFVzATItZAsw==;31:cm3OlLcr8vgON8uAlUc5yC/DFARukuZwZpysFdR/a1f4E1mOCSsiYGS+NGXDHOfjyYS0gEv1I2sO9cXNPaIwF8Nz6iQEG2B33cNsfOnNn8k7/rKQlun1UHlZeAPPv8LoqQAVDusf1QbBBsfAlqFwASWdSqnhf2Ic6ndx4khGoAXjWqXrKvE6cardI932sRk+MDkVS4AmNO8AnLdQTvdVh6e0xIG7SjjsmHEHE+P3ZMo= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1333: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1333;20:/heoGT4oNFRyPAzbeMQnAVwmZ8nxf473Hue2wqpSnr2wPhIYicDtyMi/SumdJ+/pCRWasPlWunVcGneYlezrcrNufJHFAOW/xhsoHgqnJNi7n/eb1RiQYt7eNa2IJfmvCvgqeSNurXNuMFmkiiVlyaqR+gAlIydCmbPRD7zUY++HrLS3GQ+uq+tNNgotbXe2rhcFaqmIURZhD1SMpPqh0VeUQfGv9MJmje4XBQcVX9krEnsyk8SeN1lvo0BLNkSRjMslbjgSVGXeMKjvgcU43g33SAATvChiE3h5IGMftiIe0z7hPXwREkuiuXNLMF1031M5L6VJ3JhR0eyYjskFUTPRLP4nk8RgwumUZbtytC/gqNY6hqYnRwXluplDY7NBBwWANxB6CDk2VTEnQHmR2/trSXWR77S1Bhk9iyaKsqWOeUuYHiCf05J65e6pvgdu3UehMOzNDfHy10EvRMoTHkUn6t/Omr2g2D1LNaMT7V6IZ9X8HX2TsrgaCPRKc57X;4:SY9RfApNRFgmWDEoDUnq4P1zwfQHwZyqdrP9EU9CHO/10l3NWBf/LxXWM/LDA4rcjU+I6QhQmORW9Pm9m0sNt+HX3mQbm+NJ9t2UYM5/BhIro7Z7SxZBMg4yFBtAYgo5kw/XMs5pvrbmZizVE/l9jYwE60ngly4YXgZ3x3O5Yhe2Fl4rRy5U9yStHmCN9adjXp+MPDIdcrUI7LCh5r7eODg3GVhPFA1Id7sckmqBKIG0gFjTQKw4XcN5cPD81vc7VqmD63OoWOl5VTRxtchsug== 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)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:DB6PR0801MB1333;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB1333; X-Forefront-PRVS: 0676F530A9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(346002)(396003)(376002)(39380400002)(366004)(189003)(199004)(23676004)(2486003)(7696005)(305945005)(316002)(58126008)(47776003)(76176011)(2906002)(68736007)(52116002)(446003)(11346002)(97736004)(3846002)(6666003)(33896004)(25786009)(7736002)(486006)(476003)(6636002)(61506002)(956004)(6116002)(478600001)(8936002)(7416002)(5660300001)(16526019)(230700001)(103116003)(59450400001)(8676002)(386003)(66066001)(9686003)(6506007)(105586002)(186003)(55016002)(106356001)(53936002)(55236004)(81156014)(81166006)(86362001)(39060400002)(50466002)(26005)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB1333;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?MTtEQjZQUjA4MDFNQjEzMzM7MjM6VGFaTFMya1dUcTlrUGpmaVQ5VS93Q0xZ?= =?utf-8?B?UXV5ajNXU0Nkcis4V1FpRy94WjZCNHRCbnJnMXQzUnMvYlo4R0JxZTVBVzJD?= =?utf-8?B?TVU4ZVd1cldZR0MzaFVZTHlkK0FwRXNWaGdpTW5BSW5yZmM0RERhTEJuVlkw?= =?utf-8?B?ajJSaHpUUll5UTlJUGpnQzBmY09iNXB0THZ5blAzVnVqVHFSdnZtL1dzUnFN?= =?utf-8?B?VFhCeVF6c204YlhKMEo2ekZ2cHkrcHVIcFRaYStHVmdIUzBYUWtXNE9FNDlK?= =?utf-8?B?dHZxRzBNYk91RW1DUUVJTmI2M3ZsTWhLSHp5TExuQURKUFhRWTFtNkhvZ3Nz?= =?utf-8?B?cnFGUlhGVjZrakVYUG8zTUEzTVRQTUxqMVBJVkRZb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AztJMu1XRVbEm6M9AvXzIL+xRKHHjBWCqP+k+jDIoctO1LPBkznerbPeA= X-MS-Office365-Filtering-Correlation-Id: dd6c8c97-773f-42e9-14a3-08d5bc9b5d61 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2018 08:42:59.4294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd6c8c97-773f-42e9-14a3-08d5bc9b5d61 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1333 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do two list_lru_init_memcg() calls after prealloc_super(). destroy_unused_super() in fail path is OK with this. Next patch needs such the order. Signed-off-by: Kirill Tkhai --- fs/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/super.c b/fs/super.c index 50728d9c1a05..78227c4ddb21 100644 --- a/fs/super.c +++ b/fs/super.c @@ -244,10 +244,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, INIT_LIST_HEAD(&s->s_inodes_wb); spin_lock_init(&s->s_inode_wblist_lock); - if (list_lru_init_memcg(&s->s_dentry_lru)) - goto fail; - if (list_lru_init_memcg(&s->s_inode_lru)) - goto fail; s->s_count = 1; atomic_set(&s->s_active, 1); mutex_init(&s->s_vfs_rename_mutex); @@ -265,6 +261,10 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE; if (prealloc_shrinker(&s->s_shrink)) goto fail; + if (list_lru_init_memcg(&s->s_dentry_lru)) + goto fail; + if (list_lru_init_memcg(&s->s_inode_lru)) + goto fail; return s; fail: