From: Steven Whitehouse <swhiteho@redhat.com>
To: Zhi Yong Wu <zwu.kernel@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxram@linux.vnet.ibm.com, viro@zeniv.linux.org.uk,
david@fromorbit.com, tytso@mit.edu, cmm@us.ibm.com,
wuzhy@linux.vnet.ibm.com, wenqing.lz@taobao.com
Subject: Re: [RFC v4+ hot_track 09/19] vfs: add one work queue
Date: Mon, 05 Nov 2012 12:07:39 +0000 [thread overview]
Message-ID: <1352117259.2705.24.camel@menhir> (raw)
In-Reply-To: <CAEH94LjXrK6OfSU=aQa+waMMY+0kCjL3MU2faKeRxm9UggaKQA@mail.gmail.com>
Hi,
On Mon, 2012-11-05 at 19:55 +0800, Zhi Yong Wu wrote:
> On Mon, Nov 5, 2012 at 7:21 PM, Steven Whitehouse <swhiteho@redhat.com> wrote:
> > Hi,
> >
> > On Mon, 2012-10-29 at 12:30 +0800, zwu.kernel@gmail.com wrote:
> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >>
> >> Add a per-superblock workqueue and a delayed_work
> >> to run periodic work to update map info on each superblock.
> >>
> >> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >> ---
> >> fs/hot_tracking.c | 85 ++++++++++++++++++++++++++++++++++++++++++
> >> fs/hot_tracking.h | 3 +
> >> include/linux/hot_tracking.h | 3 +
> >> 3 files changed, 91 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/fs/hot_tracking.c b/fs/hot_tracking.c
> >> index fff0038..0ef9cad 100644
> >> --- a/fs/hot_tracking.c
> >> +++ b/fs/hot_tracking.c
> >> @@ -15,9 +15,12 @@
> >> #include <linux/module.h>
> >> #include <linux/spinlock.h>
> >> #include <linux/hardirq.h>
> >> +#include <linux/kthread.h>
> >> +#include <linux/freezer.h>
> >> #include <linux/fs.h>
> >> #include <linux/blkdev.h>
> >> #include <linux/types.h>
> >> +#include <linux/list_sort.h>
> >> #include <linux/limits.h>
> >> #include "hot_tracking.h"
> >>
> >> @@ -557,6 +560,67 @@ static void hot_map_array_exit(struct hot_info *root)
> >> }
> >> }
> >>
> >> +/* Temperature compare function*/
> >> +static int hot_temp_cmp(void *priv, struct list_head *a,
> >> + struct list_head *b)
> >> +{
> >> + struct hot_comm_item *ap =
> >> + container_of(a, struct hot_comm_item, n_list);
> >> + struct hot_comm_item *bp =
> >> + container_of(b, struct hot_comm_item, n_list);
> >> +
> >> + int diff = ap->hot_freq_data.last_temp
> >> + - bp->hot_freq_data.last_temp;
> >> + if (diff > 0)
> >> + return -1;
> >> + if (diff < 0)
> >> + return 1;
> >> + return 0;
> >> +}
> >> +
> >> +/*
> >> + * Every sync period we update temperatures for
> >> + * each hot inode item and hot range item for aging
> >> + * purposes.
> >> + */
> >> +static void hot_update_worker(struct work_struct *work)
> >> +{
> >> + struct hot_info *root = container_of(to_delayed_work(work),
> >> + struct hot_info, update_work);
> >> + struct hot_inode_item *hi_nodes[8];
> >> + u64 ino = 0;
> >> + int i, n;
> >> +
> >> + while (1) {
> >> + n = radix_tree_gang_lookup(&root->hot_inode_tree,
> >> + (void **)hi_nodes, ino,
> >> + ARRAY_SIZE(hi_nodes));
> >> + if (!n)
> >> + break;
> >> +
> >> + ino = hi_nodes[n - 1]->i_ino + 1;
> >> + for (i = 0; i < n; i++) {
> >> + kref_get(&hi_nodes[i]->hot_inode.refs);
> >> + hot_map_array_update(
> >> + &hi_nodes[i]->hot_inode.hot_freq_data, root);
> >> + hot_range_update(hi_nodes[i], root);
> >> + hot_inode_item_put(hi_nodes[i]);
> >> + }
> >> + }
> >> +
> >> + /* Sort temperature map info */
> >> + for (i = 0; i < HEAT_MAP_SIZE; i++) {
> >> + list_sort(NULL, &root->heat_inode_map[i].node_list,
> >> + hot_temp_cmp);
> >> + list_sort(NULL, &root->heat_range_map[i].node_list,
> >> + hot_temp_cmp);
> >> + }
> >> +
> >
> > If this list can potentially have one (or more) entries per inode, then
> Only one hot_inode_item per inode, while maybe multiple
> hot_range_items per inode.
> > filesystems with a lot of inodes (millions) may potentially exceed the
> > max size of list which list_sort() can handle. If that happens it still
> > works, but you'll get a warning message and it won't be as efficient.
> I haven't do so large scale test. If we want to find that issue, we
> need to do large scale performance test, before that, i want to make
> sure the code change is correct at first.
> To be honest, for that issue you pointed to, i also have such
> concern.But list_sort() performance looks good from the test result of
> the following URL:
> https://lkml.org/lkml/2010/1/20/485
>
Yes, I think it is good. Also, even when it says that it's performance
is poor (via the warning message) it is still much better than the
alternative (of not sorting) in the GFS2 case. So currently our
workaround is to ignore the warning. Due to what we using it for
(sorting the data blocks for ordered writeback) we only see it very
occasionally when there has been lots of data write activity with little
journal activity on a node with lots of RAM.
> >
> > It is something that we've run into with list_sort() and GFS2, but it
> > only happens very rarely,
> Beside list_sort(), do you have any other way to share? For this
> concern, how does GFS2 resolve it?
>
That is an ongoing investigation :-)
I've pondered various options... increase temp variable space in
list_sort(), not using list_sort() and insertion sorting the blocks
instead, flushing the ordered write data early if the list gets too
long, figuring out how to remove blocks written back by the VM from the
list before the sort, and various other possible solutions. So far I'm
not sure which will be the best to choose, and since your situation is a
bit different it might not make sense to use the same solution.
I just thought it was worth mentioning though since it was something
that we'd run across,
Steve.
next prev parent reply other threads:[~2012-11-05 12:07 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 4:30 [RFC v4+ hot_track 00/19] vfs: hot data tracking zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 01/19] vfs: introduce private radix tree structures zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 02/19] vfs: initialize and free data structures zwu.kernel
2012-11-06 22:24 ` David Sterba
2012-11-07 6:55 ` Zhi Yong Wu
2012-11-16 6:16 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 03/19] vfs: add I/O frequency update function zwu.kernel
2012-11-05 11:07 ` Steven Whitehouse
2012-11-05 11:47 ` Zhi Yong Wu
2012-11-06 22:37 ` David Sterba
2012-11-07 7:03 ` Zhi Yong Wu
2012-11-06 22:45 ` Darrick J. Wong
2012-11-07 8:27 ` Zhi Yong Wu
2012-11-07 18:49 ` Darrick J. Wong
2012-11-08 2:52 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 04/19] vfs: add two map arrays zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 05/19] vfs: add hooks to enable hot tracking zwu.kernel
2012-11-06 22:51 ` David Sterba
2012-11-07 7:06 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 06/19] vfs: add temp calculation function zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 07/19] vfs: add map info update function zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 08/19] vfs: add aging function zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 09/19] vfs: add one work queue zwu.kernel
2012-11-05 11:21 ` Steven Whitehouse
2012-11-05 11:55 ` Zhi Yong Wu
2012-11-05 12:07 ` Steven Whitehouse [this message]
2012-11-05 12:20 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 10/19] vfs: introduce hot func register framework zwu.kernel
2012-11-06 23:14 ` David Sterba
2012-11-07 7:18 ` Zhi Yong Wu
2012-11-06 23:30 ` Darrick J. Wong
2012-11-07 8:34 ` Zhi Yong Wu
2012-11-07 18:58 ` Darrick J. Wong
2012-11-08 2:59 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 11/19] vfs: register one shrinker zwu.kernel
2012-10-29 4:30 ` [RFC v4+ hot_track 12/19] vfs: add one ioctl interface zwu.kernel
2012-11-06 23:30 ` David Sterba
2012-11-07 7:36 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 13/19] debugfs: introduce one function zwu.kernel
2012-10-29 18:11 ` Greg KH
2012-10-29 22:25 ` Zhi Yong Wu
2012-10-29 22:34 ` Greg KH
2012-10-29 22:45 ` Zhi Yong Wu
2012-10-29 22:54 ` Greg KH
2012-10-29 22:58 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 14/19] vfs: add debugfs support zwu.kernel
2012-11-06 23:45 ` David Sterba
2012-11-07 7:49 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 15/19] sysfs: add two hot_track proc files zwu.kernel
2012-10-29 18:10 ` Greg KH
2012-10-29 22:26 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 16/19] btrfs: add hot tracking support zwu.kernel
2012-11-07 0:00 ` David Sterba
2012-11-07 8:03 ` Zhi Yong Wu
2012-10-29 4:30 ` [RFC v4+ hot_track 17/19] xfs: " zwu.kernel
2012-10-29 4:31 ` [RFC v4+ hot_track 18/19] ext4: " zwu.kernel
2012-10-29 4:31 ` [RFC v4+ hot_track 19/19] vfs: add documentation zwu.kernel
2012-10-29 10:30 ` [RFC v4+ hot_track 00/19] vfs: hot data tracking Andi Kleen
2012-10-29 12:31 ` Zhi Yong Wu
2012-11-07 8:51 ` Zhi Yong Wu
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=1352117259.2705.24.camel@menhir \
--to=swhiteho@redhat.com \
--cc=cmm@us.ibm.com \
--cc=david@fromorbit.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxram@linux.vnet.ibm.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=wenqing.lz@taobao.com \
--cc=wuzhy@linux.vnet.ibm.com \
--cc=zwu.kernel@gmail.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;
as well as URLs for NNTP newsgroup(s).