* [PATCH 1/4] shmem: remove unneeded variable ret
2021-08-12 12:03 [PATCH 0/4] Cleanups for shmem Miaohe Lin
@ 2021-08-12 12:03 ` Miaohe Lin
2021-08-12 12:03 ` [PATCH 2/4] shmem: remove unneeded header file Miaohe Lin
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2021-08-12 12:03 UTC (permalink / raw)
To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe
The local variable ret is always equal to -ENOMEM and never touched. So
remove it and return -ENOMEM directly to simplify the code.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/shmem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 96f05f6af8bb..bf4a47419521 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3631,7 +3631,6 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
struct shmem_options *ctx = fc->fs_private;
struct inode *inode;
struct shmem_sb_info *sbinfo;
- int err = -ENOMEM;
/* Round up to L1_CACHE_BYTES to resist false sharing */
sbinfo = kzalloc(max((int)sizeof(struct shmem_sb_info),
@@ -3709,7 +3708,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
failed:
shmem_put_super(sb);
- return err;
+ return -ENOMEM;
}
static int shmem_get_tree(struct fs_context *fc)
--
2.23.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/4] shmem: remove unneeded header file
2021-08-12 12:03 [PATCH 0/4] Cleanups for shmem Miaohe Lin
2021-08-12 12:03 ` [PATCH 1/4] shmem: remove unneeded variable ret Miaohe Lin
@ 2021-08-12 12:03 ` Miaohe Lin
2021-08-12 12:03 ` [PATCH 3/4] shmem: remove unneeded function forward declaration Miaohe Lin
2021-08-12 12:03 ` [PATCH 4/4] shmem: include header file to declare swap_info Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2021-08-12 12:03 UTC (permalink / raw)
To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe
mfill_atomic_install_pte() is introduced to install pte and update mmu
cache since commit bf6ebd97aba0 ("userfaultfd/shmem: modify
shmem_mfill_atomic_pte to use install_pte()"). So we should remove
tlbflush.h as update_mmu_cache() is not called here now.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/shmem.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index bf4a47419521..41d2900153d9 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -39,8 +39,6 @@
#include <linux/frontswap.h>
#include <linux/fs_parser.h>
-#include <asm/tlbflush.h> /* for arch/microblaze update_mmu_cache() */
-
static struct vfsmount *shm_mnt;
#ifdef CONFIG_SHMEM
--
2.23.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 3/4] shmem: remove unneeded function forward declaration
2021-08-12 12:03 [PATCH 0/4] Cleanups for shmem Miaohe Lin
2021-08-12 12:03 ` [PATCH 1/4] shmem: remove unneeded variable ret Miaohe Lin
2021-08-12 12:03 ` [PATCH 2/4] shmem: remove unneeded header file Miaohe Lin
@ 2021-08-12 12:03 ` Miaohe Lin
2021-08-12 12:03 ` [PATCH 4/4] shmem: include header file to declare swap_info Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2021-08-12 12:03 UTC (permalink / raw)
To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe
The forward declaration for shmem_should_replace_page() and
shmem_replace_page() is unnecessary. Remove them.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/shmem.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 41d2900153d9..ccef5fad0049 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -135,9 +135,6 @@ static unsigned long shmem_default_max_inodes(void)
}
#endif
-static bool shmem_should_replace_page(struct page *page, gfp_t gfp);
-static int shmem_replace_page(struct page **pagep, gfp_t gfp,
- struct shmem_inode_info *info, pgoff_t index);
static int shmem_swapin_page(struct inode *inode, pgoff_t index,
struct page **pagep, enum sgp_type sgp,
gfp_t gfp, struct vm_area_struct *vma,
--
2.23.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] shmem: include header file to declare swap_info
2021-08-12 12:03 [PATCH 0/4] Cleanups for shmem Miaohe Lin
` (2 preceding siblings ...)
2021-08-12 12:03 ` [PATCH 3/4] shmem: remove unneeded function forward declaration Miaohe Lin
@ 2021-08-12 12:03 ` Miaohe Lin
3 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2021-08-12 12:03 UTC (permalink / raw)
To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe
It's bad to extern swap_info[] in .c. Include corresponding header
file instead.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/shmem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index ccef5fad0049..b9cebf074367 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -38,6 +38,7 @@
#include <linux/hugetlb.h>
#include <linux/frontswap.h>
#include <linux/fs_parser.h>
+#include <linux/swapfile.h>
static struct vfsmount *shm_mnt;
@@ -1152,8 +1153,6 @@ static void shmem_evict_inode(struct inode *inode)
clear_inode(inode);
}
-extern struct swap_info_struct *swap_info[];
-
static int shmem_find_swap_entries(struct address_space *mapping,
pgoff_t start, unsigned int nr_entries,
struct page **entries, pgoff_t *indices,
--
2.23.0
^ permalink raw reply [flat|nested] 5+ messages in thread