mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchaochina@hotmail.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: shrink unreferenced extent_caches first
Date: Fri, 3 Jul 2015 23:29:17 -0700	[thread overview]
Message-ID: <20150704062917.GD15817@jaegeuk-mac02.hsd1.ca.comcast.net> (raw)
In-Reply-To: <COL402-EAS277B75C19DA375A394DDFCEAB970@phx.gbl>

On Thu, Jul 02, 2015 at 08:39:43PM +0800, Chao Yu wrote:
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Wednesday, July 01, 2015 9:26 AM
> > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > linux-f2fs-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org;
> > linux-fsdevel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> > Cc: Jaegeuk Kim; Jaegeuk Kim
> > Subject: [f2fs-dev] [PATCH 2/2] f2fs: shrink unreferenced extent_caches first
> > 
> > If an extent_tree entry has a zero reference count, we can drop it from the
> > cache in higher priority rather than currently referencing entries.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/data.c | 51 +++++++++++++++++++++++++++++++++++++++++----------
> >  1 file changed, 41 insertions(+), 10 deletions(-)
> > 
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 8f059e0..a0a0e2b 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -661,21 +661,54 @@ unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *sbi, int
> > nr_shrink)
> >  	struct radix_tree_root *root = &sbi->extent_tree_root;
> >  	unsigned int found;
> >  	unsigned int node_cnt = 0, tree_cnt = 0;
> > +	int remained;
> > 
> >  	if (!test_opt(sbi, EXTENT_CACHE))
> >  		return 0;
> > 
> > +	if (!down_write_trylock(&sbi->extent_tree_lock))
> > +		goto out;
> > +
> > +	/* 1. remove unreferenced extent tree */
> 
> We always release extent node and tree from inode with lowest ino,
> why not random ino?

Here what I want to do is to
1. drop unreferenced inodes' extent trees;
   the inodes were already evicted before,
2. drop LRU ordered extent nodes.

You're right. We don't need to drop it having the lowest ino first.
Actually, I was supposed to add an LRU list for extent_trees.
But, do we need to really take care of its order for already evicted inodes?

Here, we should think about two types of hit ratios.
One is for inodes, and the other is for data.
The VFS maintains inode_cache in an LRU order, while its data is cached via
page cache also conrolled by LRU. And, whenever inode is evicted, VFS drops
all the cached data.
So, I believe we should give a higher priority to inodes rather than data.

And, in order to increase the hit ratio, we're trying to keep an extent tree
and its nodes even if its corresponding inode was evicted.
So, I concluded that the dropping order would not be critical especially for
the already evicted inodes.

> 
> And this step releasing breaks the rule of lru runs.
> 
> Some unreferenced file has high hit ratio and some referenced file may
> have low hit ratio. Why not release low hit ratio extent tree at first?

But, still user has opened the referenced file to further access, right?
And, the unreferenced file was evicted by VFS.

Thanks,

  reply	other threads:[~2015-07-04  6:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01  1:25 [PATCH 1/2] f2fs: check the largest extent at look-up time Jaegeuk Kim
2015-07-01  1:25 ` [PATCH 2/2] f2fs: shrink unreferenced extent_caches first Jaegeuk Kim
2015-07-02 12:39   ` [f2fs-dev] " Chao Yu
2015-07-04  6:29     ` Jaegeuk Kim [this message]
2015-07-06 12:25       ` Chao Yu
2015-07-06 22:16         ` Jaegeuk Kim
2015-07-08  9:41           ` Chao Yu
2015-07-10 23:54             ` Jaegeuk Kim
2015-07-11  1:53               ` Chao Yu
2015-07-02 12:38 ` [f2fs-dev] [PATCH 1/2] f2fs: check the largest extent at look-up time Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150704062917.GD15817@jaegeuk-mac02.hsd1.ca.comcast.net \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchaochina@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®