* Patch "Revert "f2fs: use percpu_counter for # of dirty pages in inode"" has been added to the 4.8-stable tree
@ 2017-01-04 10:07 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-01-04 10:07 UTC (permalink / raw)
To: jaegeuk, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
Revert "f2fs: use percpu_counter for # of dirty pages in inode"
to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
revert-f2fs-use-percpu_counter-for-of-dirty-pages-in-inode.patch
and it can be found in the queue-4.8 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From 204706c7accfabb67b97eef9f9a28361b6201199 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Fri, 2 Dec 2016 15:11:32 -0800
Subject: Revert "f2fs: use percpu_counter for # of dirty pages in inode"
From: Jaegeuk Kim <jaegeuk@kernel.org>
commit 204706c7accfabb67b97eef9f9a28361b6201199 upstream.
This reverts commit 1beba1b3a953107c3ff5448ab4e4297db4619c76.
The perpcu_counter doesn't provide atomicity in single core and consume more
DRAM. That incurs fs_mark test failure due to ENOMEM.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/f2fs/f2fs.h | 10 +++++-----
fs/f2fs/file.c | 2 +-
fs/f2fs/super.c | 7 +------
3 files changed, 7 insertions(+), 12 deletions(-)
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -451,7 +451,7 @@ struct f2fs_inode_info {
/* Use below internally in f2fs*/
unsigned long flags; /* use to pass per-file flags */
struct rw_semaphore i_sem; /* protect fi info */
- struct percpu_counter dirty_pages; /* # of dirty pages */
+ atomic_t dirty_pages; /* # of dirty pages */
f2fs_hash_t chash; /* hash value of given file name */
unsigned int clevel; /* maximum level of given file name */
nid_t i_xattr_nid; /* node id that contains xattrs */
@@ -1198,7 +1198,7 @@ static inline void inc_page_count(struct
static inline void inode_inc_dirty_pages(struct inode *inode)
{
- percpu_counter_inc(&F2FS_I(inode)->dirty_pages);
+ atomic_inc(&F2FS_I(inode)->dirty_pages);
inc_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ?
F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA);
}
@@ -1214,7 +1214,7 @@ static inline void inode_dec_dirty_pages
!S_ISLNK(inode->i_mode))
return;
- percpu_counter_dec(&F2FS_I(inode)->dirty_pages);
+ atomic_dec(&F2FS_I(inode)->dirty_pages);
dec_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ?
F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA);
}
@@ -1224,9 +1224,9 @@ static inline s64 get_pages(struct f2fs_
return percpu_counter_sum_positive(&sbi->nr_pages[count_type]);
}
-static inline s64 get_dirty_pages(struct inode *inode)
+static inline int get_dirty_pages(struct inode *inode)
{
- return percpu_counter_sum_positive(&F2FS_I(inode)->dirty_pages);
+ return atomic_read(&F2FS_I(inode)->dirty_pages);
}
static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type)
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1529,7 +1529,7 @@ static int f2fs_ioc_start_atomic_write(s
goto out;
f2fs_msg(F2FS_I_SB(inode)->sb, KERN_WARNING,
- "Unexpected flush for atomic writes: ino=%lu, npages=%lld",
+ "Unexpected flush for atomic writes: ino=%lu, npages=%u",
inode->i_ino, get_dirty_pages(inode));
ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
if (ret)
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -565,13 +565,9 @@ static struct inode *f2fs_alloc_inode(st
init_once((void *) fi);
- if (percpu_counter_init(&fi->dirty_pages, 0, GFP_NOFS)) {
- kmem_cache_free(f2fs_inode_cachep, fi);
- return NULL;
- }
-
/* Initialize f2fs-specific inode info */
fi->vfs_inode.i_version = 1;
+ atomic_set(&fi->dirty_pages, 0);
fi->i_current_depth = 1;
fi->i_advise = 0;
init_rwsem(&fi->i_sem);
@@ -694,7 +690,6 @@ static void f2fs_i_callback(struct rcu_h
static void f2fs_destroy_inode(struct inode *inode)
{
- percpu_counter_destroy(&F2FS_I(inode)->dirty_pages);
call_rcu(&inode->i_rcu, f2fs_i_callback);
}
Patches currently in stable-queue which might be from jaegeuk@kernel.org are
queue-4.8/f2fs-fix-overflow-due-to-condition-check-order.patch
queue-4.8/revert-f2fs-use-percpu_counter-for-of-dirty-pages-in-inode.patch
queue-4.8/f2fs-set-owner-for-debugfs-status-file-s-file_operations.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-04 10:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 10:07 Patch "Revert "f2fs: use percpu_counter for # of dirty pages in inode"" has been added to the 4.8-stable tree gregkh
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).