|
|
Created:
4 years ago by bcwhite Modified:
3 years, 11 months ago Reviewers:
Alexei Svitkine (slow) CC:
chromium-reviews, asvitkine+watch_chromium.org, vmpstr+watch_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionImproved support for objects inside persistent memory.
Some compilers, including MSVC, don't consider std::atomic as a POD-
compatible type which makes it impossible to include them in persistent
memory when using the object interface -- something which is obviously
desireable.
New "object" management embeds the type directly in the class/struct
definition and runs the default constructor of the type after allocation,
thus making the allocator compatible with a much greater range of types.
BUG=546019
Review-Url: https://codereview.chromium.org/2578323002
Cr-Commit-Position: refs/heads/master@{#442884}
Committed: https://chromium.googlesource.com/chromium/src/+/3f999d3d054de11816d1a97c887753b26013c853
Patch Set 1 #Patch Set 2 : some clean-up and rebased #Patch Set 3 : added comments and DeleteObject #Patch Set 4 : rebased #
Total comments: 8
Patch Set 5 : addressed review comments by asvitkine #
Total comments: 6
Patch Set 6 : addressed review comments by asvitkine #
Messages
Total messages: 61 (51 generated)
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-device-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-xcode-...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) ios-simulator-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-xco...) mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) ios-simulator-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-xco...)
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Patchset #4 (id:60001) has been deleted
Patchset #3 (id:40001) has been deleted
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #3 (id:80001) has been deleted
bcwhite@chromium.org changed reviewers: + asvitkine@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... File base/metrics/persistent_memory_allocator.h (right): https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:183: // Helper function to convert a generic pointer back into a reference. Nit: "Helper function to" is redundant. Just "Converts a generic pointer back into a reference.". Maybe mention what happens if the pointer is not found as well? Same for the function below. https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:404: // can be used. I'm curious what the use case for ChangeType and ChangeObjects are? Why have this complexity in the underlying class rather than just not supporting it directly and letting the caller delete and create new objects as necessary? If it's not a widely used case, I'd rather we don't include support for it so that the code is that much simpler and there's less room for errors. https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:411: // to exist; no destructor is called for it. Is it worth adding a warning here that this may result in undefined behavior if someone has a pointer to the existing object and is modifying/using it at the same time? https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:421: DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(mem) & (ALIGNOF(T) - 1)); Nit: Add a comment about this - why is it expected?
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... File base/metrics/persistent_memory_allocator.h (right): https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:183: // Helper function to convert a generic pointer back into a reference. On 2017/01/06 16:29:33, Alexei Svitkine (slow) wrote: > Nit: "Helper function to" is redundant. Just "Converts a generic pointer back > into a reference.". Maybe mention what happens if the pointer is not found as > well? > > Same for the function below. Done. https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:404: // can be used. On 2017/01/06 16:29:33, Alexei Svitkine (slow) wrote: > I'm curious what the use case for ChangeType and ChangeObjects are? > > Why have this complexity in the underlying class rather than just not supporting > it directly and letting the caller delete and create new objects as necessary? > > If it's not a widely used case, I'd rather we don't include support for it so > that the code is that much simpler and there's less room for errors. The nature of persistent allocation is such that "free" is not practical. The lock-free complexity of managing of multiple blocks of unallocated space is huge and so the decision was made during development to omit it. Even changing the type can be problematic but then it's something that is being done outside this class which leaves the management of potential problems to the caller which, because it has more knowledge about how the data is being used, can ensure proper operation. Changing the type is generally used to mark an object as "free" because it is being destroyed and shouldn't be found by later iteration. Sometimes the "free type" is used to re-use that space when creating new objects of that same type (and thus same size). https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:411: // to exist; no destructor is called for it. On 2017/01/06 16:29:34, Alexei Svitkine (slow) wrote: > Is it worth adding a warning here that this may result in undefined behavior if > someone has a pointer to the existing object and is modifying/using it at the > same time? Done. https://codereview.chromium.org/2578323002/diff/120001/base/metrics/persisten... base/metrics/persistent_memory_allocator.h:421: DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(mem) & (ALIGNOF(T) - 1)); On 2017/01/06 16:29:34, Alexei Svitkine (slow) wrote: > Nit: Add a comment about this - why is it expected? Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2578323002/diff/140001/base/metrics/field_tri... File base/metrics/field_trial.cc (right): https://codereview.chromium.org/2578323002/diff/140001/base/metrics/field_tri... base/metrics/field_trial.cc:1282: entry->activated = trial_state.activated; Preserve the NoBarrier_Store() here? https://codereview.chromium.org/2578323002/diff/140001/base/metrics/field_tri... base/metrics/field_trial.cc:1316: entry->activated = true; Preserve the NoBarrier_Store() here? https://codereview.chromium.org/2578323002/diff/140001/base/metrics/persisten... File base/metrics/persistent_histogram_allocator.cc (right): https://codereview.chromium.org/2578323002/diff/140001/base/metrics/persisten... base/metrics/persistent_histogram_allocator.cc:846: DCHECK(data); Remove this since the outer while guarantees this.
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2578323002/diff/140001/base/metrics/field_tri... File base/metrics/field_trial.cc (right): https://codereview.chromium.org/2578323002/diff/140001/base/metrics/field_tri... base/metrics/field_trial.cc:1282: entry->activated = trial_state.activated; On 2017/01/10 18:01:04, Alexei Svitkine (slow) wrote: > Preserve the NoBarrier_Store() here? Done. https://codereview.chromium.org/2578323002/diff/140001/base/metrics/field_tri... base/metrics/field_trial.cc:1316: entry->activated = true; On 2017/01/10 18:01:03, Alexei Svitkine (slow) wrote: > Preserve the NoBarrier_Store() here? Done. https://codereview.chromium.org/2578323002/diff/140001/base/metrics/persisten... File base/metrics/persistent_histogram_allocator.cc (right): https://codereview.chromium.org/2578323002/diff/140001/base/metrics/persisten... base/metrics/persistent_histogram_allocator.cc:846: DCHECK(data); On 2017/01/10 18:01:04, Alexei Svitkine (slow) wrote: > Remove this since the outer while guarantees this. Done.
lgtm
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by bcwhite@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by bcwhite@chromium.org to run a CQ dry run
Patchset #6 (id:160001) has been deleted
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by bcwhite@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from asvitkine@chromium.org Link to the patchset: https://codereview.chromium.org/2578323002/#ps180001 (title: "addressed review comments by asvitkine")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 180001, "attempt_start_ts": 1484138294125480, "parent_rev": "33819cefcc12915026026b12e66fc773fa531ceb", "commit_rev": "3f999d3d054de11816d1a97c887753b26013c853"}
Message was sent while issue was closed.
Description was changed from ========== Improved support for objects inside persistent memory. Some compilers, including MSVC, don't consider std::atomic as a POD- compatible type which makes it impossible to include them in persistent memory when using the object interface -- something which is obviously desireable. New "object" management embeds the type directly in the class/struct definition and runs the default constructor of the type after allocation, thus making the allocator compatible with a much greater range of types. BUG=546019 ========== to ========== Improved support for objects inside persistent memory. Some compilers, including MSVC, don't consider std::atomic as a POD- compatible type which makes it impossible to include them in persistent memory when using the object interface -- something which is obviously desireable. New "object" management embeds the type directly in the class/struct definition and runs the default constructor of the type after allocation, thus making the allocator compatible with a much greater range of types. BUG=546019 Review-Url: https://codereview.chromium.org/2578323002 Cr-Commit-Position: refs/heads/master@{#442884} Committed: https://chromium.googlesource.com/chromium/src/+/3f999d3d054de11816d1a97c8877... ==========
Message was sent while issue was closed.
Committed patchset #6 (id:180001) as https://chromium.googlesource.com/chromium/src/+/3f999d3d054de11816d1a97c8877... |