diff mbox series

[4.9,8/8] ext4: avoid unnecessary stalls in ext4_evict_inode()

Message ID 20191122105253.11375-8-lee.jones@linaro.org
State New
Headers show
Series [4.9,1/8] ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary | expand

Commit Message

Lee Jones Nov. 22, 2019, 10:52 a.m. UTC
From: Jan Kara <jack@suse.cz>


[ Upstream commit 3abb1a0fc2871f2db52199e1748a1d48a54a3427 ]

These days inode reclaim calls evict_inode() only when it has no pages
in the mapping.  In that case it is not necessary to wait for transaction
commit in ext4_evict_inode() as there can be no pages waiting to be
committed.  So avoid unnecessary transaction waiting in that case.

We still have to keep the check for the case where ext4_evict_inode()
gets called from other paths (e.g. umount) where inode still can have
some page cache pages.

Reported-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Jan Kara <jack@suse.cz>

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 fs/ext4/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.24.0

Comments

Sasha Levin Nov. 25, 2019, 1:48 p.m. UTC | #1
On Fri, Nov 22, 2019 at 10:52:53AM +0000, Lee Jones wrote:
>From: Jan Kara <jack@suse.cz>

>

>[ Upstream commit 3abb1a0fc2871f2db52199e1748a1d48a54a3427 ]

>

>These days inode reclaim calls evict_inode() only when it has no pages

>in the mapping.  In that case it is not necessary to wait for transaction

>commit in ext4_evict_inode() as there can be no pages waiting to be

>committed.  So avoid unnecessary transaction waiting in that case.

>

>We still have to keep the check for the case where ext4_evict_inode()

>gets called from other paths (e.g. umount) where inode still can have

>some page cache pages.


This reads to me like an optimization?

-- 
Thanks,
Sasha
Lee Jones Nov. 25, 2019, 2:46 p.m. UTC | #2
On Mon, 25 Nov 2019, Sasha Levin wrote:

> On Fri, Nov 22, 2019 at 10:52:53AM +0000, Lee Jones wrote:

> > From: Jan Kara <jack@suse.cz>

> > 

> > [ Upstream commit 3abb1a0fc2871f2db52199e1748a1d48a54a3427 ]

> > 

> > These days inode reclaim calls evict_inode() only when it has no pages

> > in the mapping.  In that case it is not necessary to wait for transaction

> > commit in ext4_evict_inode() as there can be no pages waiting to be

> > committed.  So avoid unnecessary transaction waiting in that case.

> > 

> > We still have to keep the check for the case where ext4_evict_inode()

> > gets called from other paths (e.g. umount) where inode still can have

> > some page cache pages.

> 

> This reads to me like an optimization?


That's okay. Just don't apply anything that isn't suitable.

I'll try to omit such cases in the future.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
diff mbox series

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a73056e06bde..2ad48d166f32 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -212,7 +212,8 @@  void ext4_evict_inode(struct inode *inode)
 		 */
 		if (inode->i_ino != EXT4_JOURNAL_INO &&
 		    ext4_should_journal_data(inode) &&
-		    (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
+		    (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
+		    inode->i_data.nrpages) {
 			journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
 			tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;