unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Rahguzar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 72278@debbugs.gnu.org
Subject: bug#72278: 29.4; Proced reports incorrect results with 16KB page size
Date: Wed, 24 Jul 2024 22:40:53 +0200	[thread overview]
Message-ID: <87msm6mskq.fsf@zohomail.eu> (raw)
In-Reply-To: <CADwFkmmUd1YJr2NtxFuBSgNi3SgOiA_s0FY5C6N3R+3VCEjwVw@mail.gmail.com> (Stefan Kangas's message of "Wed, 24 Jul 2024 12:29:25 -0700")

Hi Stefan,

Stefan Kangas <stefankangas@gmail.com> writes:

> Rahguzar via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Dear Emacs Maintainers,
>>
>> I am using GNU/Linux on an Apple M2 processor using the Asahi Linux
>> project [1]. They provide a kernel with 16KB page size [2]. This causes proced
>> to show incorrect values for percentage memory (other memory related
>> attributes might also be affected). E.g. comparing with top I see that
>> value reported by proced is a quarter of that related by top.
>>
>> [1] https://asahilinux.org
>> [2] https://discussion.fedoraproject.org/t/switch-to-the-kernel-16k-variant/87711
>
> 1. What is the output of running this command?
>
>        grep MemTotal /proc/meminfo
>
>    Does that value seem right?  Does that file make sense in general?

The value and the file generally look correct to me.

> 2. Copy this to a buffer somewhere, put point after the last
>    parenthesis, and press `C-u C-x C-e':
>
>         (pp (mapcar #'process-attributes
>              (seq-take (list-system-processes) 5)))
>
>     Please post the result back here.
>
>     Could you also tell us which values in the resulting list are wrong
>     (a.k.a. "different from top")?

The processes that end up in that list have memory footprint so small
that top ends up showing percentage memory as 0. I modified the snippet
to obtain 5 processes started by firefox:

(((args . "/usr/lib64/firefox/firefox")
  (pmem . 3.018895533065192)
  (rss . 727876)
  (vsize . 17513856)
  (thcount . 105)
  (nice . 0)
  (pri . 20)
  (pcpu . 1.0718871382569872)
  (etime 12 34487 450000 0)
  (start 26260 56544 260000 0)
  (ctime 0 8651 310000 0)
  (cstime 0 393 900000 0)
  (cutime 0 8257 410000 0)
  (time 0 8799 330000 0)
  (stime 0 2500 340000 0)
  (utime 0 6298 990000 0)
  (cmajflt . 83)
  (cminflt . 10288762)
  (majflt . 1571)
  (minflt . 20999882)
  (tpgid . -1)
  (ttname . "")
  (sess . 1239)
  (pgrp . 1239)
  (ppid . 1)
  (state . "S")
  (comm . "firefox")
  (group . "azeem")
  (egid . 1000)
  (user . "azeem")
  (euid . 1000))
 ((args . "/usr/lib64/firefox/firefox -contentproc -parentBuildID 20240712194222 -prefsLen 42067 -prefMapSize 262227 -appDir /usr/lib64/firefox/browser {6dc0e492-94e8-413e-83e0-ac2b970bde23} 1241 socket")
  (pmem . 0.05839737689600688)
  (rss . 14080)
  (vsize . 576016)
  (thcount . 6)
  (nice . 0)
  (pri . 20)
  (pcpu . 5.359847034838214e-05)
  (etime 12 34486 950000 0)
  (start 26260 56544 770000 0)
  (ctime 0 0 0 0)
  (cstime 0 0 0 0)
  (cutime 0 0 0 0)
  (time 0 0 440000 0)
  (stime 0 0 180000 0)
  (utime 0 0 260000 0)
  (cmajflt . 0)
  (cminflt . 0)
  (majflt . 9)
  (minflt . 1669)
  (tpgid . -1)
  (ttname . "")
  (sess . 1239)
  (pgrp . 1239)
  (ppid . 1241)
  (state . "S")
  (comm . "Socket Process")
  (group . "azeem")
  (egid . 1000)
  (user . "azeem")
  (euid . 1000))
 ((args . "/usr/lib64/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 42067 -prefMapSize 262227 -jsInitLen 234780 -parentBuildID 20240712194222 -greomni /usr/lib64/firefox/omni.ja -appomni /usr/lib64/firefox/browser/omni.ja -appDir /usr/lib64/firefox/browser {2280679f-70cf-4f2d-887a-33665cc52830} 1241 tab")
  (pmem . 0.9880603908509892)
  (rss . 238228)
  (vsize . 22750640)
  (thcount . 27)
  (nice . 0)
  (pri . 20)
  (pcpu . 0.13563582493620777)
  (etime 12 34486 810000 0)
  (start 26260 56544 920000 0)
  (ctime 0 0 0 0)
  (cstime 0 0 0 0)
  (cutime 0 0 0 0)
  (time 0 1113 460000 0)
  (stime 0 75 970000 0)
  (utime 0 1037 490000 0)
  (cmajflt . 0)
  (cminflt . 0)
  (majflt . 0)
  (minflt . 1710810)
  (tpgid . -1)
  (ttname . "")
  (sess . 1239)
  (pgrp . 1239)
  (ppid . 1241)
  (state . "R")
  (comm . "WebExtensions")
  (group . "azeem")
  (egid . 1000)
  (user . "azeem")
  (euid . 1000))
 ((args . "/usr/lib64/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 43016 -prefMapSize 262227 -jsInitLen 234780 -parentBuildID 20240712194222 -greomni /usr/lib64/firefox/omni.ja -appomni /usr/lib64/firefox/browser/omni.ja -appDir /usr/lib64/firefox/browser {c7fd5dcc-7f18-4677-8cd3-ff49efab3e75} 1241 tab")
  (pmem . 0.10299173743477577)
  (rss . 24832)
  (vsize . 4366000)
  (thcount . 28)
  (nice . 0)
  (pri . 20)
  (pcpu . 0.0032487989036966473)
  (etime 12 34486 770000 0)
  (start 26260 56544 960000 0)
  (ctime 0 0 0 0)
  (cstime 0 0 0 0)
  (cutime 0 0 0 0)
  (time 0 26 670000 0)
  (stime 0 6 580000 0)
  (utime 0 20 90000 0)
  (cmajflt . 0)
  (cminflt . 0)
  (majflt . 0)
  (minflt . 2708)
  (tpgid . -1)
  (ttname . "")
  (sess . 1239)
  (pgrp . 1239)
  (ppid . 1241)
  (state . "S")
  (comm . "Privileged Cont")
  (group . "azeem")
  (egid . 1000)
  (user . "azeem")
  (euid . 1000))
 ((args . "/usr/lib64/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 29688 -prefMapSize 262227 -jsInitLen 234780 -parentBuildID 20240712194222 -greomni /usr/lib64/firefox/omni.ja -appomni /usr/lib64/firefox/browser/omni.ja -appDir /usr/lib64/firefox/browser {77722f8d-f95f-4796-9765-00d7017c5796} 1241 tab")
  (pmem . 1.0487306202000508)
  (rss . 252856)
  (vsize . 6381408)
  (thcount . 31)
  (nice . 0)
  (pri . 20)
  (pcpu . 0.48562684148940605)
  (etime 12 34486 380000 0)
  (start 26260 56545 350000 0)
  (ctime 0 0 0 0)
  (cstime 0 0 0 0)
  (cutime 0 0 0 0)
  (time 0 3986 600000 0)
  (stime 0 651 720000 0)
  (utime 0 3334 880000 0)
  (cmajflt . 0)
  (cminflt . 0)
  (majflt . 5)
  (minflt . 1335797)
  (tpgid . -1)
  (ttname . "")
  (sess . 1239)
  (pgrp . 1239)
  (ppid . 1241)
  (state . "S")
  (comm . "Isolated Web Co")
  (group . "azeem")
  (egid . 1000)
  (user . "azeem")
  (euid . 1000)))

The percentage memory values in top for these processes are 12.1 0.2 4.0
0.4 and 4.2 so 4 times those returned by proced.

> Thanks in advance.

From discussion with Eli at the help-gnu-emacs thread I think there is
some hard coded assumption about 4KB page size in sysdep.c. E.g. here at
line 3741 

	  pmem = 4.0 * 100 * rss / procfs_get_total_memory ();

Thanks,
Rahguzar





  reply	other threads:[~2024-07-24 20:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24 17:22 bug#72278: 29.4; Proced reports incorrect results with 16KB page size Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-24 19:29 ` Stefan Kangas
2024-07-24 20:40   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-07-25  9:12     ` Stefan Kangas
2024-07-25  9:39       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-25  5:06 ` Eli Zaretskii
2024-07-25  6:38   ` Paul Eggert
2024-07-25  9:55     ` Stefan Kangas
2024-07-25 14:47       ` Paul Eggert
2024-07-26 22:33         ` Stefan Kangas
2024-07-27  1:40           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msm6mskq.fsf@zohomail.eu \
    --to=bug-gnu-emacs@gnu.org \
    --cc=72278@debbugs.gnu.org \
    --cc=rahguzar@zohomail.eu \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).