linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Tim Chen <tim.c.chen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Andi Kleen <ak@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>, Jan Kara <jack@suse.cz>,
	linux-mm <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/2] sched/wait: Break up long wake list walk
Date: Thu, 17 Aug 2017 16:17:40 +0000	[thread overview]
Message-ID: <37D7C6CF3E00A74B8858931C1DB2F07753786CE9@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <CA+55aFznC1wqBSfYr8=92LGqz5-F6fHMzdXoqM4aOYx8sT1Dhg@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 17502 bytes --]


> On Mon, Aug 14, 2017 at 5:52 PM, Tim Chen <tim.c.chen@linux.intel.com>
> wrote:
> > We encountered workloads that have very long wake up list on large
> > systems. A waker takes a long time to traverse the entire wake list
> > and execute all the wake functions.
> >
> > We saw page wait list that are up to 3700+ entries long in tests of
> > large
> > 4 and 8 socket systems.  It took 0.8 sec to traverse such list during
> > wake up.  Any other CPU that contends for the list spin lock will spin
> > for a long time.  As page wait list is shared by many pages so it
> > could get very long on systems with large memory.
> 
> I really dislike this patch.
> 
> The patch seems a band-aid for really horrible kernel behavior, rather than
> fixing the underlying problem itself.
> 
> Now, it may well be that we do end up needing this band-aid in the end, so
> this isn't a NAK of the patch per se. But I'd *really* like to see if we can fix the
> underlying cause for what you see somehow..
> 
> In particular, if this is about the page wait table, maybe we can just make the
> wait table bigger. IOW, are people actually waiting on the
> *same* page, or are they mainly waiting on totally different pages, just
> hashing to the same wait queue?
> 
> Because right now that page wait table is a small fixed size, and the only
> reason it's a small fixed size is that nobody reported any issues with it -
> particularly since we now avoid the wait table entirely for the common cases
> by having that "contention" bit.
> 
> But it really is a *small* table. We literally have
> 
>    #define PAGE_WAIT_TABLE_BITS 8
> 
> so it's just 256 entries. We could easily it much bigger, if we are actually
> seeing a lot of collissions.
> 
> We *used* to have a very complex per-zone thing for bit-waitiqueues, but
> that was because we got lots and lots of contention issues, and everybody
> *always* touched the wait-queues whether they waited or not (so being per-
> zone was a big deal)
> 
> We got rid of all that per-zone complexity when the normal case didn't hit in
> the page wait queues at all, but we may have over-done the simplification a
> bit since nobody showed any issue.
> 
> In particular, we used to size the per-zone thing by amount of memory.
> We could easily re-introduce that for the new simpler page queues.
> 
> The page_waitiqueue() is a simple helper function inside mm/filemap.c, and
> thanks to the per-page "do we have actual waiters" bit that we have now, we
> can actually afford to make it bigger and more complex now if we want to.
> 
> What happens to your load if you just make that table bigger? You can
> literally test by just changing the constant from 8 to 16 or something, making
> us use twice as many bits for hashing. A "real"
> patch would size it by amount of memory, but just for testing the contention
> on your load, you can do the hacky one-liner.

Hi Linus,

We tried both 12 and 16 bit table and that didn't make a difference.
The long wake ups are mostly on the same page when we do instrumentation

Here is the wake_up_page_bit call stack when the workaround is running, which
is collected by perf record -g -a -e probe:wake_up_page_bit -- sleep 10

# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 374  of event 'probe:wake_up_page_bit'
# Event count (approx.): 374
#
# Overhead  Trace output      
# ........  ..................
#
   100.00%  (ffffffffae1ad000)
            |
            ---wake_up_page_bit
               |          
               |--49.73%--migrate_misplaced_transhuge_page
               |          do_huge_pmd_numa_page
               |          __handle_mm_fault
               |          handle_mm_fault
               |          __do_page_fault
               |          do_page_fault
               |          page_fault
               |          |          
               |          |--28.07%--0x2b7b7
               |          |          |          
               |          |          |--13.64%--0x127a2
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--13.37%--0x127d8
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--0.53%--0x1280e
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |           --0.27%--0x12844
               |          |                     0x7fb5247eddc5
               |          |          
               |          |--18.18%--0x2b788
               |          |          |          
               |          |          |--14.97%--0x127a2
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--1.34%--0x1287a
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--0.53%--0x128b0
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--0.53%--0x1280e
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--0.53%--0x127d8
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |           --0.27%--0x12844
               |          |                     0x7fb5247eddc5
               |          |          
               |          |--1.07%--0x2b823
               |          |          |          
               |          |          |--0.53%--0x127a2
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |          |--0.27%--0x1287a
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |           --0.27%--0x127d8
               |          |                     0x7fb5247eddc5
               |          |          
               |          |--0.80%--0x2b88f
               |          |          |          
               |          |           --0.53%--0x127d8
               |          |                     0x7fb5247eddc5
               |          |          
               |          |--0.80%--0x2b7f4
               |          |          |          
               |          |          |--0.53%--0x127d8
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |           --0.27%--0x127a2
               |          |                     0x7fb5247eddc5
               |          |          
               |          |--0.53%--0x2b8fb
               |          |          0x127a2
               |          |          0x7fb5247eddc5
               |          |          
               |           --0.27%--0x2b8e9
               |                     0x127a2
               |                     0x7fb5247eddc5
               |          
               |--44.12%--__handle_mm_fault
               |          handle_mm_fault
               |          __do_page_fault
               |          do_page_fault
               |          page_fault
               |          |          
               |          |--30.75%--_dl_relocate_object
               |          |          dl_main
               |          |          _dl_sysdep_start
               |          |          0x40
               |          |          
               |           --13.37%--memset
               |                     _dl_map_object
               |                     |          
               |                     |--2.94%--_etext
               |                     |          
               |                     |--0.80%--0x7f34ea294b08
               |                     |          0
               |                     |          
               |                     |--0.80%--0x7f1d5fa64b08
               |                     |          0
               |                     |          
               |                     |--0.53%--0x7fd4c83dbb08
               |                     |          0
               |                     |          
               |                     |--0.53%--0x7efe3724cb08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7ff2cf0b69c0
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7fc9bc22cb08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7fc432971058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7faf21ec2b08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7faf21ec2640
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f940f08e058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f4b84122640
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f42c8fd7fd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f3f15778fd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f3f15776058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f34ea27dfd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f34ea27b058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f2a0409bb08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f2a04084fd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f2a04082058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f1949633b08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f194961cfd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f1629f87b08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f1629f70fd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f1629f6e058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f060696eb08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7f04ac14c9c0
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7efe8b4bbb08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7efe8b4a59c0
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7efe8b4a4fd8
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7efe8b4a2058
               |                     |          0
               |                     |          
               |                     |--0.27%--0x7efcd0c70b08
               |                     |          0
               |                     |          
               |                     |--0.27%--0x207ad8
               |                     |          0
               |                     |          
               |                      --0.27%--0x206b30
               |                                0
               |          
               |--2.14%--filemap_map_pages
               |          __handle_mm_fault
               |          handle_mm_fault
               |          __do_page_fault
               |          do_page_fault
               |          page_fault
               |          |          
               |          |--0.53%--_IO_vfscanf
               |          |          |          
               |          |          |--0.27%--0x6563697665442055
               |          |          |          
               |          |           --0.27%--_IO_vsscanf
               |          |                     0x6563697665442055
               |          |          
               |          |--0.53%--_dl_map_object_from_fd
               |          |          _dl_map_object
               |          |          |          
               |          |          |--0.27%--0x7faf21ec2640
               |          |          |          0
               |          |          |          
               |          |           --0.27%--_etext
               |          |          
               |          |--0.27%--__libc_enable_asynccancel
               |          |          __fopen_internal
               |          |          0x6d6f6f2f30373635
               |          |          
               |          |--0.27%--vfprintf
               |          |          _IO_vsprintf
               |          |          0x4
               |          |          
               |          |--0.27%--0x1fb40
               |          |          0x41d589495541f689
               |          |          
               |           --0.27%--memset@plt
               |          
               |--1.87%--do_huge_pmd_numa_page
               |          __handle_mm_fault
               |          handle_mm_fault
               |          __do_page_fault
               |          do_page_fault
               |          page_fault
               |          |          
               |          |--0.80%--0x2b7b7
               |          |          0x127d8
               |          |          0x7fb5247eddc5
               |          |          
               |          |--0.80%--0x2b788
               |          |          0x127a2
               |          |          0x7fb5247eddc5
               |          |          
               |           --0.27%--0x2b918
               |                     0x127d8
               |                     0x7fb5247eddc5
               |          
               |--1.87%--migrate_pages
               |          migrate_misplaced_page
               |          __handle_mm_fault
               |          handle_mm_fault
               |          __do_page_fault
               |          do_page_fault
               |          page_fault
               |          |          
               |          |--1.07%--0x2b7b7
               |          |          |          
               |          |          |--0.80%--0x127d8
               |          |          |          0x7fb5247eddc5
               |          |          |          
               |          |           --0.27%--0x1287a
               |          |                     0x7fb5247eddc5
               |          |          
               |           --0.80%--0x2b788
               |                     0x127a2
               |                     0x7fb5247eddc5
               |          
                --0.27%--do_wp_page
                          __handle_mm_fault
                          handle_mm_fault
                          __do_page_fault
                          do_page_fault
                          page_fault
                          _IO_link_in

