public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Bob Peterson <rpeterso@redhat.com>,
	Wu Fengguang <fengguang.wu@intel.com>, LKP <lkp@01.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [LKP] [lkp] [xfs] 68a9f5e700: aim7.jobs-per-min -13.6% regression
Date: Thu, 11 Aug 2016 11:16:12 +1000	[thread overview]
Message-ID: <20160811011612.GT16044@dastard> (raw)
In-Reply-To: <8760r816wf.fsf@yhuang-mobile.sh.intel.com>

On Wed, Aug 10, 2016 at 05:33:20PM -0700, Huang, Ying wrote:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
> 
> > On Wed, Aug 10, 2016 at 5:11 PM, Huang, Ying <ying.huang@intel.com> wrote:
> >>
> >> Here is the comparison result with perf-profile data.
> >
> > Heh. The diff is actually harder to read than just showing A/B
> > state.The fact that the call chain shows up as part of the symbol
> > makes it even more so.
> >
> > For example:
> >
> >>       0.00 ± -1%      +Inf%       1.68 ±  1%  perf-profile.cycles-pp.__add_to_page_cache_locked.add_to_page_cache_lru.pagecache_get_page.grab_cache_page_write_begin.iomap_write_begin
> >>       1.80 ±  1%    -100.0%       0.00 ± -1%  perf-profile.cycles-pp.__add_to_page_cache_locked.add_to_page_cache_lru.pagecache_get_page.grab_cache_page_write_begin.xfs_vm_write_begin
> >
> > Ok, so it went from 1.8% to 1.68%, and isn't actually that big of a
> > change, but it shows up as a big change because the caller changed
> > from xfs_vm_write_begin to iomap_write_begin.
> >
> > There's a few other cases of that too.
> >
> > So I think it would actually be easier to just see "what 20 functions
> > were the hottest" (or maybe 50) before and after separately (just
> > sorted by cycles), without the diff part. Because the diff is really
> > hard to read.
> 
> Here it is,
> 
> Before:
> 
>   "perf-profile.func.cycles-pp.intel_idle": 16.88,
>   "perf-profile.func.cycles-pp.copy_user_enhanced_fast_string": 3.94,
>   "perf-profile.func.cycles-pp.memset_erms": 3.26,
>   "perf-profile.func.cycles-pp.__block_commit_write.isra.24": 2.47,
>   "perf-profile.func.cycles-pp.___might_sleep": 2.33,
>   "perf-profile.func.cycles-pp.__mark_inode_dirty": 1.88,
>   "perf-profile.func.cycles-pp.unlock_page": 1.69,
>   "perf-profile.func.cycles-pp.up_write": 1.61,
>   "perf-profile.func.cycles-pp.__block_write_begin_int": 1.56,
>   "perf-profile.func.cycles-pp.down_write": 1.55,
>   "perf-profile.func.cycles-pp.mark_buffer_dirty": 1.53,
>   "perf-profile.func.cycles-pp.entry_SYSCALL_64_fastpath": 1.47,
>   "perf-profile.func.cycles-pp.generic_write_end": 1.36,
>   "perf-profile.func.cycles-pp.generic_perform_write": 1.33,
>   "perf-profile.func.cycles-pp.__radix_tree_lookup": 1.32,
>   "perf-profile.func.cycles-pp.__might_sleep": 1.26,
>   "perf-profile.func.cycles-pp._raw_spin_lock": 1.17,
>   "perf-profile.func.cycles-pp.vfs_write": 1.14,
>   "perf-profile.func.cycles-pp.__xfs_get_blocks": 1.07,

Ok, so that is the old block mapping call in the buffered IO path.
I don't see any of the functions it calls in the profile;
specifically xfs_bmapi_read(), and xfs_iomap_write_delay(), so it
appears the extent mapping and allocation overhead on the old code
totals somewhere under 2-3% of the entire CPU usage.

