Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poll alloc #1999

Merged
merged 4 commits into from
Dec 21, 2024
Merged

Poll alloc #1999

merged 4 commits into from
Dec 21, 2024

Conversation

gdamore
Copy link
Contributor

@gdamore gdamore commented Dec 20, 2024

fixes #

Note that the above format should be used in your git commit comments.
You agree that by submitting a PR, you have read and agreed to our
contributing guidelines.

We preallocate the arrays used for pollfds, based on what the
system can tolerate (tunable with NNG_MAX_OPEN), and we change
the code for inserting and removing pollfds from the list so
that it can run without acquiring the locks during the main loop,
only when adding or removing files.

The poll() implementation is very nearly lock free in the hot
code path, and soon will be.
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 89.28571% with 21 lines in your changes missing coverage. Please review.

Project coverage is 82.10%. Comparing base (5e18eb4) to head (1514a53).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/platform/posix/posix_pollq_epoll.c 80.70% 3 Missing and 8 partials ⚠️
src/platform/posix/posix_ipcconn.c 86.36% 3 Missing ⚠️
src/platform/posix/posix_ipcdial.c 57.14% 3 Missing ⚠️
src/platform/posix/posix_tcpdial.c 71.42% 2 Missing ⚠️
src/platform/posix/posix_sockfd.c 92.30% 1 Missing ⚠️
src/platform/posix/posix_tcplisten.c 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1999      +/-   ##
==========================================
+ Coverage   82.01%   82.10%   +0.08%     
==========================================
  Files          95       95              
  Lines       24031    23939      -92     
  Branches     3167     3153      -14     
==========================================
- Hits        19710    19656      -54     
+ Misses       4250     4209      -41     
- Partials       71       74       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This change moves the posix pollers to inline the PFD and makes
the callbacks constant, so that we can dispense with tests, failures,
and locks.  It is anticipated that this will reduce lock based
pressure on the bus and increase performance modestly.
The dialer aio needs to be set before starting the dial operation,
as the operation may complete right away.
@gdamore gdamore merged commit 1514a53 into main Dec 21, 2024
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant