New issue
Advanced search Search tips

Issue 780597 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Costly execution of SwapThrashingMonitor

Project Member Reported by wittman@chromium.org, Nov 1 2017

Issue description

Data from the UMA Sampling Profiler shows that memory::SwapThrashingMonitor::CheckSwapThrashingPressureAndRecordStatistics(), which was added in 64.0.3254.0, is consuming 6.4% of all non-idle execution cycles during regular Chrome execution on the browser process UI thread on 64-bit Chrome. This seems quite expensive, and likely to have negative consequences for power usage.

Flame graph difference of 64.0.3254.0 vs. 64.0.3253.0:
https://uma.googleplex.com/p/chrome/callstacks?sid=66e8ea94e6d03915993b8f3fc9fb376d
 
Cc: haraken@chromium.org w...@chromium.org bashi@chromium.org
Thanks for notifying me! I'll revert this for now and do some profiling to see what's expensive here (I suspect that it's because of the syscall but I'll need to confirm this...)
It looks like most of the time gets spent in NtQuerySystemInformation 
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8f55a147384647745bdde5d3b9f575d6a12a4ab7

commit 8f55a147384647745bdde5d3b9f575d6a12a4ab7
Author: Sebastien Marchand <sebmarchand@chromium.org>
Date: Thu Nov 02 08:42:48 2017

Temporarily disable the SwapThrashingMonitor

The call to NtQuerySystemInformation seems expensive (see crbug.com/780597),
disabling this while I look at better alternatives.

Bug: 780597, 771478
Change-Id: I3355c26695095498d4b459e8e19727be196dc129
TBR: jochen@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/749569
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513427}
[modify] https://crrev.com/8f55a147384647745bdde5d3b9f575d6a12a4ab7/chrome/browser/chrome_browser_main_win.cc
[modify] https://crrev.com/8f55a147384647745bdde5d3b9f575d6a12a4ab7/chrome/browser/memory/swap_thrashing_monitor_delegate_win.cc

Labels: UMA-Sampling-Profiler
This is surprising and interesting.  What was the sampling rate?

I am collecting various tab discard stats on chromebooks.  On preliminary experiments I am finding that the speed of a discard may be relatively low, which may imply that you don't need to poll very frequently.
Cc: semenzato@chromium.org
I was sampling at 0.5Hz, the problem is that on Windows the only direct way to retrieve the hard page fault rate is by calling NtQuerySystemInformation, which retrieve a lot of information about ALL the processes running on the machine, which is really slow (and might require some processes synchronization).

I don't think that lowering the sampling rate is the best approach here, it'll hide the issue in the UMA Sampling Profiler but getting this metric will still be expensive and the impact of this call could be even worse when the system enters into a thrashing state.

Agreed, I didn't realize that the sampling rate was already this low.
Labels: Performance-Browser
Bulk adding Performance-Browser label for bugs identified with the UMA Sampling Profiler.
+etienneb@ who was considering using NtQuerySystemInformation for a different reason.

Sign in to add a comment