RESOLVED FIXED 195938
[bmalloc][Linux] Add support for memory status calculation
https://bugs.webkit.org/show_bug.cgi?id=195938
Summary [bmalloc][Linux] Add support for memory status calculation
Zan Dobersek
Reported 2019-03-19 01:34:20 PDT
[bmalloc][Linux] Add support for memory status calculation
Attachments
WIP (6.12 KB, patch)
2019-03-19 01:34 PDT, Zan Dobersek
no flags
Patch (7.33 KB, patch)
2019-04-02 04:35 PDT, Zan Dobersek
no flags
Patch (7.14 KB, patch)
2019-04-09 04:32 PDT, Zan Dobersek
no flags
Zan Dobersek
Comment 1 2019-03-19 01:34:52 PDT
Zan Dobersek
Comment 2 2019-04-02 04:35:00 PDT
EWS Watchlist
Comment 3 2019-04-02 04:36:47 PDT
Attachment 366486 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/AvailableMemory.cpp:47: "algorithm" already included at Source/bmalloc/bmalloc/AvailableMemory.cpp:38 [build/include] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 4 2019-04-05 05:20:23 PDT
*** Bug 184684 has been marked as a duplicate of this bug. ***
Carlos Garcia Campos
Comment 5 2019-04-08 01:07:58 PDT
Comment on attachment 366486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366486&action=review > Source/bmalloc/bmalloc/AvailableMemory.cpp:112 > + if (s_singleton.statm.fd != -1) > + s_singleton.statm.valid = true; Why don't we just check fd instead of having both fd and valid? > Source/bmalloc/bmalloc/AvailableMemory.cpp:119 > + if (!statm.valid) Here we could just return early if fd == -1 > Source/bmalloc/bmalloc/AvailableMemory.cpp:123 > + ssize_t numBytes = pread(statm.fd, statmBuffer.data(), statmBuffer.size(), 0); Why using pread if the offset is always 0? > Source/bmalloc/bmalloc/AvailableMemory.cpp:144 > + } Is open/close so heavy operation? is it worth keeping the fd open forever? We are reading /proc so we are not even going to disk. > Source/bmalloc/bmalloc/AvailableMemory.cpp:146 > + long numPages { 0 }; We don't need to cache this, it's used only once in call_once()
Zan Dobersek
Comment 6 2019-04-08 01:30:59 PDT
Comment on attachment 366486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366486&action=review >> Source/bmalloc/bmalloc/AvailableMemory.cpp:123 >> + ssize_t numBytes = pread(statm.fd, statmBuffer.data(), statmBuffer.size(), 0); > > Why using pread if the offset is always 0? Cause any other read operation advances the file position to the end of the file. So for every further read, that offset has to be brought back to the start of the file. >> Source/bmalloc/bmalloc/AvailableMemory.cpp:144 >> + } > > Is open/close so heavy operation? is it worth keeping the fd open forever? We are reading /proc so we are not even going to disk. They're separate operations, meaning that two additional syscalls would have to be done for every read. With the persistent fd we can instead only use one to both bring back the file position to the start and read the contents.
Zan Dobersek
Comment 7 2019-04-09 04:32:07 PDT
EWS Watchlist
Comment 8 2019-04-09 04:33:55 PDT
Attachment 367037 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/AvailableMemory.cpp:47: "algorithm" already included at Source/bmalloc/bmalloc/AvailableMemory.cpp:38 [build/include] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 9 2019-04-13 23:46:20 PDT
Comment on attachment 367037 [details] Patch Clearing flags on attachment: 367037 Committed r244244: <https://trac.webkit.org/changeset/244244>
Zan Dobersek
Comment 10 2019-04-13 23:46:26 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2019-04-13 23:49:22 PDT
Yusuke Suzuki
Comment 12 2019-04-18 00:30:22 PDT
Olivier Blin
Comment 13 2019-04-19 08:22:00 PDT
Yusuke: your latest patch includes <array> under a BPLATFORM(IOS_FAMILY) guard, while this is necessary for BOS(LINUX) instead.
Yusuke Suzuki
Comment 14 2019-04-19 11:47:27 PDT
(In reply to Olivier Blin from comment #13) > Yusuke: your latest patch includes <array> under a BPLATFORM(IOS_FAMILY) > guard, while this is necessary for BOS(LINUX) instead. No, this is not under BPLATFORM(IOS_FAMILY) guard.
Adrian Perez
Comment 15 2019-07-05 06:36:07 PDT
*** Bug 199515 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.