Mekhanik evgenii/1411 rework allocation streams#2164
Mekhanik evgenii/1411 rework allocation streams#2164EvgeniiMekhanik wants to merge 2 commits intomasterfrom
Conversation
ca429e9 to
3fac4e8
Compare
|
|
||
| conn->h2 = tfw_h2_context_alloc(); | ||
| if (!conn->h2) | ||
| return -ENOMEM; |
There was a problem hiding this comment.
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)
| { | ||
| struct page *pg; | ||
|
|
||
| pg = alloc_pages(GFP_ATOMIC, TFW_H2_PAGE_ORDER); |
There was a problem hiding this comment.
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.
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.
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.
Why if stream == next - sizeof(TfwStream) we have one place for struct stream. I am not right?
ecc12dd to
80e7ec3
Compare
80e7ec3 to
d73ba77
Compare
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.
d73ba77 to
0098980
Compare
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.
0098980 to
6ad1904
Compare
No description provided.