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

ARC: Cache arc_c value during arc_evict() #16605

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4251,7 +4251,7 @@ arc_mf(uint64_t x, uint64_t multiplier, uint64_t divisor)
static uint64_t
arc_evict(void)
{
uint64_t asize, bytes, total_evicted = 0;
uint64_t bytes, total_evicted = 0;
int64_t e, mrud, mrum, mfud, mfum, w;
static uint64_t ogrd, ogrm, ogfd, ogfm;
static uint64_t gsrd, gsrm, gsfd, gsfm;
Expand Down Expand Up @@ -4288,8 +4288,9 @@ arc_evict(void)
arc_pd = arc_evict_adj(arc_pd, gsrd + gsfd, grd, gfd, 100);
arc_pm = arc_evict_adj(arc_pm, gsrm + gsfm, grm, gfm, 100);

asize = aggsum_value(&arc_sums.arcstat_size);
int64_t wt = t - (asize - arc_c);
uint64_t asize = aggsum_value(&arc_sums.arcstat_size);
uint64_t ac = arc_c;
int64_t wt = t - (asize - ac);

/*
* Try to reduce pinned dnodes if more than 3/4 of wanted metadata
Expand Down Expand Up @@ -4317,15 +4318,15 @@ arc_evict(void)

/* Evict MRU metadata. */
w = wt * (int64_t)(arc_meta * arc_pm >> 48) >> 16;
e = MIN((int64_t)(asize - arc_c), (int64_t)(mrum - w));
e = MIN((int64_t)(asize - ac), (int64_t)(mrum - w));
bytes = arc_evict_impl(arc_mru, ARC_BUFC_METADATA, e);
total_evicted += bytes;
mrum -= bytes;
asize -= bytes;

/* Evict MFU metadata. */
w = wt * (int64_t)(arc_meta >> 16) >> 16;
e = MIN((int64_t)(asize - arc_c), (int64_t)(m - bytes - w));
e = MIN((int64_t)(asize - ac), (int64_t)(m - bytes - w));
bytes = arc_evict_impl(arc_mfu, ARC_BUFC_METADATA, e);
total_evicted += bytes;
mfum -= bytes;
Expand All @@ -4334,14 +4335,14 @@ arc_evict(void)
/* Evict MRU data. */
wt -= m - total_evicted;
w = wt * (int64_t)(arc_pd >> 16) >> 16;
e = MIN((int64_t)(asize - arc_c), (int64_t)(mrud - w));
e = MIN((int64_t)(asize - ac), (int64_t)(mrud - w));
bytes = arc_evict_impl(arc_mru, ARC_BUFC_DATA, e);
total_evicted += bytes;
mrud -= bytes;
asize -= bytes;

/* Evict MFU data. */
e = asize - arc_c;
e = asize - ac;
bytes = arc_evict_impl(arc_mfu, ARC_BUFC_DATA, e);
mfud -= bytes;
total_evicted += bytes;
Expand Down
Loading