Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "f2fs: enhance multi-threads performance"

This reports performance regression by Yuanhan Liu.
The basic idea was to reduce one-point mutex, but it turns out this causes
another contention like context swithes.

https://lkml.org/lkml/2015/4/21/11

Until finishing the analysis on this issue, I'd like to revert this for a while.

This reverts commit 78373b7319abdf15050af5b1632c4c8b8b398f33.

+9
+7
fs/f2fs/data.c
··· 1513 1513 { 1514 1514 struct inode *inode = mapping->host; 1515 1515 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 1516 + bool locked = false; 1516 1517 int ret; 1517 1518 long diff; 1518 1519 ··· 1534 1533 1535 1534 diff = nr_pages_to_write(sbi, DATA, wbc); 1536 1535 1536 + if (!S_ISDIR(inode->i_mode)) { 1537 + mutex_lock(&sbi->writepages); 1538 + locked = true; 1539 + } 1537 1540 ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping); 1541 + if (locked) 1542 + mutex_unlock(&sbi->writepages); 1538 1543 1539 1544 f2fs_submit_merged_bio(sbi, DATA, WRITE); 1540 1545
+1
fs/f2fs/f2fs.h
··· 625 625 struct mutex cp_mutex; /* checkpoint procedure lock */ 626 626 struct rw_semaphore cp_rwsem; /* blocking FS operations */ 627 627 struct rw_semaphore node_write; /* locking node writes */ 628 + struct mutex writepages; /* mutex for writepages() */ 628 629 wait_queue_head_t cp_wait; 629 630 630 631 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */
+1
fs/f2fs/super.c
··· 1035 1035 sbi->raw_super = raw_super; 1036 1036 sbi->raw_super_buf = raw_super_buf; 1037 1037 mutex_init(&sbi->gc_mutex); 1038 + mutex_init(&sbi->writepages); 1038 1039 mutex_init(&sbi->cp_mutex); 1039 1040 init_rwsem(&sbi->node_write); 1040 1041 clear_sbi_flag(sbi, SBI_POR_DOING);