From: Theodore Ts'o <tytso@mit.edu>
To: Dave Hansen <dave.hansen@intel.com>,
linux-ext4@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Jan kara <jack@suse.cz>
Subject: Re: ext4 extent status tree LRU locking
Date: Mon, 17 Jun 2013 22:47:27 -0400 [thread overview]
Message-ID: <20130618024727.GA24479@thunk.org> (raw)
In-Reply-To: <20130617101033.GA17828@gmail.com>
> Subject: [PATCH v2] ext4: improve extent cache shrink mechanism to avoid to burn CPU time
>
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> Now we maintain an proper in-order LRU list in ext4 to reclaim entries
> from extent status tree when we are under heavy memory pressure. For
> keeping this order, a spin lock is used to protect this list. But this
> lock burns a lot of CPU time. We can use the following steps to trigger
> it.
>
> % cd /dev/shm
> % dd if=/dev/zero of=ext4-img bs=1M count=2k
> % mkfs.ext4 ext4-img
> % mount -t ext4 -o loop ext4-img /mnt
> % cd /mnt
> % for ((i=0;i<160;i++)); do truncate -s 64g $i; done
> % for ((i=0;i<160;i++)); do cp $i /dev/null &; done
> % perf record -a -g
> % perf report
>
> This commit tries to fix this problem. Now a new member called
> i_touch_when is added into ext4_inode_info to record the last access
> time for an inode. Meanwhile we never need to keep a proper in-order
> LRU list. So this can avoid to burns some CPU time. When we try to
> reclaim some entries from extent status tree, we use list_sort() to get
> a proper in-order list. Then we traverse this list to discard some
> entries. In ext4_sb_info, we use s_es_last_sorted to record the last
> time of sorting this list. When we traverse the list, we skip the inode
> that is newer than this time, and move this inode to the tail of LRU
> list. When the head of the list is newer than s_es_last_sorted, we will
> sort the LRU list again.
>
> In this commit, we break the loop if s_extent_cache_cnt == 0 because
> that means that all extents in extent status tree have been reclaimed.
>
> Meanwhile in this commit, ext4_es_{un}register_shrinker()'s prototype is
> changed to save a local variable in these functions.
>
> Reported-by: Dave Hansen <dave.hansen@intel.com>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Applied, thanks.
- Ted
next prev parent reply other threads:[~2013-06-18 2:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-11 23:22 ext4 extent status tree LRU locking Dave Hansen
2013-06-12 7:17 ` Zheng Liu
2013-06-12 15:09 ` Dave Hansen
2013-06-12 16:03 ` Zheng Liu
2013-06-12 17:52 ` Dave Hansen
2013-06-12 20:48 ` Theodore Ts'o
2013-06-13 13:27 ` Zheng Liu
2013-06-13 13:35 ` Theodore Ts'o
2013-06-14 3:27 ` Zheng Liu
2013-06-14 14:09 ` Zheng Liu
2013-06-14 14:02 ` Theodore Ts'o
2013-06-14 17:00 ` Zheng Liu
2013-06-14 18:00 ` Theodore Ts'o
2013-06-17 10:10 ` Zheng Liu
2013-06-17 21:12 ` Dave Hansen
2013-06-18 2:25 ` Zheng Liu
2013-06-18 2:51 ` Theodore Ts'o
2013-06-18 3:49 ` Zheng Liu
2013-06-18 2:47 ` Theodore Ts'o [this message]
2013-06-14 15:57 ` Dave Hansen
2013-06-14 17:11 ` Zheng Liu
2013-06-14 16:55 ` Dave Hansen
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=20130618024727.GA24479@thunk.org \
--to=tytso@mit.edu \
--cc=dave.hansen@intel.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).