Thanks,
Kan
N‹§²æìr¸›zǧu©ž²Æ {\b­†éì¹»\x1c®&Þ–)îÆi¢žØ^n‡r¶‰šŽŠÝ¢j$½§$¢¸\x05¢¹¨­è§~Š'.)îÄÃ,yèm¶ŸÿÃ\f%Š{±šj+ƒðèž×¦j)Z†·Ÿ

  parent reply	other threads:[~2017-08-17 16:17 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15  0:52 [PATCH 1/2] sched/wait: Break up long wake list walk Tim Chen
2017-08-15  0:52 ` [PATCH 2/2] sched/wait: Introduce lock breaker in wake_up_page_bit Tim Chen
2017-08-15  1:48 ` [PATCH 1/2] sched/wait: Break up long wake list walk Linus Torvalds
2017-08-15  2:27   ` Andi Kleen
2017-08-15  2:52     ` Linus Torvalds
2017-08-15  3:15       ` Andi Kleen
2017-08-15  3:28         ` Linus Torvalds
2017-08-15 19:05           ` Tim Chen
2017-08-15 19:41             ` Linus Torvalds
2017-08-15 19:47               ` Linus Torvalds
2017-08-15 22:47           ` Davidlohr Bueso
2017-08-15 22:56             ` Linus Torvalds
2017-08-15 22:57               ` Linus Torvalds
2017-08-15 23:50                 ` Linus Torvalds
2017-08-16 23:22                   ` Eric W. Biederman
2017-08-17 16:17   ` Liang, Kan [this message]
2017-08-17 16:25     ` Linus Torvalds
2017-08-17 20:18       ` Liang, Kan
2017-08-17 20:44         ` Linus Torvalds
2017-08-18 12:23           ` Mel Gorman
2017-08-18 14:20             ` Liang, Kan
2017-08-18 14:46               ` Mel Gorman
2017-08-18 16:36                 ` Tim Chen
2017-08-18 16:45                   ` Andi Kleen
2017-08-18 16:53                 ` Liang, Kan
2017-08-18 17:48                   ` Linus Torvalds
2017-08-18 18:54                     ` Mel Gorman
2017-08-18 19:14                       ` Linus Torvalds
2017-08-18 19:58                         ` Andi Kleen
2017-08-18 20:10                           ` Linus Torvalds
2017-08-21 18:32                         ` Mel Gorman
2017-08-21 18:56                           ` Liang, Kan
2017-08-22 17:23                             ` Liang, Kan
2017-08-22 18:19                               ` Linus Torvalds
2017-08-22 18:25                                 ` Linus Torvalds
2017-08-22 18:56                                 ` Peter Zijlstra
2017-08-22 19:15                                   ` Linus Torvalds
2017-08-22 19:08                                 ` Peter Zijlstra
2017-08-22 19:30                                   ` Linus Torvalds
2017-08-22 19:37                                     ` Andi Kleen
2017-08-22 21:08                                       ` Christopher Lameter
2017-08-22 21:24                                         ` Andi Kleen
2017-08-22 22:52                                           ` Linus Torvalds
2017-08-22 23:19                                             ` Linus Torvalds
2017-08-23 14:51                                             ` Liang, Kan
2017-08-22 19:55                                 ` Liang, Kan
2017-08-22 20:42                                   ` Linus Torvalds
2017-08-22 20:53                                     ` Peter Zijlstra
2017-08-22 20:58                                       ` Linus Torvalds
2017-08-23 14:49                                     ` Liang, Kan
2017-08-23 15:58                                       ` Tim Chen
2017-08-23 18:17                                         ` Linus Torvalds
2017-08-23 20:55                                           ` Liang, Kan
2017-08-23 23:30                                           ` Linus Torvalds
2017-08-24 17:49                                             ` Tim Chen
2017-08-24 18:16                                               ` Linus Torvalds
2017-08-24 20:44                                                 ` Mel Gorman
2017-08-25 16:44                                                   ` Tim Chen
2017-08-23 16:04                                 ` Mel Gorman
2017-08-18 20:05                     ` Andi Kleen
2017-08-18 20:29                       ` Linus Torvalds
2017-08-18 20:29                     ` Liang, Kan
2017-08-18 20:34                       ` Linus Torvalds
2017-08-18 16:55             ` Linus Torvalds
2017-08-18 13:06           ` Liang, Kan

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=37D7C6CF3E00A74B8858931C1DB2F07753786CE9@SHSMSX103.ccr.corp.intel.com \
    --to=kan.liang@intel.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.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).