linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Daniel Vetter <daniel@ffwll.ch>, Nadav Amit <namit@vmware.com>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 9/9] zsmalloc: remove the zsmalloc file system
Date: Tue,  9 Mar 2021 16:53:48 +0100	[thread overview]
Message-ID: <20210309155348.974875-10-hch@lst.de> (raw)
In-Reply-To: <20210309155348.974875-1-hch@lst.de>

Just use the generic anon_inode file system.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 mm/zsmalloc.c | 48 +++---------------------------------------------
 1 file changed, 3 insertions(+), 45 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index a6449a2ad861de..a7d2f471935447 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -41,6 +41,7 @@
 #include <linux/slab.h>
 #include <linux/pgtable.h>
 #include <asm/tlbflush.h>
+#include <linux/anon_inodes.h>
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/vmalloc.h>
@@ -176,10 +177,6 @@ struct zs_size_stat {
 static struct dentry *zs_stat_root;
 #endif
 
-#ifdef CONFIG_COMPACTION
-static struct vfsmount *zsmalloc_mnt;
-#endif
-
 /*
  * We assign a page to ZS_ALMOST_EMPTY fullness group when:
  *	n <= N / f, where
@@ -308,8 +305,6 @@ static void kick_deferred_free(struct zs_pool *pool);
 static void init_deferred_free(struct zs_pool *pool);
 static void SetZsPageMovable(struct zs_pool *pool, struct zspage *zspage);
 #else
-static int zsmalloc_mount(void) { return 0; }
-static void zsmalloc_unmount(void) {}
 static int zs_register_migration(struct zs_pool *pool) { return 0; }
 static void zs_unregister_migration(struct zs_pool *pool) {}
 static void migrate_lock_init(struct zspage *zspage) {}
@@ -1751,33 +1746,6 @@ static void lock_zspage(struct zspage *zspage)
 	} while ((page = get_next_page(page)) != NULL);
 }
 
-static int zs_init_fs_context(struct fs_context *fc)
-{
-	return init_pseudo(fc, ZSMALLOC_MAGIC) ? 0 : -ENOMEM;
-}
-
-static struct file_system_type zsmalloc_fs = {
-	.name		= "zsmalloc",
-	.init_fs_context = zs_init_fs_context,
-	.kill_sb	= kill_anon_super,
-};
-
-static int zsmalloc_mount(void)
-{
-	int ret = 0;
-
-	zsmalloc_mnt = kern_mount(&zsmalloc_fs);
-	if (IS_ERR(zsmalloc_mnt))
-		ret = PTR_ERR(zsmalloc_mnt);
-
-	return ret;
-}
-
-static void zsmalloc_unmount(void)
-{
-	kern_unmount(zsmalloc_mnt);
-}
-
 static void migrate_lock_init(struct zspage *zspage)
 {
 	rwlock_init(&zspage->lock);
@@ -2086,7 +2054,7 @@ static const struct address_space_operations zsmalloc_aops = {
 
 static int zs_register_migration(struct zs_pool *pool)
 {
-	pool->inode = alloc_anon_inode_sb(zsmalloc_mnt->mnt_sb);
+	pool->inode = alloc_anon_inode();
 	if (IS_ERR(pool->inode)) {
 		pool->inode = NULL;
 		return 1;
@@ -2506,14 +2474,10 @@ static int __init zs_init(void)
 {
 	int ret;
 
-	ret = zsmalloc_mount();
-	if (ret)
-		goto out;
-
 	ret = cpuhp_setup_state(CPUHP_MM_ZS_PREPARE, "mm/zsmalloc:prepare",
 				zs_cpu_prepare, zs_cpu_dead);
 	if (ret)
-		goto hp_setup_fail;
+		return ret;
 
 #ifdef CONFIG_ZPOOL
 	zpool_register_driver(&zs_zpool_driver);
@@ -2522,11 +2486,6 @@ static int __init zs_init(void)
 	zs_stat_init();
 
 	return 0;
-
-hp_setup_fail:
-	zsmalloc_unmount();
-out:
-	return ret;
 }
 
 static void __exit zs_exit(void)
@@ -2534,7 +2493,6 @@ static void __exit zs_exit(void)
 #ifdef CONFIG_ZPOOL
 	zpool_unregister_driver(&zs_zpool_driver);
 #endif
-	zsmalloc_unmount();
 	cpuhp_remove_state(CPUHP_MM_ZS_PREPARE);
 
 	zs_stat_exit();
-- 
2.30.1



  parent reply	other threads:[~2021-03-09 15:57 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 15:53 make alloc_anon_inode more useful Christoph Hellwig
2021-03-09 15:53 ` [PATCH 1/9] fs: rename alloc_anon_inode to alloc_anon_inode_sb Christoph Hellwig
2021-03-09 16:21   ` David Hildenbrand
2021-03-09 19:33   ` Gao Xiang
2021-03-10  6:39   ` Minchan Kim
2021-03-10  8:30     ` Christoph Hellwig
2021-03-10  9:33   ` Christian Brauner
2021-03-09 15:53 ` [PATCH 2/9] fs: add an argument-less alloc_anon_inode Christoph Hellwig
2021-03-09 16:22   ` David Hildenbrand
2021-03-09 19:34   ` Gao Xiang
2021-03-10  9:35   ` Christian Brauner
2021-03-09 15:53 ` [PATCH 3/9] powerpc/pseries: remove the ppc-cmm file system Christoph Hellwig
2021-03-09 16:26   ` David Hildenbrand
2021-03-09 16:30   ` Jason Gunthorpe
2021-03-10 16:29   ` Al Viro
2021-03-11  8:42     ` Christoph Hellwig
2021-03-09 15:53 ` [PATCH 4/9] drm: remove the drm " Christoph Hellwig
2021-03-10 16:32   ` Al Viro
2021-03-11  8:35     ` Christoph Hellwig
2021-03-09 15:53 ` [PATCH 5/9] vmw_balloon: remove the balloon-vmware " Christoph Hellwig
2021-03-09 16:28   ` David Hildenbrand
2021-03-09 15:53 ` [PATCH 6/9] virtio_balloon: remove the balloon-kvm " Christoph Hellwig
2021-03-09 16:29   ` David Hildenbrand
2021-03-09 15:53 ` [PATCH 7/9] iomem: remove the iomem " Christoph Hellwig
2021-03-14 13:55   ` [iomem] e14497b88f: BUG:KASAN:null-ptr-deref_in_alloc_anon_inode kernel test robot
2021-03-09 15:53 ` [PATCH 8/9] z3fold: remove the z3fold file system Christoph Hellwig
2021-03-09 15:53 ` Christoph Hellwig [this message]
2021-03-10  6:44   ` [PATCH 9/9] zsmalloc: remove the zsmalloc " Minchan Kim
2021-03-09 16:54 ` make alloc_anon_inode more useful Jason Gunthorpe
2021-03-10  8:32   ` Christoph Hellwig
2021-03-10  4:05 ` Matthew Wilcox
2021-03-10  8:37   ` Christoph Hellwig
2023-02-03  9:49 ` Jingbo Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210309155348.974875-10-hch@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=david@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=minchan@kernel.org \
    --cc=mst@redhat.com \
    --cc=namit@vmware.com \
    --cc=ngupta@vflare.org \
    --cc=pv-drivers@vmware.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).