Skip to content

Last fixes according 1715#2651

Merged
EvgeniiMekhanik merged 6 commits into
masterfrom
jinhua/fix-1346-slow-read
May 12, 2026
Merged

Last fixes according 1715#2651
EvgeniiMekhanik merged 6 commits into
masterfrom
jinhua/fix-1346-slow-read

Conversation

@EvgeniiMekhanik
Copy link
Copy Markdown
Contributor

No description provided.

@EvgeniiMekhanik EvgeniiMekhanik requested review from const-t and krizhanovsky and removed request for krizhanovsky May 4, 2026 13:17
@EvgeniiMekhanik
Copy link
Copy Markdown
Contributor Author

The name of branch is euqal to the appropriate branch in tempesta-test repository.

@EvgeniiMekhanik EvgeniiMekhanik force-pushed the jinhua/fix-1346-slow-read branch 2 times, most recently from 3729ce1 to 7df7a34 Compare May 5, 2026 07:45
- Rename `client_mem_cache` to `tfw_client_mem_cache`.
- Change `in_free_list` from struct list_head to pointer
  to save 8 bytes.
- Implement 1GB mem limit by default.
- Remove zeroing `skb->dev` from `ss_skb_init_for_xmit`. We already
  zero `skb->dev` at the beginning of processing skb and we don't need
  to do it at the end, because we don't use it.
Add extra sanity checks:
Warn in `cli_mem_release` if client memory is not
zero at release time.
Warn in `ss_skb_dflt_destructor` if skb memory counter is
not fully decremented.
These checks help detect memory accounting leaks earlier.
- Add comments for new implemented BUG_ONs
- Remove BUG_ON from `tfw_h2_stream_send_postponed`.
  There is a possible case when conn->write_queue is
  not empty.
- Remove http2 `ctx` from tfw_h2_entail_stream_skb`
  arguments.
- Implement range for this option from 1K (such small
  value for test purposes) to 100G.
- Use common new implemented `tfw_cfg_set_mem_val` function
  to parse and check this option.
@EvgeniiMekhanik EvgeniiMekhanik force-pushed the jinhua/fix-1346-slow-read branch from 7df7a34 to 2a35da6 Compare May 5, 2026 11:46
Copy link
Copy Markdown
Contributor

@const-t const-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread fw/t/unit/test.c
@@ -91,6 +91,12 @@ extern TEST_SUITE_MPART_ARR(http2_parser, H2_SUITE_PART_CNT);
extern int tfw_pool_init(void);
extern void tfw_pool_exit(void);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new pull request, so please:

  1. name the branches according to our guides
  2. provide some meaningful description in the title of the PR and it's description

This PR is about #1715. It does not "fixes" #1346. It is from you, not Jinhua.

Maybe we need the branch name, but the title could must be more meaningful

Comment thread fw/client.h Outdated
struct work_struct kill_work;
long __percpu *mem;
struct list_head in_free_list;
struct tfw_client_mem_t *next_free;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get your comment:

We can't do it! Look we allocate and initialize ALL other members only once during tfw_cli_mem_pool_init! In tfw_cli_mem_pool_alloc we only get TfwCLientMem from free_list! So all this fields should be separate!

While a TfwClientMem block is in free list, then only next_free pointer is used - we do not need the rest of the data structure. Once a block is allocated, we do not need next_free and can initialize it and reuse the memory. Initialization is just 8 byte write and the bytes are already in the L1 cache - we can initialize the part of the structure on each allocation.

Also usually list members go first to prefetch the data structure on the list dereference.

@EvgeniiMekhanik EvgeniiMekhanik marked this pull request as draft May 11, 2026 08:20
@EvgeniiMekhanik EvgeniiMekhanik changed the title Jinhua/fix 1346 slow read Last fixe according 1715 May 11, 2026
@EvgeniiMekhanik EvgeniiMekhanik changed the title Last fixe according 1715 Last fixes according 1715 May 11, 2026
- Add comments to TfwClientMem structure
- Combine `next_free` member with `struct work`.
@EvgeniiMekhanik EvgeniiMekhanik force-pushed the jinhua/fix-1346-slow-read branch from eefb3d4 to b74e8dc Compare May 11, 2026 09:22
@EvgeniiMekhanik EvgeniiMekhanik marked this pull request as ready for review May 11, 2026 09:22
@EvgeniiMekhanik EvgeniiMekhanik merged commit 76ed83f into master May 12, 2026
1 of 2 checks passed
@EvgeniiMekhanik EvgeniiMekhanik deleted the jinhua/fix-1346-slow-read branch May 12, 2026 17:16
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.

3 participants