RESOLVED FIXED 166684
[bmalloc] Name Scavenger thread "bmalloc scavenger"
https://bugs.webkit.org/show_bug.cgi?id=166684
Summary [bmalloc] Name Scavenger thread "bmalloc scavenger"
Yusuke Suzuki
Reported 2017-01-04 06:59:50 PST
...
Attachments
Patch (4.36 KB, patch)
2017-01-04 09:20 PST, Yusuke Suzuki
no flags
Patch (2.45 KB, patch)
2018-04-09 18:59 PDT, Yusuke Suzuki
saam: review+
ews-watchlist: commit-queue-
Archive of layout-test-results from ews122 for ios-simulator-wk2 (2.25 MB, application/zip)
2018-04-09 20:36 PDT, EWS Watchlist
no flags
Yusuke Suzuki
Comment 1 2017-01-04 09:20:11 PST
Darin Adler
Comment 2 2017-01-04 09:52:00 PST
Comment on attachment 298019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298019&action=review Seems a nice refinement to add thread names to these threads. Slightly sad that we have to do the per-platform conditionals separately in bmalloc given we already have those in WTF, but not that big a deal I guess. I’m not going to say review+ because I am not sure these thread names are good enough. > Source/bmalloc/bmalloc/AsyncTask.h:46 > + AsyncTask(Object&, const Function&, const char* threadName = "bm-task"); I think we should consider clearer more descriptive names for these threads. Keep in mind that these threads will exist in lots of different apps that just happen to be using WebKit or JavaScriptCore, and people won’t know what "bm" stands for. > Source/bmalloc/bmalloc/AsyncTask.h:82 > + // On Linux system, the max thread name length is 15. Sadly, I think this limit is motivating us to chose thread names that aren’t as descriptive as I would like on macOS and iOS. > Source/bmalloc/bmalloc/BPlatform.h:51 > +#if defined(WIN32) || defined(_WIN32) > +#define BOS_WINDOWS 1 > +#endif Doesn’t seem necessary to add this since we are not yet using it. > Source/bmalloc/bmalloc/Heap.cpp:39 > + , m_scavenger(*this, &Heap::concurrentScavenge, "bm-scavenger") Same comment about thread name being too brief.
Geoffrey Garen
Comment 3 2017-01-04 15:18:26 PST
Comment on attachment 298019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298019&action=review >> Source/bmalloc/bmalloc/AsyncTask.h:46 >> + AsyncTask(Object&, const Function&, const char* threadName = "bm-task"); > > I think we should consider clearer more descriptive names for these threads. Keep in mind that these threads will exist in lots of different apps that just happen to be using WebKit or JavaScriptCore, and people won’t know what "bm" stands for. I would just called this "name" rather than threadName. AsyncTask tries to abstract away the fact that its implementation is a thread. A queue or some other implementation would be OK too. I don't think we want a default name -- empty is probably a better default. > Source/bmalloc/bmalloc/AsyncTask.h:83 > + BASSERT(strlen(threadName) <= 15); Maybe we should just allow Linux to truncate to "bmalloc scaveng", so other platforms can use a good name. > Source/bmalloc/bmalloc/AsyncTask.h:125 > +#if BOS(DARWIN) > + pthread_setname_np(asyncTask->threadName()); > +#elif BOS(LINUX) > + prctl(PR_SET_NAME, asyncTask->threadName()); > +#endif I think Linux supports pthread_setname_np -- maybe we can simplify by using it there too. >> Source/bmalloc/bmalloc/Heap.cpp:39 >> + , m_scavenger(*this, &Heap::concurrentScavenge, "bm-scavenger") > > Same comment about thread name being too brief. I'd call this "bmalloc scavenger".
Michael Catanzaro
Comment 4 2017-01-04 15:48:32 PST
(In reply to comment #3) > > Source/bmalloc/bmalloc/AsyncTask.h:125 > > +#if BOS(DARWIN) > > + pthread_setname_np(asyncTask->threadName()); > > +#elif BOS(LINUX) > > + prctl(PR_SET_NAME, asyncTask->threadName()); > > +#endif > > I think Linux supports pthread_setname_np -- maybe we can simplify by using > it there too. Hm, you're right. There is a behavior difference though. prctl will silently truncate the thread name if it's longer than 16 characters. pthread_setname_np will instead fail and set ERANGE.
Yusuke Suzuki
Comment 5 2017-01-04 20:30:37 PST
I've posted the mail about thread naming policy. https://lists.webkit.org/pipermail/webkit-dev/2017-January/028585.html
Michael Catanzaro
Comment 6 2018-04-09 17:41:55 PDT
Um, Yusuke, I remember you had done quite some work on thread naming. Is this obsolete?
Yusuke Suzuki
Comment 7 2018-04-09 18:38:14 PDT
(In reply to Michael Catanzaro from comment #6) > Um, Yusuke, I remember you had done quite some work on thread naming. Is > this obsolete? I'll restart this bmalloc change again.
Yusuke Suzuki
Comment 8 2018-04-09 18:56:55 PDT
Comment on attachment 298019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298019&action=review >>> Source/bmalloc/bmalloc/AsyncTask.h:46 >>> + AsyncTask(Object&, const Function&, const char* threadName = "bm-task"); >> >> I think we should consider clearer more descriptive names for these threads. Keep in mind that these threads will exist in lots of different apps that just happen to be using WebKit or JavaScriptCore, and people won’t know what "bm" stands for. > > I would just called this "name" rather than threadName. AsyncTask tries to abstract away the fact that its implementation is a thread. A queue or some other implementation would be OK too. > > I don't think we want a default name -- empty is probably a better default. OK, use `bmalloc scavenger`. >> Source/bmalloc/bmalloc/AsyncTask.h:82 >> + // On Linux system, the max thread name length is 15. > > Sadly, I think this limit is motivating us to chose thread names that aren’t as descriptive as I would like on macOS and iOS. Use untruncated name for macOS. In Linux, we truncate the name into 16 length. >> Source/bmalloc/bmalloc/AsyncTask.h:83 >> + BASSERT(strlen(threadName) <= 15); > > Maybe we should just allow Linux to truncate to "bmalloc scaveng", so other platforms can use a good name. Done. >> Source/bmalloc/bmalloc/AsyncTask.h:125 >> +#endif > > I think Linux supports pthread_setname_np -- maybe we can simplify by using it there too. Right. But funny thing is that "pthread_setname_np" signature is different in Linux and Darwin. So still ifdef is necessary. But we can use pthread_setname_np for both. Fixed. >> Source/bmalloc/bmalloc/BPlatform.h:51 >> +#endif > > Doesn’t seem necessary to add this since we are not yet using it. Thanks. This change is discarded since they are already introduced in bmalloc ToT in the other change. >>> Source/bmalloc/bmalloc/Heap.cpp:39 >>> + , m_scavenger(*this, &Heap::concurrentScavenge, "bm-scavenger") >> >> Same comment about thread name being too brief. > > I'd call this "bmalloc scavenger". OK, let's use the name "bmalloc scavenger" for now in both Linux and macOS.
Yusuke Suzuki
Comment 9 2018-04-09 18:59:51 PDT
EWS Watchlist
Comment 10 2018-04-09 20:36:06 PDT
Comment on attachment 337574 [details] Patch Attachment 337574 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/7262535 New failing tests: imported/w3c/web-platform-tests/workers/name-property.html
EWS Watchlist
Comment 11 2018-04-09 20:36:08 PDT
Created attachment 337580 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.4
Yusuke Suzuki
Comment 12 2018-04-09 22:29:01 PDT
(In reply to Build Bot from comment #10) > Comment on attachment 337574 [details] > Patch > > Attachment 337574 [details] did not pass ios-sim-ews (ios-simulator-wk2): > Output: http://webkit-queues.webkit.org/results/7262535 > > New failing tests: > imported/w3c/web-platform-tests/workers/name-property.html The results seem not related to this change. It is not related to bmalloc scavenger thread.
Saam Barati
Comment 13 2018-04-09 23:25:34 PDT
Comment on attachment 337574 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337574&action=review > Source/bmalloc/bmalloc/Scavenger.h:86 > + void setName(const char*); I'd call this setThreadName or something like that.
Yusuke Suzuki
Comment 14 2018-04-10 00:55:43 PDT
Comment on attachment 337574 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337574&action=review >> Source/bmalloc/bmalloc/Scavenger.h:86 >> + void setName(const char*); > > I'd call this setThreadName or something like that. OK, fixed.
Yusuke Suzuki
Comment 15 2018-04-10 00:58:36 PDT
Radar WebKit Bug Importer
Comment 16 2018-04-10 01:00:33 PDT
Darin Adler
Comment 17 2018-04-11 11:00:32 PDT
Still not thrilled about this thread name on Apple’s platforms like iOS and macOS. Might want to improve the situation there with additional changes. Thread names are seen in crash logs by many who are not expert on the internals of WebKit, and the name "bmalloc" might not make anyone think of JavaScriptCore or WebKit: those are the public names of the frameworks that make use of bmalloc.
Yusuke Suzuki
Comment 18 2018-04-17 14:23:34 PDT
(In reply to Darin Adler from comment #17) > Still not thrilled about this thread name on Apple’s platforms like iOS and > macOS. Might want to improve the situation there with additional changes. > Thread names are seen in crash logs by many who are not expert on the > internals of WebKit, and the name "bmalloc" might not make anyone think of > JavaScriptCore or WebKit: those are the public names of the frameworks that > make use of bmalloc. maybe having two names for linux and others is the best way. if we add more words to the name, the name becomes too difficult to understand in linux. “JavaScriptCore bmalloc scavenger” / “bm-scavenger” would be better. I’ll land the follow up for that.
Yusuke Suzuki
Comment 19 2018-04-21 14:58:57 PDT
Note You need to log in before you can comment on or make changes to this bug.