Bug 224532 - Remove resident count from procfs map
Summary: Remove resident count from procfs map
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-23 00:36 UTC by Glenn Weinberg
Modified: 2021-10-09 03:35 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Weinberg 2017-12-23 00:36:55 UTC
procfs_map does a very naive resident count, which for huge unbacked virtual spaces takes essentially forever. Instead of trying to fix this (see bug 188911), the resident count field should be deprecated and always be set to 0. Linux procfs does not return resident counts.
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2017-12-23 12:08:27 UTC
I think it is better to use the already existing optimized algorithm, also honoring the sysctl to enable/disable the residency calculation.

Please see D13595.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-12-28 13:23:33 UTC
A commit references this bug:

Author: kib
Date: Thu Dec 28 13:23:13 UTC 2017
New revision: 327286
URL: https://svnweb.freebsd.org/changeset/base/327286

Log:
  Reuse kern_proc_vmmap_resident() for procfs_map resident count.

  The existing algorithm in procfs_map() to calculate count of resident
  pages in an entry is too primitive, resulting in too long run time for
  large sparse mapping entries.  Re-use the kern_proc_vmmap_resident()
  from kern_proc.c which only looks at the existing pages in the
  iterations.

  Also, this makes procfs to honor kern.proc_vmmap_skip_resident_count,
  if user does not need this information.

  Reported by:	Glenn Weinberg <glenn.weinberg@intel.com>
  PR:	224532
  No objections from:	des (procfs maintainer)
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D13595

Changes:
  head/sys/fs/procfs/procfs_map.c
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:53:27 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 4 Piotr Pawel Stefaniak freebsd_committer freebsd_triage 2021-10-06 19:46:19 UTC
I think all supported releases have this change.