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
anon_pages are not free/evictable #10575
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`arc_free_memory()` returns the amount of memory that the ARC considers to be free. This includes pages that are not actually free, but can be evicted with essentially zero cost (without doing any i/o), for example the page cache. The ARC can "squeeze out" any pages included in this calculation, leaving only `arc_sys_free` (1/64th of RAM) for these free/evictable pages. Included in the count of free/evictable pages is `nr_inactive_anon_pages()`, which is described as "Anonymous memory that has not been used recently and can be swapped out". These pages would have to be written out to disk (swap) in order to evict them, and they are not included in `/proc/meminfo`'s `MemAvailable`. Therefore it is not appropriate for `nr_inactive_anon_pages()` to be included in the free/evictable memory returned by `arc_free_memory()`, because the ARC shouldn't (intentionally) make the system swap. This commit removes `nr_inactive_anon_pages()` from the memory returned by `arc_free_memory()`. This is a step towards enabling the ARC to manage free memory by monitoring it and reducing the ARC size as we notice that there is insufficient free memory (in the `arc_reap_zthr`), rather than the current method of relying on the `arc_shrinker` callback. Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
pzakha
approved these changes
Jul 15, 2020
behlendorf
approved these changes
Jul 15, 2020
tonynguien
approved these changes
Jul 15, 2020
grwilson
approved these changes
Jul 16, 2020
Codecov Report
@@ Coverage Diff @@
## master #10575 +/- ##
===========================================
+ Coverage 65.45% 79.65% +14.20%
===========================================
Files 311 392 +81
Lines 107338 124625 +17287
===========================================
+ Hits 70253 99276 +29023
+ Misses 37085 25349 -11736
Continue to review full report at Codecov.
|
ahrens
added a commit
to ahrens/zfs
that referenced
this pull request
Jul 17, 2020
`arc_free_memory()` returns the amount of memory that the ARC considers to be free. This includes pages that are not actually free, but can be evicted with essentially zero cost (without doing any i/o), for example the page cache. The ARC can "squeeze out" any pages included in this calculation, leaving only `arc_sys_free` (1/64th of RAM) for these free/evictable pages. Included in the count of free/evictable pages is `nr_inactive_anon_pages()`, which is described as "Anonymous memory that has not been used recently and can be swapped out". These pages would have to be written out to disk (swap) in order to evict them, and they are not included in `/proc/meminfo`'s `MemAvailable`. Therefore it is not appropriate for `nr_inactive_anon_pages()` to be included in the free/evictable memory returned by `arc_free_memory()`, because the ARC shouldn't (intentionally) make the system swap. This commit removes `nr_inactive_anon_pages()` from the memory returned by `arc_free_memory()`. This is a step towards enabling the ARC to manage free memory by monitoring it and reducing the ARC size as we notice that there is insufficient free memory (in the `arc_reap_zthr`), rather than the current method of relying on the `arc_shrinker` callback. Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed-by: George Wilson <gwilson@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes openzfs#10575
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
`arc_free_memory()` returns the amount of memory that the ARC considers to be free. This includes pages that are not actually free, but can be evicted with essentially zero cost (without doing any i/o), for example the page cache. The ARC can "squeeze out" any pages included in this calculation, leaving only `arc_sys_free` (1/64th of RAM) for these free/evictable pages. Included in the count of free/evictable pages is `nr_inactive_anon_pages()`, which is described as "Anonymous memory that has not been used recently and can be swapped out". These pages would have to be written out to disk (swap) in order to evict them, and they are not included in `/proc/meminfo`'s `MemAvailable`. Therefore it is not appropriate for `nr_inactive_anon_pages()` to be included in the free/evictable memory returned by `arc_free_memory()`, because the ARC shouldn't (intentionally) make the system swap. This commit removes `nr_inactive_anon_pages()` from the memory returned by `arc_free_memory()`. This is a step towards enabling the ARC to manage free memory by monitoring it and reducing the ARC size as we notice that there is insufficient free memory (in the `arc_reap_zthr`), rather than the current method of relying on the `arc_shrinker` callback. Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed-by: George Wilson <gwilson@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes openzfs#10575
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
`arc_free_memory()` returns the amount of memory that the ARC considers to be free. This includes pages that are not actually free, but can be evicted with essentially zero cost (without doing any i/o), for example the page cache. The ARC can "squeeze out" any pages included in this calculation, leaving only `arc_sys_free` (1/64th of RAM) for these free/evictable pages. Included in the count of free/evictable pages is `nr_inactive_anon_pages()`, which is described as "Anonymous memory that has not been used recently and can be swapped out". These pages would have to be written out to disk (swap) in order to evict them, and they are not included in `/proc/meminfo`'s `MemAvailable`. Therefore it is not appropriate for `nr_inactive_anon_pages()` to be included in the free/evictable memory returned by `arc_free_memory()`, because the ARC shouldn't (intentionally) make the system swap. This commit removes `nr_inactive_anon_pages()` from the memory returned by `arc_free_memory()`. This is a step towards enabling the ARC to manage free memory by monitoring it and reducing the ARC size as we notice that there is insufficient free memory (in the `arc_reap_zthr`), rather than the current method of relying on the `arc_shrinker` callback. Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed-by: George Wilson <gwilson@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes openzfs#10575
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
arc_free_memory()returns the amount of memory that the ARC considersto be free. This includes pages that are not actually free, but can be
evicted with essentially zero cost (without doing any i/o), for example
the page cache. The ARC can "squeeze out" any pages included in this
calculation, leaving only
arc_sys_free(1/64th of RAM) for thesefree/evictable pages.
Included in the count of free/evictable pages is
nr_inactive_anon_pages(), which is described as "Anonymous memory thathas not been used recently and can be swapped out". These pages would
have to be written out to disk (swap) in order to evict them, and they
are not included in
/proc/meminfo'sMemAvailable.Therefore it is not appropriate for
nr_inactive_anon_pages()to beincluded in the free/evictable memory returned by
arc_free_memory(),because the ARC shouldn't (intentionally) make the system swap.
Description
This commit removes
nr_inactive_anon_pages()from the memory returnedby
arc_free_memory(). This is a step towards enabling the ARC tomanage free memory by monitoring it and reducing the ARC size as we
notice that there is insufficient free memory (in the
arc_reap_zthr),rather than the current method of relying on the
arc_shrinkercallback.
How Has This Been Tested?
By itself, the change in behavior is not very noticeable, but this is necessary to enable the ARC to respond to memory pressure, instead of relying on the
arc_shrinkercallback.Types of changes
Checklist:
Signed-off-by.