-
Notifications
You must be signed in to change notification settings - Fork 103
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
Mekhanik evgenii/1411 rework allocation streams #2164
base: master
Are you sure you want to change the base?
Mekhanik evgenii/1411 rework allocation streams #2164
Conversation
In previous commit we decide to allocate 2 pages after http2 connection and use free space after http2 connection structure for stream schedulers. But for negotiable (which can be http1 or http2) we use http2 connection structure also. So for such connections (if it is http1 connection) we allocate 2 pages for stream schedulers which are not used in fact. Now allocation strategy was changed: we allocate 2 pages for http2 context, which now is a pointer in http2 connection, so we don't allocate extra memory for http1 negotiable connection.
ca429e9
to
3fac4e8
Compare
|
||
conn->h2 = tfw_h2_context_alloc(); | ||
if (!conn->h2) | ||
return -ENOMEM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to ask you to print T_ERR
in case of ENOMEM
as well. And really minor thing, maybe move TfwH2Conn *conn = (TfwH2Conn*)tls->sk->sk_user_data
into if (TFW_FSM_TYPE(sk_proto) == TFW_FSM_H2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes fixed
{ | ||
struct page *pg; | ||
|
||
pg = alloc_pages(GFP_ATOMIC, TFW_H2_PAGE_ORDER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decide for better memory locality to preallocate 8 pages
But you allocating 4 pages, is commit message correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes fixed. We decide to allocate 2 pages.
{ | ||
TfwStream *stream = (TfwStream *)base; | ||
|
||
while ((char *)stream <= (char *)next_block - sizeof(TfwStream)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems here is memory corruption because of <=
, in case when quantity is a multiple of size, the store will be filled without hole in the end that need for storing pointer to next block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why if stream == next - sizeof(TfwStream) we have one place for struct stream. I am not right?
According to our ivsetigation typical streams count opened by browser is about 15 - 25. We decide for better memory locality to preallocate 2 pages (8192 bytes, this is enough for 29 streams) and use it as a streams memory. If is memory is exceeded we allocate new 2 pages and use as a streams memory again. We use 8 bytes at the end of the memory which is used for streams as a pointer to the new page block.
ecc12dd
to
80e7ec3
Compare
No description provided.