Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Issue 1409743002: Re-land: base: Use MADV_REMOVE instead of ftruncate to purge discardable memory segments. (Closed)

Created:
5 years, 2 months ago by reveman
Modified:
5 years, 2 months ago
CC:
chromium-reviews, darin-cc_chromium.org, gavinp+memory_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Re-land: base: Use MADV_REMOVE instead of ftruncate to purge discardable memory segments. This makes the discardable memory implementation use madvise(MADV_REMOVE) to tell the kernel to free resources associated with purged pages. This cleans up the code as madvise - unlike ftruncate - doesn't require us to keep the file descriptor open and it has the huge advantage that discardable memory can be shared between a renderer and the GPU process. This also works with Ashmem for which ftrunctate is not supported. BUG=543633 TEST=base_unittests --gtest_filter=DiscardableSharedMemoryTest.ZeroFilledPagesAfterPurge, content_unittests --gtest_filter=HostDiscardableSharedMemoryManagerTest.ReduceMemoryAfterSegmentHasBeenDeleted Committed: https://crrev.com/adfe91aac022080722ba8a24d4de79700dc38da4 Cr-Commit-Position: refs/heads/master@{#355663}

Patch Set 1 #

Total comments: 4

Patch Set 2 : remove unnecessary HANDLE_EINTR #

Patch Set 3 : use MADV_REMOVE instead #

Patch Set 4 : include DISCARDABLE_SHARED_MEMORY_REMOVE #

Patch Set 5 : try MADV_FREE if MADV_REMOVE is missing #

Patch Set 6 : how about MADV_DONTNEED? #

Patch Set 7 : linux and android only #

Total comments: 2

Patch Set 8 : use MADV_FREE when MADV_REMOVE is missing #

Patch Set 9 : add comment explaining the use of MADV_FREE #

Total comments: 6

Patch Set 10 : update comments #

Total comments: 4

Patch Set 11 : better name for define and improved comments #

Patch Set 12 : fix problem with segment having been released before we try to purge #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -59 lines) Patch
M base/memory/discardable_shared_memory.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +9 lines, -10 lines 0 comments Download
M base/memory/discardable_shared_memory.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +23 lines, -27 lines 0 comments Download
M base/memory/discardable_shared_memory_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +33 lines, -8 lines 0 comments Download
M content/common/host_discardable_shared_memory_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -14 lines 0 comments Download
M content/common/host_discardable_shared_memory_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +42 lines, -0 lines 0 comments Download

Messages

Total messages: 56 (23 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/1
5 years, 2 months ago (2015-10-15 19:14:34 UTC) #2
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-15 20:32:18 UTC) #4
reveman
5 years, 2 months ago (2015-10-15 21:20:37 UTC) #6
Primiano Tucci (use gerrit)
LGTM, one doubt from my side: do we ever run into cases where memory is ...
5 years, 2 months ago (2015-10-16 09:31:43 UTC) #7
reveman
On 2015/10/16 at 09:31:43, primiano wrote: > LGTM, one doubt from my side: > do ...
5 years, 2 months ago (2015-10-16 14:24:43 UTC) #8
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/20001
5 years, 2 months ago (2015-10-16 14:25:13 UTC) #10
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-16 17:02:27 UTC) #12
reveman
+avi for content/ +danakj for base/
5 years, 2 months ago (2015-10-19 19:43:32 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/120001
5 years, 2 months ago (2015-10-19 19:43:59 UTC) #19
danakj
https://codereview.chromium.org/1409743002/diff/120001/base/memory/discardable_shared_memory.cc File base/memory/discardable_shared_memory.cc (right): https://codereview.chromium.org/1409743002/diff/120001/base/memory/discardable_shared_memory.cc#newcode7 base/memory/discardable_shared_memory.cc:7: #if defined(OS_POSIX) && !defined(OS_NACL) Why this and not #ifdef ...
5 years, 2 months ago (2015-10-19 20:03:10 UTC) #20
Avi (use Gerrit)
lgtm when danakj is happy
5 years, 2 months ago (2015-10-19 20:19:17 UTC) #21
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-19 21:05:45 UTC) #23
reveman
PTAL https://codereview.chromium.org/1409743002/diff/120001/base/memory/discardable_shared_memory.cc File base/memory/discardable_shared_memory.cc (right): https://codereview.chromium.org/1409743002/diff/120001/base/memory/discardable_shared_memory.cc#newcode7 base/memory/discardable_shared_memory.cc:7: #if defined(OS_POSIX) && !defined(OS_NACL) On 2015/10/19 at 20:03:09, ...
5 years, 2 months ago (2015-10-19 22:20:22 UTC) #25
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/60002 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/60002
5 years, 2 months ago (2015-10-19 22:21:44 UTC) #27
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-19 23:53:41 UTC) #29
Primiano Tucci (use gerrit)
Still LGTM with just some comments on comments. Just a note: remember that if in ...
5 years, 2 months ago (2015-10-20 13:33:39 UTC) #30
danakj
https://codereview.chromium.org/1409743002/diff/60002/base/memory/discardable_shared_memory.cc File base/memory/discardable_shared_memory.cc (right): https://codereview.chromium.org/1409743002/diff/60002/base/memory/discardable_shared_memory.cc#newcode7 base/memory/discardable_shared_memory.cc:7: #if defined(OS_POSIX) && !defined(OS_NACL) I'm still kinda uncomfortable with ...
5 years, 2 months ago (2015-10-20 18:04:04 UTC) #31
reveman
On 2015/10/20 at 13:33:39, primiano wrote: > Still LGTM with just some comments on comments. ...
5 years, 2 months ago (2015-10-21 14:50:57 UTC) #32
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/170001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/170001
5 years, 2 months ago (2015-10-21 14:51:12 UTC) #34
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-21 15:56:13 UTC) #36
danakj
https://codereview.chromium.org/1409743002/diff/170001/base/memory/discardable_shared_memory.cc File base/memory/discardable_shared_memory.cc (right): https://codereview.chromium.org/1409743002/diff/170001/base/memory/discardable_shared_memory.cc#newcode29 base/memory/discardable_shared_memory.cc:29: #define MADV_REMOVE MADV_FREE Rather than defining MADV_REMOVE ourselves, can ...
5 years, 2 months ago (2015-10-21 18:34:25 UTC) #37
reveman
https://codereview.chromium.org/1409743002/diff/170001/base/memory/discardable_shared_memory.h File base/memory/discardable_shared_memory.h (right): https://codereview.chromium.org/1409743002/diff/170001/base/memory/discardable_shared_memory.h#newcode23 base/memory/discardable_shared_memory.h:23: #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL) On 2015/10/21 at ...
5 years, 2 months ago (2015-10-21 19:28:53 UTC) #38
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/190001
5 years, 2 months ago (2015-10-21 19:29:20 UTC) #40
danakj
Thanks! LGTM
5 years, 2 months ago (2015-10-21 19:59:44 UTC) #41
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-21 20:36:31 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/190001
5 years, 2 months ago (2015-10-21 20:37:47 UTC) #46
commit-bot: I haz the power
Committed patchset #11 (id:190001)
5 years, 2 months ago (2015-10-21 20:42:51 UTC) #47
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/dc9010e6a83e6cc0e424d482fe038d4b1c889f60 Cr-Commit-Position: refs/heads/master@{#355391}
5 years, 2 months ago (2015-10-21 20:43:30 UTC) #48
reveman
A revert of this CL (patchset #11 id:190001) has been created in https://codereview.chromium.org/1413163006/ by reveman@chromium.org. ...
5 years, 2 months ago (2015-10-22 18:12:37 UTC) #49
reveman
Latest patch fixes the problem that resulted in this causing crashes and includes a new ...
5 years, 2 months ago (2015-10-22 21:31:25 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409743002/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409743002/210001
5 years, 2 months ago (2015-10-22 21:32:21 UTC) #54
commit-bot: I haz the power
Committed patchset #12 (id:210001)
5 years, 2 months ago (2015-10-22 23:05:21 UTC) #55
commit-bot: I haz the power
5 years, 2 months ago (2015-10-22 23:06:22 UTC) #56
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/adfe91aac022080722ba8a24d4de79700dc38da4
Cr-Commit-Position: refs/heads/master@{#355663}

Powered by Google App Engine
This is Rietveld 408576698