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

Evict program cache using transaction usage counter #31927

Merged
merged 3 commits into from
Jun 2, 2023

Conversation

pgarg66
Copy link
Contributor

@pgarg66 pgarg66 commented Jun 1, 2023

Problem

The program usage counter is based on usage in instructions. This causes programs to get evicted/unloaded which are referenced in a transaction, but not called by an instruction. This results into unnecessary unloading/reloading of such programs.

Summary of Changes

  • Track usage of a program cache entry by how many transactions loaded it
  • Update eviction logic to use the new counter

Fixes #

@pgarg66 pgarg66 marked this pull request as ready for review June 1, 2023 22:56
@pgarg66 pgarg66 requested a review from Lichtso June 1, 2023 22:56
programs/bpf_loader/src/lib.rs Outdated Show resolved Hide resolved
runtime/src/bank.rs Outdated Show resolved Hide resolved
runtime/src/bank.rs Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Merging #31927 (33e72d4) into master (449f92e) will increase coverage by 0.0%.
The diff coverage is 99.3%.

@@           Coverage Diff           @@
##           master   #31927   +/-   ##
=======================================
  Coverage    81.9%    81.9%           
=======================================
  Files         759      759           
  Lines      207208   207245   +37     
=======================================
+ Hits       169720   169792   +72     
+ Misses      37488    37453   -35     

@pgarg66 pgarg66 requested a review from Lichtso June 2, 2023 08:44
@pgarg66 pgarg66 added the v1.16 PRs that should be backported to v1.16 label Jun 2, 2023
@pgarg66 pgarg66 merged commit 37ebb70 into solana-labs:master Jun 2, 2023
4 checks passed
@pgarg66 pgarg66 deleted the tx-usage-counter branch June 2, 2023 18:27
mergify bot pushed a commit that referenced this pull request Jun 2, 2023
* Evict program cache using tx usage counter

* address review feedback

* address review feedback

(cherry picked from commit 37ebb70)
mergify bot added a commit that referenced this pull request Jun 2, 2023
#31927) (#31952)

Evict program cache using transaction usage counter (#31927)

* Evict program cache using tx usage counter

* address review feedback

* address review feedback

(cherry picked from commit 37ebb70)

Co-authored-by: Pankaj Garg <pankaj@solana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.16 PRs that should be backported to v1.16
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants