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

Fix free memory calculation on v3.14+ #7238

Closed

Conversation

aerusso
Copy link
Contributor

@aerusso aerusso commented Feb 26, 2018

This patch (e9a7729) from master is marked as to-do for the stable branch. This PR re-bases it, taking into account the slight changes in scripts/Makefile.am relative to master.

Description

e9a7729 applies cleanly, except for formatting issues in scripts/Makefile.am.

Motivation and Context

Marked as to-do, long-standing compatibility bug.

How Has This Been Tested?

I've built this, and installed it on a machine. The build infrastructure provides additional testing.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

Provide infrastructure to auto-configure to enum and API changes in the
global page stats used for our free memory calculations.

arc_free_memory has been broken since an API change in Linux v3.14:

2016-07-28 v4.8 599d0c95 mm, vmscan: move LRU lists to node
2016-07-28 v4.8 75ef7184 mm, vmstat: add infrastructure for per-node
  vmstats

These commits moved some of global_page_state() into
global_node_page_state(). The API change was particularly egregious as,
instead of breaking the old code, it silently did the wrong thing and we
continued using global_page_state() where we should have been using
global_node_page_state(), thus indexing into the wrong array via
NR_SLAB_RECLAIMABLE et al.

There have been further API changes along the way:

2017-07-06 v4.13 385386cf mm: vmstat: move slab statistics from zone to
  node counters
2017-09-06 v4.14 c41f012a mm: rename global_page_state to
  global_zone_page_state

...and various (incomplete, as it turns out) attempts to accomodate
these changes in ZoL:

2017-08-24 2209e40 Linux 4.8+ compatibility fix for vm stats
2017-09-16 787acae Linux 3.14 compat: IO acct, global_page_state, etc
2017-09-19 661907e Linux 4.14 compat: IO acct, global_page_state, etc

The config infrastructure provided here resolves these issues going back
to the original API change in v3.14 and is robust against further Linux
changes in this area.

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Closes openzfs#7170
@tonyhutter
Copy link
Contributor

@aerusso thanks, I'll include this in my 0.7.7 patch stack.

@tonyhutter tonyhutter closed this Mar 5, 2018
@tonyhutter tonyhutter added this to In progress in 0.7.7 Mar 7, 2018
@aerusso aerusso deleted the pulls/fix-free-memory-3.14 branch March 13, 2018 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.7.7
  
In progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants