NetBSD Problem Report #50801

From www@NetBSD.org  Sun Feb 14 03:06:32 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.NetBSD.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 494887ACA5
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 14 Feb 2016 03:06:32 +0000 (UTC)
Message-Id: <20160214030631.5F33F7ACB6@mollari.NetBSD.org>
Date: Sun, 14 Feb 2016 03:06:31 +0000 (UTC)
From: coypu@sdf.org
Reply-To: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Subject: /proc/<pid>/statm has badly set values.
X-Send-Pr-Version: www-1.0

>Number:         50801
>Category:       kern
>Synopsis:       /proc/<pid>/statm has badly set values.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 14 03:10:00 +0000 2016
>Closed-Date:    Sun Feb 26 12:25:25 +0000 2017
>Last-Modified:  Sun Feb 26 12:25:25 +0000 2017
>Originator:     coypu
>Release:        7.99.25
>Organization:
>Environment:
NetBSD  7.99.25 NetBSD 7.99.25 (GENERIC) #10: Mon Jan 18 05:03:44 IST 2016  fly@localhost.localdomain:/home/fly/netbsd-src/sys/arch/amd64/compile/obj/GENERIC amd64
>Description:
cat /proc/<some program's PID>/statm
2nd and 3rd values are always zero.

from linux man proc:
2nd value:
resident   (2) resident set size
           (same as VmRSS in /proc/[pid]/status)
3rd value:
share      (3) shared pages (i.e., backed by a file)

For quick access, these values are set at src/sys/miscfs/procfs/procfs_linux.c:364-401.

this affects sysutils/htop.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/50801: /proc/<pid>/statm has badly set values.
Date: Sun, 14 Feb 2016 08:23:55 +0000 (UTC)

 coypu@sdf.org writes:

 >from linux man proc:
 >2nd value:
 >resident   (2) resident set size
 >           (same as VmRSS in /proc/[pid]/status)
 >3rd value:
 >share      (3) shared pages (i.e., backed by a file)

 The kernel doesn't gather statistics for the shared pages,
 so none can be reported.

 The RSS size on the other hand is easy to provide. The
 data is kept in the MD pmap code and must be fetched.
 It's already done for /proc/[pid]/stat.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: "Michael van Elst" <mlelstv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50801 CVS commit: src/sys/miscfs/procfs
Date: Mon, 28 Mar 2016 17:23:47 +0000

 Module Name:	src
 Committed By:	mlelstv
 Date:		Mon Mar 28 17:23:47 UTC 2016

 Modified Files:
 	src/sys/miscfs/procfs: procfs_linux.c

 Log Message:
 Align /proc/<pid>/statm data with /proc/<pid>/stat and
 provide RSS information. There is no data about shared
 pages.

 Helps PR 50801.


 To generate a diff of this commit:
 cvs rdiff -u -r1.71 -r1.72 src/sys/miscfs/procfs/procfs_linux.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 26 Feb 2017 12:25:25 +0000
State-Changed-Why:
good enough


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.