|
|
Created:
5 years, 6 months ago by bashi Modified:
5 years, 6 months ago CC:
blink-reviews, Mads Ager (chromium), oilpan-reviews, blink-reviews-wtf_chromium.org, kouhei+heap_chromium.org, Mikhail Base URL:
svn://svn.chromium.org/blink/trunk Target Ref:
refs/heads/master Project:
blink Visibility:
Public. |
DescriptionSet HistogramEnumerationFunction even when Partitions are initialized
PartitionAlloc.CommittedSize isn't collected because we don't set
m_histogramEnumeration correctly when we try to allocate memory
before Partitions::initialize() is called. As a workaround, this CL
separates partitions initialization and m_histogramEnumeration setting
so that we can overrides m_histogramEnumeration. This workaround should
be removed when we can make sure that initialize() is always called
before memory allocation.
This CL also remove a spin lock because initialization must happen
on the main thread.
BUG=501171
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=197413
Patch Set 1 #
Total comments: 4
Patch Set 2 : Remove lock #
Total comments: 2
Patch Set 3 : #
Messages
Total messages: 21 (5 generated)
bashi@chromium.org changed reviewers: + haraken@chromium.org
PTAL? I think https://codereview.chromium.org/1182083006/ fixes the issue but we might want to have a workaround.
Thanks for working on this! https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp File Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp#n... Source/wtf/Partitions.cpp:65: spinLockLock(&s_lock); I don't think this lock is needed. Partitions::setHistogramEnumeration can be called only from the main thread. Also it is guaranteed that WTF::initialize() is called before the m_histogramEnumeration gets used. Thus there is no threading contention on the m_histogramEnumeration.
https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp File Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp#n... Source/wtf/Partitions.cpp:65: spinLockLock(&s_lock); On 2015/06/17 05:24:20, haraken wrote: > > I don't think this lock is needed. Partitions::setHistogramEnumeration can be > called only from the main thread. Also it is guaranteed that WTF::initialize() > is called before the m_histogramEnumeration gets used. Thus there is no > threading contention on the m_histogramEnumeration. > > Hmm, the same can be said for initialize()? Can we remove the lock totally?
https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp File Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp#n... Source/wtf/Partitions.cpp:65: spinLockLock(&s_lock); On 2015/06/17 05:25:27, bashi1 wrote: > On 2015/06/17 05:24:20, haraken wrote: > > > > I don't think this lock is needed. Partitions::setHistogramEnumeration can be > > called only from the main thread. Also it is guaranteed that WTF::initialize() > > is called before the m_histogramEnumeration gets used. Thus there is no > > threading contention on the m_histogramEnumeration. > > > > > > Hmm, the same can be said for initialize()? Can we remove the lock totally? I think your understanding is correct. Any Blink thread won't start before the main thread finishes WTF::initialize(), it doesn't happen that multiple threads contend on s_initialized. (If that happens, it will already be detected as a threading contention because Partitions::bufferPartition() is touching s_initialized without acquiring a lock.) So I think it should be safe to remove the lock.
Patchset #2 (id:20001) has been deleted
https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp File Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp#n... Source/wtf/Partitions.cpp:65: spinLockLock(&s_lock); On 2015/06/17 05:29:37, haraken wrote: > On 2015/06/17 05:25:27, bashi1 wrote: > > On 2015/06/17 05:24:20, haraken wrote: > > > > > > I don't think this lock is needed. Partitions::setHistogramEnumeration can > be > > > called only from the main thread. Also it is guaranteed that > WTF::initialize() > > > is called before the m_histogramEnumeration gets used. Thus there is no > > > threading contention on the m_histogramEnumeration. > > > > > > > > > > Hmm, the same can be said for initialize()? Can we remove the lock totally? > > I think your understanding is correct. Any Blink thread won't start before the > main thread finishes WTF::initialize(), it doesn't happen that multiple threads > contend on s_initialized. (If that happens, it will already be detected as a > threading contention because Partitions::bufferPartition() is touching > s_initialized without acquiring a lock.) So I think it should be safe to remove > the lock. > Removed. We can't add ASSERT(isMainThread()) because isMainThread() doesn't work at this point. (mainThreadIdendifier isn't initialized at this point)
LGTM On 2015/06/17 05:49:41, bashi1 wrote: > https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp > File Source/wtf/Partitions.cpp (right): > > https://codereview.chromium.org/1190883003/diff/1/Source/wtf/Partitions.cpp#n... > Source/wtf/Partitions.cpp:65: spinLockLock(&s_lock); > On 2015/06/17 05:29:37, haraken wrote: > > On 2015/06/17 05:25:27, bashi1 wrote: > > > On 2015/06/17 05:24:20, haraken wrote: > > > > > > > > I don't think this lock is needed. Partitions::setHistogramEnumeration can > > be > > > > called only from the main thread. Also it is guaranteed that > > WTF::initialize() > > > > is called before the m_histogramEnumeration gets used. Thus there is no > > > > threading contention on the m_histogramEnumeration. > > > > > > > > > > > > > > Hmm, the same can be said for initialize()? Can we remove the lock totally? > > > > I think your understanding is correct. Any Blink thread won't start before the > > main thread finishes WTF::initialize(), it doesn't happen that multiple > threads > > contend on s_initialized. (If that happens, it will already be detected as a > > threading contention because Partitions::bufferPartition() is touching > > s_initialized without acquiring a lock.) So I think it should be safe to > remove > > the lock. > > > > Removed. We can't add ASSERT(isMainThread()) because isMainThread() doesn't work > at this point. (mainThreadIdendifier isn't initialized at this point) This is good. We want to keep PartitionAlloc as isoalted as possible, so we don't want to add an unnecessary dependency here.
https://codereview.chromium.org/1190883003/diff/40001/Source/wtf/Partitions.cpp File Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1190883003/diff/40001/Source/wtf/Partitions.c... Source/wtf/Partitions.cpp:52: // rely on isMainThread() at this point. Sorry, I noticed this file is already including MainThread.h. But I think you can remove this comment, since it's not a big deal.
haraken@chromium.org changed reviewers: + cevans@chromium.org
+cevans for owner review.
On 2015/06/17 14:21:13, haraken wrote: > +cevans for owner review. I don't quite understand what this CL changes? Is this a first CL in a series, or is it supposed to have an effect on its own? The call sequence change in WTF.cpp from initialize(histogram); to initialize(); setHistogram(histogram) looks equivalent to me?
On 2015/06/17 16:36:36, Chris Evans wrote: > On 2015/06/17 14:21:13, haraken wrote: > > +cevans for owner review. > > I don't quite understand what this CL changes? Is this a first CL in a series, > or is it supposed to have an effect on its own? > The call sequence change in WTF.cpp from initialize(histogram); to initialize(); > setHistogram(histogram) looks equivalent to me? Currnetly initialize() (without the histogram) is called before WTF::initialize() calls initialize(histogram). Before this CL: void WTF::initialize() { Partitions::initialize(histogram); // This does nothing because Partitions::initialize() is already called. Thus we failed in setting the histogram function. } After hit CL: void WTF::initialize() { Partitions::initialize(); // This does nothing because Partitions::initialize() is already called. Partitions::setHistogramFunction(histogramFunction); // This sets the histogram function. }
On 2015/06/17 16:42:21, haraken wrote: > On 2015/06/17 16:36:36, Chris Evans wrote: > > On 2015/06/17 14:21:13, haraken wrote: > > > +cevans for owner review. > > > > I don't quite understand what this CL changes? Is this a first CL in a series, > > or is it supposed to have an effect on its own? > > The call sequence change in WTF.cpp from initialize(histogram); to > initialize(); > > setHistogram(histogram) looks equivalent to me? > > Currnetly initialize() (without the histogram) is called before > WTF::initialize() calls initialize(histogram). > > Before this CL: > > void WTF::initialize() { > Partitions::initialize(histogram); // This does nothing because > Partitions::initialize() is already called. Thus we failed in setting the > histogram function. > } > > After hit CL: > > void WTF::initialize() { > Partitions::initialize(); // This does nothing because > Partitions::initialize() is already called. > Partitions::setHistogramFunction(histogramFunction); // This sets the > histogram function. > } Thanks! In the case where Partitions::initialize() has already been called, where is the call site that called it? I didn't see it and I'd like to understand it :)
On 2015/06/17 17:04:05, Chris Evans wrote: > On 2015/06/17 16:42:21, haraken wrote: > > On 2015/06/17 16:36:36, Chris Evans wrote: > > > On 2015/06/17 14:21:13, haraken wrote: > > > > +cevans for owner review. > > > > > > I don't quite understand what this CL changes? Is this a first CL in a > series, > > > or is it supposed to have an effect on its own? > > > The call sequence change in WTF.cpp from initialize(histogram); to > > initialize(); > > > setHistogram(histogram) looks equivalent to me? > > > > Currnetly initialize() (without the histogram) is called before > > WTF::initialize() calls initialize(histogram). > > > > Before this CL: > > > > void WTF::initialize() { > > Partitions::initialize(histogram); // This does nothing because > > Partitions::initialize() is already called. Thus we failed in setting the > > histogram function. > > } > > > > After hit CL: > > > > void WTF::initialize() { > > Partitions::initialize(); // This does nothing because > > Partitions::initialize() is already called. > > Partitions::setHistogramFunction(histogramFunction); // This sets the > > histogram function. > > } > > Thanks! In the case where Partitions::initialize() has already been called, > where is the call site that called it? I didn't see it and I'd like to > understand it :) This is one place bashi@ found: https://codereview.chromium.org/1182083006/. I'm not sure if there are other places. It's important to enable the UMA asap, so we're planning to land this CL.
On 2015/06/17 17:45:07, haraken wrote: > On 2015/06/17 17:04:05, Chris Evans wrote: > > On 2015/06/17 16:42:21, haraken wrote: > > > On 2015/06/17 16:36:36, Chris Evans wrote: > > > > On 2015/06/17 14:21:13, haraken wrote: > > > > > +cevans for owner review. > > > > > > > > I don't quite understand what this CL changes? Is this a first CL in a > > series, > > > > or is it supposed to have an effect on its own? > > > > The call sequence change in WTF.cpp from initialize(histogram); to > > > initialize(); > > > > setHistogram(histogram) looks equivalent to me? > > > > > > Currnetly initialize() (without the histogram) is called before > > > WTF::initialize() calls initialize(histogram). > > > > > > Before this CL: > > > > > > void WTF::initialize() { > > > Partitions::initialize(histogram); // This does nothing because > > > Partitions::initialize() is already called. Thus we failed in setting the > > > histogram function. > > > } > > > > > > After hit CL: > > > > > > void WTF::initialize() { > > > Partitions::initialize(); // This does nothing because > > > Partitions::initialize() is already called. > > > Partitions::setHistogramFunction(histogramFunction); // This sets the > > > histogram function. > > > } > > > > Thanks! In the case where Partitions::initialize() has already been called, > > where is the call site that called it? I didn't see it and I'd like to > > understand it :) > > This is one place bashi@ found: https://codereview.chromium.org/1182083006/. I'm > not sure if there are other places. > > It's important to enable the UMA asap, so we're planning to land this CL. Thank you. I understand this now. I agree that making sure that initialize() is called prior to any allocations would be awesome. I like the comments to the effect that you added in Partitions.h. Getting rid of those initialization branches in that inlined code might even speed things up a little :) LGTM
https://codereview.chromium.org/1190883003/diff/40001/Source/wtf/Partitions.cpp File Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1190883003/diff/40001/Source/wtf/Partitions.c... Source/wtf/Partitions.cpp:52: // rely on isMainThread() at this point. On 2015/06/17 14:20:33, haraken wrote: > > Sorry, I noticed this file is already including MainThread.h. But I think you > can remove this comment, since it's not a big deal. > Removed.
The CQ bit was checked by bashi@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from haraken@chromium.org, cevans@chromium.org Link to the patchset: https://codereview.chromium.org/1190883003/#ps60001 (title: " ")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1190883003/60001
Message was sent while issue was closed.
Committed patchset #3 (id:60001) as https://src.chromium.org/viewvc/blink?view=rev&revision=197413 |