>   "perf-profile.func.cycles-pp.xfs_file_write_iter": 1.03,
>   "perf-profile.func.cycles-pp.pagecache_get_page": 1.03,
>   "perf-profile.func.cycles-pp.native_queued_spin_lock_slowpath": 0.98,
>   "perf-profile.func.cycles-pp.get_page_from_freelist": 0.94,
>   "perf-profile.func.cycles-pp.rwsem_spin_on_owner": 0.94,
>   "perf-profile.func.cycles-pp.__vfs_write": 0.87,
>   "perf-profile.func.cycles-pp.iov_iter_copy_from_user_atomic": 0.87,
>   "perf-profile.func.cycles-pp.xfs_file_buffered_aio_write": 0.84,
>   "perf-profile.func.cycles-pp.find_get_entry": 0.79,
>   "perf-profile.func.cycles-pp._raw_spin_lock_irqsave": 0.78,
> 
> 
> After:
> 
>   "perf-profile.func.cycles-pp.intel_idle": 16.82,
>   "perf-profile.func.cycles-pp.copy_user_enhanced_fast_string": 3.27,
>   "perf-profile.func.cycles-pp.memset_erms": 2.6,
>   "perf-profile.func.cycles-pp.xfs_bmapi_read": 2.24,

Straight away - thats' at least 3x more overhead block mapping lookups
with the iomap code.

>   "perf-profile.func.cycles-pp.___might_sleep": 2.04,
>   "perf-profile.func.cycles-pp.mark_page_accessed": 1.93,
>   "perf-profile.func.cycles-pp.__block_write_begin_int": 1.78,
>   "perf-profile.func.cycles-pp.up_write": 1.72,
>   "perf-profile.func.cycles-pp.xfs_iext_bno_to_ext": 1.7,

Plus this child.

>   "perf-profile.func.cycles-pp.__block_commit_write.isra.24": 1.65,
>   "perf-profile.func.cycles-pp.down_write": 1.51,
>   "perf-profile.func.cycles-pp.__mark_inode_dirty": 1.51,
>   "perf-profile.func.cycles-pp.unlock_page": 1.43,
>   "perf-profile.func.cycles-pp.xfs_bmap_search_multi_extents": 1.25,
>   "perf-profile.func.cycles-pp.xfs_bmap_search_extents": 1.23,

And these two.

>   "perf-profile.func.cycles-pp.mark_buffer_dirty": 1.21,
>   "perf-profile.func.cycles-pp.xfs_iomap_write_delay": 1.19,
>   "perf-profile.func.cycles-pp.xfs_iomap_eof_want_preallocate.constprop.8": 1.15,

And these two.

So, essentially the old code had maybe 2-3% cpu usage overhead in
the block mapping path on this workload, but the new code is, for
some reason, showing at least 8-9% CPU usage overhead. That, right
now, makes no sense at all to me as we should be doing - at worst -
exactly the same number of block mapping calls as the old code.

We need to know what is happening that is different - there's a good
chance the mapping trace events will tell us. Huang, can you get
a raw event trace from the test?

I need to see these events:

	xfs_file*
	xfs_iomap*
	xfs_get_block*

