diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-10-20 22:09:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 05:39:35 -0500 |
commit | 725ba1a3ebc49478f76dea369563a79c86546fbd (patch) | |
tree | df27c56644a08dd9f88dcc2f9b45ba6119152b05 /fs | |
parent | 5cc85ef4ffe6c3f1d35b75975c5731248c5af4a7 (diff) |
f2fs: remove percpu_count due to performance regression
commit 35782b233f37e48ecc469d9c7232f3f6a7fad41a upstream.
This patch removes percpu_count usage due to performance regression in iozone.
Fixes: 523be8a6b3 ("f2fs: use percpu_counter for page counters")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/debug.c | 12 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 12 | ||||
-rw-r--r-- | fs/f2fs/super.c | 16 |
3 files changed, 17 insertions, 23 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 1c35e80732e0..687998e9557c 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c | |||
@@ -310,17 +310,17 @@ static int stat_show(struct seq_file *s, void *v) | |||
310 | seq_printf(s, " - Inner Struct Count: tree: %d(%d), node: %d\n", | 310 | seq_printf(s, " - Inner Struct Count: tree: %d(%d), node: %d\n", |
311 | si->ext_tree, si->zombie_tree, si->ext_node); | 311 | si->ext_tree, si->zombie_tree, si->ext_node); |
312 | seq_puts(s, "\nBalancing F2FS Async:\n"); | 312 | seq_puts(s, "\nBalancing F2FS Async:\n"); |
313 | seq_printf(s, " - inmem: %4lld, wb_bios: %4d\n", | 313 | seq_printf(s, " - inmem: %4d, wb_bios: %4d\n", |
314 | si->inmem_pages, si->wb_bios); | 314 | si->inmem_pages, si->wb_bios); |
315 | seq_printf(s, " - nodes: %4lld in %4d\n", | 315 | seq_printf(s, " - nodes: %4d in %4d\n", |
316 | si->ndirty_node, si->node_pages); | 316 | si->ndirty_node, si->node_pages); |
317 | seq_printf(s, " - dents: %4lld in dirs:%4d (%4d)\n", | 317 | seq_printf(s, " - dents: %4d in dirs:%4d (%4d)\n", |
318 | si->ndirty_dent, si->ndirty_dirs, si->ndirty_all); | 318 | si->ndirty_dent, si->ndirty_dirs, si->ndirty_all); |
319 | seq_printf(s, " - datas: %4lld in files:%4d\n", | 319 | seq_printf(s, " - datas: %4d in files:%4d\n", |
320 | si->ndirty_data, si->ndirty_files); | 320 | si->ndirty_data, si->ndirty_files); |
321 | seq_printf(s, " - meta: %4lld in %4d\n", | 321 | seq_printf(s, " - meta: %4d in %4d\n", |
322 | si->ndirty_meta, si->meta_pages); | 322 | si->ndirty_meta, si->meta_pages); |
323 | seq_printf(s, " - imeta: %4lld\n", | 323 | seq_printf(s, " - imeta: %4d\n", |
324 | si->ndirty_imeta); | 324 | si->ndirty_imeta); |
325 | seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n", | 325 | seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n", |
326 | si->dirty_nats, si->nats, si->dirty_sits, si->sits); | 326 | si->dirty_nats, si->nats, si->dirty_sits, si->sits); |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 6dd03115789b..506af456412f 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -819,7 +819,7 @@ struct f2fs_sb_info { | |||
819 | atomic_t nr_wb_bios; /* # of writeback bios */ | 819 | atomic_t nr_wb_bios; /* # of writeback bios */ |
820 | 820 | ||
821 | /* # of pages, see count_type */ | 821 | /* # of pages, see count_type */ |
822 | struct percpu_counter nr_pages[NR_COUNT_TYPE]; | 822 | atomic_t nr_pages[NR_COUNT_TYPE]; |
823 | /* # of allocated blocks */ | 823 | /* # of allocated blocks */ |
824 | struct percpu_counter alloc_valid_block_count; | 824 | struct percpu_counter alloc_valid_block_count; |
825 | 825 | ||
@@ -1233,7 +1233,7 @@ static inline void dec_valid_block_count(struct f2fs_sb_info *sbi, | |||
1233 | 1233 | ||
1234 | static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) | 1234 | static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) |
1235 | { | 1235 | { |
1236 | percpu_counter_inc(&sbi->nr_pages[count_type]); | 1236 | atomic_inc(&sbi->nr_pages[count_type]); |
1237 | 1237 | ||
1238 | if (count_type == F2FS_DIRTY_DATA || count_type == F2FS_INMEM_PAGES) | 1238 | if (count_type == F2FS_DIRTY_DATA || count_type == F2FS_INMEM_PAGES) |
1239 | return; | 1239 | return; |
@@ -1250,7 +1250,7 @@ static inline void inode_inc_dirty_pages(struct inode *inode) | |||
1250 | 1250 | ||
1251 | static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) | 1251 | static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) |
1252 | { | 1252 | { |
1253 | percpu_counter_dec(&sbi->nr_pages[count_type]); | 1253 | atomic_dec(&sbi->nr_pages[count_type]); |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | static inline void inode_dec_dirty_pages(struct inode *inode) | 1256 | static inline void inode_dec_dirty_pages(struct inode *inode) |
@@ -1266,7 +1266,7 @@ static inline void inode_dec_dirty_pages(struct inode *inode) | |||
1266 | 1266 | ||
1267 | static inline s64 get_pages(struct f2fs_sb_info *sbi, int count_type) | 1267 | static inline s64 get_pages(struct f2fs_sb_info *sbi, int count_type) |
1268 | { | 1268 | { |
1269 | return percpu_counter_sum_positive(&sbi->nr_pages[count_type]); | 1269 | return atomic_read(&sbi->nr_pages[count_type]); |
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | static inline int get_dirty_pages(struct inode *inode) | 1272 | static inline int get_dirty_pages(struct inode *inode) |
@@ -2187,8 +2187,8 @@ struct f2fs_stat_info { | |||
2187 | unsigned long long hit_largest, hit_cached, hit_rbtree; | 2187 | unsigned long long hit_largest, hit_cached, hit_rbtree; |
2188 | unsigned long long hit_total, total_ext; | 2188 | unsigned long long hit_total, total_ext; |
2189 | int ext_tree, zombie_tree, ext_node; | 2189 | int ext_tree, zombie_tree, ext_node; |
2190 | s64 ndirty_node, ndirty_dent, ndirty_meta, ndirty_data, ndirty_imeta; | 2190 | int ndirty_node, ndirty_dent, ndirty_meta, ndirty_data, ndirty_imeta; |
2191 | s64 inmem_pages; | 2191 | int inmem_pages; |
2192 | unsigned int ndirty_dirs, ndirty_files, ndirty_all; | 2192 | unsigned int ndirty_dirs, ndirty_files, ndirty_all; |
2193 | int nats, dirty_nats, sits, dirty_sits, fnids; | 2193 | int nats, dirty_nats, sits, dirty_sits, fnids; |
2194 | int total_count, utilization; | 2194 | int total_count, utilization; |
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8021d35df7b0..013c6a541d6b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -688,10 +688,6 @@ static void f2fs_destroy_inode(struct inode *inode) | |||
688 | 688 | ||
689 | static void destroy_percpu_info(struct f2fs_sb_info *sbi) | 689 | static void destroy_percpu_info(struct f2fs_sb_info *sbi) |
690 | { | 690 | { |
691 | int i; | ||
692 | |||
693 | for (i = 0; i < NR_COUNT_TYPE; i++) | ||
694 | percpu_counter_destroy(&sbi->nr_pages[i]); | ||
695 | percpu_counter_destroy(&sbi->alloc_valid_block_count); | 691 | percpu_counter_destroy(&sbi->alloc_valid_block_count); |
696 | percpu_counter_destroy(&sbi->total_valid_inode_count); | 692 | percpu_counter_destroy(&sbi->total_valid_inode_count); |
697 | } | 693 | } |
@@ -1442,6 +1438,7 @@ int sanity_check_ckpt(struct f2fs_sb_info *sbi) | |||
1442 | static void init_sb_info(struct f2fs_sb_info *sbi) | 1438 | static void init_sb_info(struct f2fs_sb_info *sbi) |
1443 | { | 1439 | { |
1444 | struct f2fs_super_block *raw_super = sbi->raw_super; | 1440 | struct f2fs_super_block *raw_super = sbi->raw_super; |
1441 | int i; | ||
1445 | 1442 | ||
1446 | sbi->log_sectors_per_block = | 1443 | sbi->log_sectors_per_block = |
1447 | le32_to_cpu(raw_super->log_sectors_per_block); | 1444 | le32_to_cpu(raw_super->log_sectors_per_block); |
@@ -1466,6 +1463,9 @@ static void init_sb_info(struct f2fs_sb_info *sbi) | |||
1466 | sbi->interval_time[REQ_TIME] = DEF_IDLE_INTERVAL; | 1463 | sbi->interval_time[REQ_TIME] = DEF_IDLE_INTERVAL; |
1467 | clear_sbi_flag(sbi, SBI_NEED_FSCK); | 1464 | clear_sbi_flag(sbi, SBI_NEED_FSCK); |
1468 | 1465 | ||
1466 | for (i = 0; i < NR_COUNT_TYPE; i++) | ||
1467 | atomic_set(&sbi->nr_pages[i], 0); | ||
1468 | |||
1469 | INIT_LIST_HEAD(&sbi->s_list); | 1469 | INIT_LIST_HEAD(&sbi->s_list); |
1470 | mutex_init(&sbi->umount_mutex); | 1470 | mutex_init(&sbi->umount_mutex); |
1471 | mutex_init(&sbi->wio_mutex[NODE]); | 1471 | mutex_init(&sbi->wio_mutex[NODE]); |
@@ -1481,13 +1481,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi) | |||
1481 | 1481 | ||
1482 | static int init_percpu_info(struct f2fs_sb_info *sbi) | 1482 | static int init_percpu_info(struct f2fs_sb_info *sbi) |
1483 | { | 1483 | { |
1484 | int i, err; | 1484 | int err; |
1485 | |||
1486 | for (i = 0; i < NR_COUNT_TYPE; i++) { | ||
1487 | err = percpu_counter_init(&sbi->nr_pages[i], 0, GFP_KERNEL); | ||
1488 | if (err) | ||
1489 | return err; | ||
1490 | } | ||
1491 | 1485 | ||
1492 | err = percpu_counter_init(&sbi->alloc_valid_block_count, 0, GFP_KERNEL); | 1486 | err = percpu_counter_init(&sbi->alloc_valid_block_count, 0, GFP_KERNEL); |
1493 | if (err) | 1487 | if (err) |