Closed
Bug 29338
Opened 25 years ago
Closed 24 years ago
PR_Poll should not poll (spin) on Mac
Categories
(Core :: Networking, defect, P4)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: warrensomebody, Assigned: sfraser_bugs)
References
Details
(Keywords: perf)
Attachments
(5 files)
2.40 KB,
patch
|
Details | Diff | Splinter Review | |
649 bytes,
patch
|
Details | Diff | Splinter Review | |
793 bytes,
patch
|
Details | Diff | Splinter Review | |
2.49 KB,
patch
|
Details | Diff | Splinter Review | |
1.55 KB,
patch
|
Details | Diff | Splinter Review |
Right now, the mac implementation of PR_Poll sits in a loop with a Sleep call --
when the sleep times out it checks for i/o completion. If we make this timeout
smaller, we get better i/o throughput (see bug 25108), but that may have the
effect of starving other threads because we spin, checking too often.
What really needs to be done here, is PR_Poll should wake up in response to
async i/o completion routines. We can leverage the
PR_Mac_PostAsyncNotify/PR_Mac_WaitForAsyncNotify stuff that Gordon did for async
dns to do this.
Reporter | ||
Updated•25 years ago
|
Reporter | ||
Comment 1•25 years ago
|
||
Moving post beta bugs to M18 which is now the post-beta milestone.
Target Milestone: M17 → M18
warren: should this be considered for nsbeta3? Do we know what performance
enhancements we get? pls. reassign to gordon if you think this needs to be done
by nsbeta3
Assignee: gordon → warren
Reporter | ||
Comment 3•24 years ago
|
||
This never got done? Ugh. Do we have any profiling tools for the mac? I suspect
that this seriously eats into our performance while downloading.
Reporter | ||
Comment 4•24 years ago
|
||
Simon: This should go on your "mac doesn't suck" list.
Assignee | ||
Comment 5•24 years ago
|
||
Add the needinfo status. Someone needs to figure out how much of a performance
hit this is causing. Gordon?
Whiteboard: [NEEDINFO]
Assignee | ||
Comment 6•24 years ago
|
||
Reassign to gordon per Mac meeting today.
Assignee: warren → gordon
getting it on the correct nsbeta3+ radar.
per PDT: P3-P5 priority bugs changed from nsbeta3+ to nsbeta3- since we have
more important work to do for Seamonkey. If you disagree, please state your case
in the bug report and nominate for rtm and adjust priority if this bug was
mis-prioritized. Thanks.
Whiteboard: [NEEDINFO][nsbeta3+] → [NEEDINFO][nsbeta3-]
Assignee | ||
Comment 9•24 years ago
|
||
Gordon: please report progress in this bug.
Comment 11•24 years ago
|
||
cleanup
Comment 12•24 years ago
|
||
When PR_Poll wakes up there should be some async IO ready to be processed.
Currently, the mac implemention wakes up when there isn't any. This caused some
hackery in the nsSocketTransport which we have to check to see if the available
on the transport is zero on the mac and if so bump it to some positive number.
This seams just really wrong.
What is the status of making PR_Poll on the mac not suck?
Comment 13•24 years ago
|
||
re-cleaning up after dougt blasted away my changes.
Comment 14•24 years ago
|
||
PR_Poll on Mac should be rewritten to use PR_WaitForAsyncNotify (read the
beginning of this description). I'm working on the cache at the moment. If
another Mac engineer familiar with NSPR wants to take a crack at it, great.
Otherwise, it will have to wait until the first phase of cache development is
done. Fixing the cache will probably make a much bigger improvement to Mac
performance than fixing this bug.
Assignee | ||
Comment 15•24 years ago
|
||
Gordon and I looked into this some more today. It turns out that to really
achieve parity with other platforms, and get good performance benefits, we need
to fix both PR_Poll, and to implement Pollable Events on Mac. This is because the
socket transport in Mozilla calls PR_Poll with a short timeout (5ms) if pollable
events are not available. This is conditionalized with #ifdef USE_POLLABLE_EVENT
in nsSocketTransportService.
Implementing pollable events should be fairly straightforward; on Mac, you would
have to do little more than wake the PR_Poll thread when the pollable event is
set.
Another task that should be done at the same time is to unify the two async IO
thread notification mechanisms we have now (WaitOnThisThread() vs.
PR_Mac_WaitForAsyncNotify()).
Gordon won't have time to get to this bug until after Necko cache work is done.
Do we have any other takers?
Comment 16•24 years ago
|
||
Looks like I need to talk to wtc about restoring my NSPR checkin privs
Assignee: gordon → sdagley
Comment 17•24 years ago
|
||
Do you have a patch ready? Should we get together with Simon or Patrick to
review it?
Comment 18•24 years ago
|
||
No, I was just anticipating having to check something in :-)
Assignee | ||
Comment 19•24 years ago
|
||
So it turns out that pollable events _do_ work on Mac. They just open a socket to
localhost, and write into it. So the fix for this bug is rather simple; just
ensure that we save the thread on which PR_Poll is being called for each
PollDesc, and, in the notifier routine, wake this thread (rather than the read or
write thread). I also fixed nsSocketTransportService.h to tell it that we have
pollable events on Mac.
Assignee | ||
Comment 20•24 years ago
|
||
Assignee | ||
Comment 21•24 years ago
|
||
Assignee | ||
Comment 22•24 years ago
|
||
Disclaimer: I really don't know what I'm doing in NSPR. These patches appear to
work for me, and FTP and mail still work. But YMMV, emptor caveat, results are
not typical.
Comment 23•24 years ago
|
||
I'll get these patches into a build later today and beat on them (and being on a
100BaseT switched network in B20 should make for some interesting perf testing :-
)
Status: NEW → ASSIGNED
Assignee | ||
Comment 24•24 years ago
|
||
Questions for Wan-Teh:
1. Can we assume that PR_Poll is called on the same thread from which reading and
writing occurs? (The patch does not assume this).
2. Can we assume that waking the PR_Poll thread from our I/O notifier will be
sufficient to later wake the read/write threads (if different)? The patch
currently assumes this.
3. Finally, the changes in prsocket.c are unfortunate, in that this is not a mac-
only file. Is there a better place to set the polling thread member of the
polled fd?
Comment 25•24 years ago
|
||
(I am going on sabbatical this Saturday, March 3.)
Answers to Simon's questions.
1. No, we can't assume that PR_Poll is called on the same
thread from which reading and writing occurs.
2. No, waking the PR_Poll thread from our I/O notifier will
not be sufficient to later wake the read/write threads
if different.
3. A better place to set the polling thread member of the
poll fd would be in _MD_poll() in macsockotpt.c.
Updated•24 years ago
|
Target Milestone: --- → mozilla0.9
Assignee | ||
Comment 26•24 years ago
|
||
Comment 27•24 years ago
|
||
r=dougt on patch 26467
Assignee | ||
Comment 28•24 years ago
|
||
Assignee | ||
Comment 29•24 years ago
|
||
Assignee | ||
Comment 30•24 years ago
|
||
I attach final diffs for checkin. The changes I made are:
1. NSPR:
i) moved setting the poll thread into _MD_Poll, rather than #ifdef XP_MAC
code in prsocket.c.
ii) included the GetState fix which is described in bug 70408
The necko changes include both necko patches already attached to this bug.
Assignee: sdagley → gordon
Status: ASSIGNED → NEW
Assignee | ||
Comment 31•24 years ago
|
||
Note: with these changes, I tested page loading, IMAP, HTTP over SSL, activation,
SMTP, and everything worked fine.
Comment 32•24 years ago
|
||
I just checked in Simon's patches to Necko, NSPRPUB_CLIENT_BRANCH, and NSPR tip.
Assignee | ||
Comment 34•24 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•