For both kernels. An example trace from 4.8-rc1 running the command
`xfs_io -f -c 'pwrite 0 512k -b 128k' /mnt/scratch/fooey doing an
overwrite and extend of the existing file ends up looking like:

$ sudo trace-cmd start -e xfs_iomap\* -e xfs_file\* -e xfs_get_blocks\*
$ sudo cat /sys/kernel/tracing/trace_pipe
           <...>-2946  [001] .... 253971.750304: xfs_file_ioctl: dev 253:32 ino 0x84
          xfs_io-2946  [001] .... 253971.750938: xfs_file_buffered_write: dev 253:32 ino 0x84 size 0x40000 offset 0x0 count 0x20000
          xfs_io-2946  [001] .... 253971.750961: xfs_iomap_found: dev 253:32 ino 0x84 size 0x40000 offset 0x0 count 131072 type invalid startoff 0x0 startblock 24 blockcount 0x60
          xfs_io-2946  [001] .... 253971.751114: xfs_file_buffered_write: dev 253:32 ino 0x84 size 0x40000 offset 0x20000 count 0x20000
          xfs_io-2946  [001] .... 253971.751128: xfs_iomap_found: dev 253:32 ino 0x84 size 0x40000 offset 0x20000 count 131072 type invalid startoff 0x0 startblock 24 blockcount 0x60
          xfs_io-2946  [001] .... 253971.751234: xfs_file_buffered_write: dev 253:32 ino 0x84 size 0x40000 offset 0x40000 count 0x20000
          xfs_io-2946  [001] .... 253971.751236: xfs_iomap_found: dev 253:32 ino 0x84 size 0x40000 offset 0x40000 count 131072 type invalid startoff 0x0 startblock 24 blockcount 0x60
          xfs_io-2946  [001] .... 253971.751381: xfs_file_buffered_write: dev 253:32 ino 0x84 size 0x40000 offset 0x60000 count 0x20000
          xfs_io-2946  [001] .... 253971.751415: xfs_iomap_prealloc_size: dev 253:32 ino 0x84 prealloc blocks 128 shift 0 m_writeio_blocks 16
          xfs_io-2946  [001] .... 253971.751425: xfs_iomap_alloc: dev 253:32 ino 0x84 size 0x40000 offset 0x60000 count 131072 type invalid startoff 0x60 startblock -1 blockcount 0x90

That's the output I need for the complete test - you'll need to use
a better recording mechanism that this (e.g. trace-cmd record,
trace-cmd report) because it will generate a lot of events. Compress
the two report files (they'll be large) and send them to me offlist.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2016-08-11  1:16 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 14:33 [lkp] [xfs] 68a9f5e700: aim7.jobs-per-min -13.6% regression kernel test robot
2016-08-10 18:24 ` Linus Torvalds
2016-08-10 23:08   ` Dave Chinner
2016-08-10 23:51     ` Linus Torvalds
2016-08-10 23:58       ` [LKP] " Huang, Ying
2016-08-11  0:11         ` Huang, Ying
2016-08-11  0:23           ` Linus Torvalds
2016-08-11  0:33             ` Huang, Ying
2016-08-11  1:00               ` Linus Torvalds
2016-08-11  4:46                 ` Dave Chinner
2016-08-15 17:22                   ` Huang, Ying
2016-08-16  0:08                     ` Dave Chinner
2016-08-11 15:57                 ` Christoph Hellwig
2016-08-11 16:55                   ` Linus Torvalds
2016-08-11 17:51                     ` Huang, Ying
2016-08-11 19:51                       ` Linus Torvalds
2016-08-11 20:00                         ` Christoph Hellwig
2016-08-11 20:35                           ` Linus Torvalds
2016-08-11 22:16                             ` Al Viro
2016-08-11 22:30                               ` Linus Torvalds
2016-08-11 21:16                           ` Huang, Ying
2016-08-11 21:40                             ` Linus Torvalds
2016-08-11 22:08                               ` Christoph Hellwig
2016-08-12  0:54                     ` Dave Chinner
2016-08-12  2:23                       ` Dave Chinner
2016-08-12  2:32                         ` Linus Torvalds
2016-08-12  2:52                         ` Christoph Hellwig
2016-08-12  3:20                           ` Linus Torvalds
2016-08-12  4:16                             ` Dave Chinner
2016-08-12  5:02                               ` Linus Torvalds
2016-08-12  6:04                                 ` Dave Chinner
2016-08-12  6:29                                   ` Ye Xiaolong
2016-08-12  8:51                                     ` Ye Xiaolong
2016-08-12 10:02                                       ` Dave Chinner
2016-08-12 10:43                                         ` Fengguang Wu
2016-08-13  0:30                                         ` [LKP] [lkp] " Christoph Hellwig
2016-08-13 21:48                                           ` Christoph Hellwig
2016-08-13 22:07                                             ` Fengguang Wu
2016-08-13 22:15                                               ` Christoph Hellwig
2016-08-13 22:51                                                 ` Fengguang Wu
2016-08-14 14:50                                                   ` Fengguang Wu
2016-08-14 16:17                                                     ` Christoph Hellwig
2016-08-14 23:46                                                       ` Dave Chinner
2016-08-14 23:57                                                       ` Fengguang Wu
2016-08-15 14:14                                                       ` Fengguang Wu
2016-08-15 21:22                                                         ` Dave Chinner
2016-08-16 12:20                                                           ` Fengguang Wu
2016-08-15 20:30                                                       ` Huang, Ying
2016-08-22 22:09                                                         ` Huang, Ying
2016-09-26  6:25                                                           ` Huang, Ying
2016-09-26 14:55                                                             ` Christoph Hellwig
2016-09-27  0:52                                                               ` Huang, Ying
2016-08-16 13:25                                                       ` Fengguang Wu
2016-08-13 23:32                                           ` Dave Chinner
2016-08-12  2:27                       ` Linus Torvalds
2016-08-12  3:56                         ` Dave Chinner
2016-08-12 18:03                           ` Linus Torvalds
2016-08-13 23:58                             ` Fengguang Wu
2016-08-15  0:48                             ` Dave Chinner
2016-08-15  1:37                               ` Linus Torvalds
2016-08-15  2:28                                 ` Dave Chinner
2016-08-15  2:53                                   ` Linus Torvalds
2016-08-15  5:00                                     ` Dave Chinner
     [not found]                                       ` <CA+55aFwva2Xffai+Eqv1Jn_NGryk3YJ2i5JoHOQnbQv6qVPAsw@mail.gmail.com>
     [not found]                                         ` <CA+55aFy14nUnJQ_GdF=j8Fa9xiH70c6fY2G3q5HQ01+8z1z3qQ@mail.gmail.com>
     [not found]                                           ` <CA+55aFxp+rLehC8c157uRbH459wUC1rRPfCVgvmcq5BrG9gkyg@mail.gmail.com>
