From patchwork Tue Aug 7 15:39:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49D3D157D for ; Tue, 7 Aug 2018 15:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 387462A46E for ; Tue, 7 Aug 2018 15:39:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B1132A474; Tue, 7 Aug 2018 15:39:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF5742A46E for ; Tue, 7 Aug 2018 15:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403873AbeHGRy2 (ORCPT ); Tue, 7 Aug 2018 13:54:28 -0400 Received: from mail-eopbgr40095.outbound.protection.outlook.com ([40.107.4.95]:42858 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRy2 (ORCPT ); Tue, 7 Aug 2018 13:54:28 -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=Bg2f3sHd7KK1BJ0cbD1TUjK4ril0zWlzMyWwFzFD/WQ=; b=GPDr44Tnx7Yz3WjoerHJjJryCK0MChpRbchqf77gkUN6D8LAZ2YKv6rmMjRvDX+s+yP6gqFb0zzQuVTzgNkKcwuJM5gKViHBb1W16gePdhvxuzGjJcm53nd932zGwto9XD+SxH0rQsl67Jx0qxCSlZDsQKyEBQVLTw8jTIIGujc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2030.eurprd08.prod.outlook.com (2603:10a6:800:8b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:39:18 +0000 Subject: [PATCH RFC 09/10] shmem: Implement shmem_destroy_super() From: Kirill Tkhai To: akpm@linux-foundation.org, gregkh@linuxfoundation.org, rafael@kernel.org, viro@zeniv.linux.org.uk, darrick.wong@oracle.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, hughd@google.com, shuah@kernel.org, robh@kernel.org, ulf.hansson@linaro.org, aspriel@gmail.com, vivek.gautam@codeaurora.org, robin.murphy@arm.com, joe@perches.com, heikki.krogerus@linux.intel.com, ktkhai@virtuozzo.com, sfr@canb.auug.org.au, vdavydov.dev@gmail.com, mhocko@suse.com, chris@chris-wilson.co.uk, penguin-kernel@I-love.SAKURA.ne.jp, aryabinin@virtuozzo.com, willy@infradead.org, ying.huang@intel.com, shakeelb@google.com, jbacik@fb.com, mingo@kernel.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Date: Tue, 07 Aug 2018 18:39:15 +0300 Message-ID: <153365635538.19074.16684830171993560909.stgit@localhost.localdomain> In-Reply-To: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> References: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR05CA0133.eurprd05.prod.outlook.com (2603:10a6:7:28::20) To VI1PR0801MB2030.eurprd08.prod.outlook.com (2603:10a6:800:8b::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 227d3eae-996b-4c9c-b285-08d5fc7bf261 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2030; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;3:wM4LiZZYmPpTsig59tCi4wpjdUT3odeDnfEGBKsWz5WF4G+bWqsuYLHqY5LdROqkcFI4/bxITEFE8eqytlbvDSM/j7f+vZrh3PZkl1FBy01h6JRqZSsqFEaeTSo1BC3Ne/EkWu0PDcvb5mzWCCRCULqiFne6LwdkE+AkaFAjjyBOBHN9UOr2kxAHHRbGCNxq8Vxk0r7JX/HjTjYtvMNRij6fWZ2zdKgBrMx5kLl/QmEupQjrdCMrqNPa8mZxxSVH;25:bKwWAaq8kv4+WK9LK1WsoYwRa5hmjaUstAATuQElWrLeSV3oPzL4NlCOtev15UvC6y1IVvhSsuJauXx20/fJs8W09m3XmHcRSWNFitn1zKcxvqLpFU6TCPUmwRs7wf3BDBtwmkKwCvg6b4PNamBQsXTbPKbimQC0YTqlDrUKv3I3Mjv3HAw5WnSROWQuHadPxsgkAYWeimHSsO4b6rIPi0uXuF75dkI3CveYvHgKBY1K0w+AqXGGLv72zx73uisr/QEHWbRMiLfF9TqROZr08qaYcAaN98FDI9f72QXOjIkiSXvloJnwWS40BTrYaglzoi7rwaPekEJy0SQFNokBgg==;31:0XRHVd3k1ucJHT9frTCtfMqHM7M7IOGrXmTtgUTlX7wODuhRS/Ixp+yOT4nWM9dqbKRhtg7AWJfEB/WWYssXiPze/U1SgNpZcOytyvyc14UhTQZ4c+gWcUqBSbph46O17f4Gky4mg14r9+i9j9gL76Ipgp077HiQhw9mvB25iOzDuXCo4Lv+Qyeg8OXMTubyWFdQPBQccZ3X3egbE2Pp2nnCsZQBfifa8yuUqDaMSAs= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2030: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;20:CisEgI9gP53Z37pqt/0p/Kzhsp5uuZmrQ4ipO4pQakWazg1uhJvd5glquir24aAP/bUyOjoUX7HwAgnUT6y/3RySkFBWftFcbjVC/phNW9Zs14YzEa/G9UQe2/Hf37MgxISRS7/Lcjt/v6KBfgV/+4z0cJCd4Fmw2YLsZ2zPZoUSUeJBfegF/GOgKHVqjtg4iMQUv5W9M7vmBf5wHf0pVUOOhBTDmgE+IuqOeSUuXKVFE35WGx8NigQ2V81SZVk32WV5nbuofTJaZCm9TpxFxzfYqsXR7xR3CcccbNzkK2JbfLzHunvklO46HSLmDhtPtYVFEAc5Pty1CFdmxnGuHNqfb1l7CjFLKlaFEFcMQxGWlJVsJrY48Cj2vlVDQe5zJgvkqDK0qP8tEmdEwE78eH87jfWIuaX/2CQ4ji//80corYk0zse3+3Tumrl0AXlQDPxSY08DgMQSqn5aYmivLpp/YLzfZgCk5jIPf8NIh9GXhuDWCHSmr4Bo4JNX6/OS;4:CyXEkGdW3NLEa+0spKkEPWDi02O9hEHAVRsFRqJpHhEexH0jTA3S6ON5OoaU3ysPQLvDrabikq4gcyijhN2CIPmH2Jv3EVFZuK4rSFG+VfCgXSLwUeueodHg4Y9Mi6LP8MwPcPV25LADSWEfTIH70LmJWyB/xtO8l5uUJVJktsk0hyy6rjXJh3sUIk9sf2cD/LIfrmelz3rRgTyCdpaHIltQPHnJ+QaF9SZiitJuU+LjqYJZ9Vzczw36XhdpIuPWFGrkhmB5M82YZbYw1zARfQ== 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)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2030;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2030; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(396003)(366004)(346002)(376002)(136003)(189003)(199004)(6506007)(16526019)(386003)(6666003)(7406005)(7416002)(106356001)(105586002)(5660300001)(97736004)(47776003)(66066001)(61506002)(55016002)(9686003)(217873002)(26005)(14444005)(53936002)(39060400002)(956004)(486006)(2906002)(25786009)(11346002)(446003)(186003)(476003)(33896004)(478600001)(50466002)(305945005)(3846002)(6116002)(8936002)(7736002)(81156014)(8676002)(81166006)(230700001)(76176011)(7696005)(52116002)(86362001)(58126008)(316002)(103116003)(68736007)(2486003)(23676004)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2030;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?q?1=3BVI1PR0801MB2030=3B23=3AlbncD?= =?utf-8?q?zHQmJH0AvJwU1jCHfjkPXRK7yPj1G1nDF3EO2tv9q2kLM2WAGeffWyhht0vjBkybh?= =?utf-8?q?7p6fih8HZ9LYo7oD9+HBY0x0UKXHKlk96Z4mTtlElxeGZmqD45pJuZvUbNdb4rY27?= =?utf-8?q?ZB4edh+wwZmq8IhG1KGc4qAguzxyaSzjfA8wn6XGG73qNvUHLJ+b4TJRTrxXLXAYx?= =?utf-8?q?73NgbiBO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8B+RUZrJwOH4aYAWDDQL7E5iwMWkGt/chCHEkoCPocaBixi/2bCkCMgjlrqu5qs38UFiSvxS2Ajf8oDsO3xub3ryTfiYtILVhL9dw==;5:CpQuXvE8xTcsfZ4IMwhl7D5YWXyI1WpzBN5lQRAGn20a1VALOQ3Wq4cXJlIMGEf33thUNPKWwBOTglgZz9RyRNiUmv2YqPvIuMWW62NGrJpos20UZKvES9n9RbDn0WHoVjFpnPUNQRrhbVSk3RKvffe0zrcmUgUTQsCHhSrn2JU=;7:I135MyI5CPpmz/JTWjOuLXG860YuRDmOMpHtmYFHf/2Vvp6x6ZpYkjOjepoXZOWh3CIYOM3drkVj8duRjTOG8FFMmMlgZwP76gYsXX9e2zFe2TI8zCbtWaYvhMuBzIAde9/w5AFhFJB4sXshMUFQXtQZiL4O3ZHTaYfg6Fb0zfxoiUmQHp3US0JLEA5y1iBtgb6i4NCoCSYtjo5DqRNLMhoBaR9XQMcVk2hzZJUi4sY1LZQtXls12Ez5cLETFz9B SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;20:KUpAFL/t1fg1kF2U4kWOfITPEQD3vyA77xqygMc8Z+tO3yueNozCEpcbYEM+qcqBSNlpWHL+1ERWINuak7wEE/oUhVwA0WGGY0zTXAX2iMr3kquf4ERoWG9SCvSAErGzhJSBqLlQ46PNMN3PiADRrn/0YgRWiXgT+JQPZVmUpEc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:39:18.7221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 227d3eae-996b-4c9c-b285-08d5fc7bf261 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2030 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Similar to xfs_fs_destroy_super() implement the method for shmem. shmem_unused_huge_count() just touches sb->s_fs_info. After such the later freeing it will be safe for unregister_shrinker() splitting (which is made in next patch). Signed-off-by: Kirill Tkhai --- mm/shmem.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 4829798869b6..35c65afefbc8 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3427,6 +3427,12 @@ static void shmem_put_super(struct super_block *sb) percpu_counter_destroy(&sbinfo->used_blocks); mpol_put(sbinfo->mpol); +} + +static void shmem_destroy_super(struct super_block *sb) +{ + struct shmem_sb_info *sbinfo = SHMEM_SB(sb); + kfree(sbinfo); sb->s_fs_info = NULL; } @@ -3504,6 +3510,7 @@ int shmem_fill_super(struct super_block *sb, void *data, size_t data_size, failed: shmem_put_super(sb); + shmem_destroy_super(sb); return err; } @@ -3630,6 +3637,7 @@ static const struct super_operations shmem_ops = { .evict_inode = shmem_evict_inode, .drop_inode = generic_delete_inode, .put_super = shmem_put_super, + .destroy_super = shmem_destroy_super, #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE .nr_cached_objects = shmem_unused_huge_count, .free_cached_objects = shmem_unused_huge_scan,