2016-08-15 22:22                                             ` Dave Chinner
2016-08-15 22:42                                               ` Dave Chinner
2016-08-15 23:20                                                 ` Linus Torvalds
2016-08-15 23:48                                                   ` Linus Torvalds
2016-08-16  0:44                                                     ` Dave Chinner
2016-08-16 15:05                                                     ` Mel Gorman
2016-08-16 17:47                                                       ` Linus Torvalds
2016-08-17 15:48                                                         ` Michal Hocko
2016-08-17 16:42                                                           ` Michal Hocko
2016-08-17 15:49                                                         ` Mel Gorman
2016-08-18  0:45                                                           ` Mel Gorman
2016-08-18  7:11                                                             ` Dave Chinner
2016-08-18 13:24                                                               ` Mel Gorman
2016-08-18 17:55                                                                 ` Linus Torvalds
2016-08-18 21:19                                                                   ` Dave Chinner
2016-08-18 22:25                                                                     ` Linus Torvalds
2016-08-19  9:00                                                                       ` Michal Hocko
2016-08-19 10:49                                                                       ` Mel Gorman
2016-08-19 23:48                                                                         ` Dave Chinner
2016-08-20  1:08                                                                           ` Linus Torvalds
2016-08-20 12:16                                                                           ` Mel Gorman
2016-08-19 15:08                                                               ` Mel Gorman
2016-09-01 23:32                                                                 ` Dave Chinner
2016-09-06 15:37                                                                   ` Mel Gorman
2016-09-06 15:52                                                                     ` Huang, Ying
2016-08-24 15:40                                                             ` Huang, Ying
2016-08-25  9:37                                                               ` Mel Gorman
2016-08-18  2:44                                                           ` Dave Chinner
2016-08-16  0:15                                                   ` Linus Torvalds
2016-08-16  0:38                                                     ` Dave Chinner
2016-08-16  0:50                                                       ` Linus Torvalds
2016-08-16  0:19                                                   ` Dave Chinner
2016-08-16  1:51                                                     ` Linus Torvalds
2016-08-16 22:02                                                       ` Dave Chinner
2016-08-16 23:23                                                         ` Linus Torvalds
2016-08-15 23:01                                               ` Linus Torvalds
2016-08-16  0:17                                                 ` Dave Chinner
2016-08-16  0:45                                                   ` Linus Torvalds
2016-08-15  5:03                                     ` Ingo Molnar
2016-08-17 16:24                                       ` Peter Zijlstra
2016-08-15 12:58                             ` Fengguang Wu
2016-08-11  1:16               ` Dave Chinner [this message]
2016-08-11  1:32                 ` Dave Chinner
2016-08-11  2:36                   ` Ye Xiaolong
2016-08-11  3:05                     ` Dave Chinner
2016-08-12  1:26                 ` Dave Chinner

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=20160811011612.GT16044@dastard \
    --to=david@fromorbit.com \
    --cc=fengguang.wu@intel.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=rpeterso@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=ying.huang@intel.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