* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
@ 2024-07-24 17:22 Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-24 19:29 ` Stefan Kangas
2024-07-25 5:06 ` Eli Zaretskii
0 siblings, 2 replies; 11+ messages in thread
From: Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-24 17:22 UTC (permalink / raw)
To: 72278
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
In GNU Emacs 29.4 (build 1, aarch64-redhat-linux-gnu, GTK+ Version
3.24.42, cairo version 1.18.0) of 2024-07-08 built on
c7db9ae0ee0641de8f7c6190b678dcb8
System Description: Fedora Linux Asahi Remix 40 (Forty)
Configured using:
'configure --build=aarch64-redhat-linux-gnu
--host=aarch64-redhat-linux-gnu --program-prefix=
--disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
--libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run
--sharedstatedir=/var/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-cairo --with-dbus --with-gif
--with-gpm=no --with-harfbuzz --with-jpeg --with-json --with-modules
--with-native-compilation=aot --with-pgtk --with-png --with-rsvg
--with-sqlite3 --with-tiff --with-tree-sitter --with-webp --with-xpm
--with-xwidgets build_alias=aarch64-redhat-linux-gnu
host_alias=aarch64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches
-pipe -Wall -Werror=format-security
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
-mbranch-protection=standard -fasynchronous-unwind-tables
-fstack-clash-protection -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer ' LDFLAGS=-Wl,-z,relro
PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig CXX=g++
'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
-mbranch-protection=standard -fasynchronous-unwind-tables
-fstack-clash-protection -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer ''
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: ELisp/l
Minor modes in effect:
pdf-occur-global-minor-mode: t
shell-dirtrack-mode: t
undo-fu-session-mode: t
highlight-quoted-mode: t
corfu-history-mode: t
corfu-popupinfo-mode: t
corfu-mode: t
evil-surround-mode: t
server-mode: t
outline-minor-mode: t
dirvish-override-dired-mode: t
satchel-mode: t
nerd-icons-completion-mode: t
marginalia-mode: t
vertico-multiform-mode: t
vertico-mode: t
evil-goggles-mode: t
anzu-mode: t
evil-mode: t
evil-local-mode: t
recentf-mode: t
savehist-mode: t
electric-pair-mode: t
save-place-mode: t
override-global-mode: t
flymake-mode: t
pixel-scroll-precision-mode: t
repeat-mode: t
midnight-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
buffer-read-only: t
size-indication-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
abbrev-mode: t
view-mode: t
Load-path shadows:
/home/azeem/.local/state/emacs/elpaca/builds/transient/transient hides /usr/share/emacs/29.4/lisp/transient
/home/azeem/.local/state/emacs/elpaca/builds/ef-themes/theme-loaddefs hides /usr/share/emacs/29.4/lisp/theme-loaddefs
/home/azeem/.local/state/emacs/elpaca/builds/eww-hacks/shr hides /usr/share/emacs/29.4/lisp/net/shr
/home/azeem/.local/state/emacs/elpaca/builds/eww-hacks/eww hides /usr/share/emacs/29.4/lisp/net/eww
Features:
(shadow files-x emacsbug evil-nerd-commenter html-mode-expansions
sgml-mode evil-nerd-commenter-operator evil-nerd-commenter-sdk misearch
multi-isearch pdf-roll crm consult-info gnus-fun embark-org
embark-consult embark inspirehep-pdf companion-mode inspirehep reftex
reftex-loaddefs reftex-vars pdf-sync pdf-annot pdf-outline pdf-links
pdf-history pdf-occur tablist tablist-filter semantic/wisent/comp
semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util
semantic semantic/tag semantic/lex semantic/fw mode-local cedet
pdf-isearch pdf-misc pdf-tools pdf-view pdf-cache pdf-info tq pdf-util
pdf-macs password-store auth-source-pass with-editor shell consult-imenu
checkdoc vc-git vc-dispatcher package-lint-flymake package-lint
let-alist finder finder-inf lisp-mnt package url-handlers
vertico-directory oc-basic url-queue mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect ol-docview doc-view ol-bibtex bibtex ol-bbdb
ol-w3m ol-doi org-link-doi descr-text mastodon-notifications smerge-mode
diff diff-mode link-hint ffap goto-addr avy jka-compr view helpful
cc-langs cc-vars cc-defs imenu trace edebug debug backtrace info-look
info f help-fns radix-tree elisp-refs s dash undo-fu-session
nerd-icons-corfu dabbrev delsel jit-spell ispell cape face-remap
mastodon-media image-mode exif mastodon-profile mastodon-tl url-http
url-gw url-cache url-auth mastodon-auth mastodon-client plstore mastodon
mastodon-search mastodon-toot facemenu mastodon-iso persist
mastodon-http request adaptive-wrap shr-color highlight-quoted
corfu-history corfu-popupinfo corfu evil-embrace embrace expand-region
text-mode-expansions the-org-mode-expansions org-element org-persist xdg
org-id org-refile avl-tree generator er-basic-expansions
expand-region-core expand-region-custom evil-surround qp sort smiley
gnus-cite mm-archive mail-extr textsec uni-scripts idna-mapping
ucs-normalize uni-confusable textsec-check gnus-async gnus-bcklg gnus-ml
disp-table nndraft nnmh vertico-repeat epa-file network-stream nsm
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp
gnus-cache fabs consult server mu4e mu4e-org org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete
pcomplete org-list org-footnote org-faces org-entities noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs find-func org-version org-compat
org-macs mu4e-notification notifications mu4e-main smtpmail mu4e-view
mu4e-mime-parts gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls
dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud
nnimap nnmail mail-source utf7 nnoo parse-time iso8601 gnus-spec
gnus-int gnus-range gnus-win gnus cal-menu calendar cal-loaddefs
mu4e-headers mu4e-thread mu4e-actions mu4e-compose nnheader range
mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message shr
pixel-fill kinsoku url-file svg xml dom browse-url flow-fill mule-util
hl-line mu4e-contacts mu4e-update mu4e-folders mu4e-context
mu4e-query-items mu4e-server mu4e-modeline mu4e-vars mu4e-helpers
mu4e-config mu4e-window ido message sendmail yank-media puny cus-start
dirvish transient format-spec autorevert filenotify dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader mu4e-obsolete usher satchel ibuf-ext ibuffer ibuffer-loaddefs
bookmark nerd-icons-completion nerd-icons nerd-icons-faces
nerd-icons-data nerd-icons-data-mdicon nerd-icons-data-flicon
nerd-icons-data-codicon nerd-icons-data-devicon nerd-icons-data-sucicon
nerd-icons-data-wicon nerd-icons-data-faicon nerd-icons-data-powerline
nerd-icons-data-octicon nerd-icons-data-pomicon nerd-icons-data-ipsicon
marginalia vertico-multiform vertico compat compat-30 evil-goggles pulse
color ef-spring-theme ef-themes pdf-loader evil-anzu anzu evil
evil-integration evil-maps evil-commands reveal evil-jumps
evil-command-window evil-types evil-search evil-ex evil-macros
evil-repeat evil-states evil-core comp comp-cstr cl-extra help-mode
advice evil-common rect evil-vars edmacro kmacro orderless
mastodon-autoloads request-autoloads persist-autoloads yeetube-autoloads
filechooser-autoloads wile-autoloads adaptive-wrap-autoloads
usher-autoloads undo-fu-session-autoloads ef-themes-autoloads
jit-spell-autoloads satchel-autoloads pdf-tools-autoloads
tablist-autoloads xr-autoloads link-hint-autoloads avy-autoloads
yaml-mode-autoloads markdown-mode-autoloads magit-autoloads
git-commit-autoloads magit-section-autoloads inspirehep-autoloads
consult-hoogle-autoloads haskell-mode-autoloads geiser-guile-autoloads
geiser-autoloads fabs-autoloads companion-mode-autoloads
eww-hacks-autoloads evil-embrace-autoloads embrace-autoloads
expand-region-autoloads evil-surround-autoloads
evil-nerd-commenter-autoloads evil-goggles-autoloads evil-anzu-autoloads
anzu-autoloads evil-autoloads goto-chg-autoloads
eshell-syntax-highlighting-autoloads eat-autoloads
package-lint-flymake-autoloads package-lint-autoloads
elisp-def-autoloads macrostep-autoloads helpful-autoloads f-autoloads
elisp-refs-autoloads dash-autoloads s-autoloads
highlight-quoted-autoloads dirvish-autoloads transient-autoloads
diredfl-autoloads trashed-autoloads vertico-autoloads
orderless-autoloads nerd-icons-completion-autoloads marginalia-autoloads
embark-consult-autoloads embark-autoloads nerd-icons-corfu-autoloads
nerd-icons-autoloads cape-autoloads corfu-autoloads consult-autoloads
password-store-autoloads with-editor-autoloads compat-autoloads
elpaca-log elpaca-ui url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
recentf tree-widget savehist elec-pair saveplace bind-key url-parse
auth-source eieio eieio-core password-cache json map url-vars easy-mmode
cus-edit pp cus-load wid-edit pcase ibuf-macs flymake-proc flymake
project byte-opt bytecomp byte-compile compile text-property-search
comint ansi-osc ansi-color warnings icons thingatpt cl-macs pixel-scroll
cua-base ring subr-x repeat rx midnight gv cl-seq elpaca elpaca-process
cl-loaddefs cl-lib elpaca-autoloads rmc iso-transl tooltip cconv eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk multi-tty make-network-process native-compile emacs)
Memory information:
((conses 16 1976204 1127031)
(symbols 48 94384 7)
(strings 32 478350 81603)
(string-bytes 1 31638678)
(vectors 16 149464)
(vector-slots 8 3721744 648039)
(floats 8 2069 5420)
(intervals 56 197274 14128)
(buffers 984 162))
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
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
2024-07-25 5:06 ` Eli Zaretskii
1 sibling, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2024-07-24 19:29 UTC (permalink / raw)
To: Rahguzar, 72278
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?
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")?
Thanks in advance.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
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
2024-07-25 9:12 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-24 20:40 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 72278
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
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-25 5:06 ` Eli Zaretskii
2024-07-25 6:38 ` Paul Eggert
1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-07-25 5:06 UTC (permalink / raw)
To: Rahguzar, Paul Eggert; +Cc: 72278
> Date: Wed, 24 Jul 2024 19:22:08 +0200
> From: Rahguzar via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> 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
Paul, it sounds like we need to multiply by getpagesize() instead of
by a fixed value of 4? Some implementations of
system_process_attributes already do that, although not the one which
reads "/proc" on Linux.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
2024-07-25 5:06 ` Eli Zaretskii
@ 2024-07-25 6:38 ` Paul Eggert
2024-07-25 9:55 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Paul Eggert @ 2024-07-25 6:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Rahguzar, 72278-done
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
On 2024-07-24 22:06, Eli Zaretskii wrote:
> Paul, it sounds like we need to multiply by getpagesize() instead of
> by a fixed value of 4?
Yes, that sounds right. I installed the attached patch into Emacs master
on Savannah, and am boldly closing the bug as fixed. We can reopen it if
I'm wrong.
Thanks, Rahguzar, for reporting the bug.
[-- Attachment #2: 0001-Fix-process-attributes-rss-and-pmem-on-GNU-Linux.patch --]
[-- Type: text/x-patch, Size: 1627 bytes --]
From 42cdfe7f60ef7ae3bccb5b1e43349c3a6b54ac4a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 24 Jul 2024 23:32:24 -0700
Subject: [PATCH] Fix process-attributes rss and pmem on GNU/Linux
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Problem reported by Rahguzar <https://bugs.gnu.org/72278>.
* src/sysdep.c (system_process_attributes):
[GNU_LINUX || CYGWIN || __ANDROID__]: When computing rss and pmem,
don’t assume pagesize is 4096; it could be greater.
---
src/sysdep.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/sysdep.c b/src/sysdep.c
index d916a695155..3955d796ca5 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3548,6 +3548,7 @@ procfs_ttyname (int rdev)
}
# endif /* GNU_LINUX || __ANDROID__ */
+/* Total usable RAM in KiB. */
static uintmax_t
procfs_get_total_memory (void)
{
@@ -3737,8 +3738,13 @@ system_process_attributes (Lisp_Object pid)
attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs);
attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (thcount)), attrs);
attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (vsize / 1024)), attrs);
- attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (4 * rss)), attrs);
- pmem = 4.0 * 100 * rss / procfs_get_total_memory ();
+
+ /* RSS in KiB. */
+ uintmax_t rssk = rss;
+ rssk *= getpagesize () >> 10;
+
+ attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (rssk)), attrs);
+ pmem = 100.0 * rssk / procfs_get_total_memory ();
if (pmem > 100)
pmem = 100;
attrs = Fcons (Fcons (Qpmem, make_float (pmem)), attrs);
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
2024-07-24 20:40 ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 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
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2024-07-25 9:12 UTC (permalink / raw)
To: Rahguzar; +Cc: 72278
Rahguzar <rahguzar@zohomail.eu> writes:
> 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 ();
Makes sense to me.
AFAIK, the page size can be different for different processes, so I
guess we'd need to find the page size per process in something like
/proc/<pid>/status? Is that the right way to do it?
I'm not on a GNU/Linux machine right now so I can't check.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
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
0 siblings, 0 replies; 11+ messages in thread
From: Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-25 9:39 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 72278
Hi Stefan,
Stefan Kangas <stefankangas@gmail.com> writes:
> Rahguzar <rahguzar@zohomail.eu> writes:
>
>> 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 ();
>
> Makes sense to me.
>
> AFAIK, the page size can be different for different processes, so I
> guess we'd need to find the page size per process in something like
> /proc/<pid>/status? Is that the right way to do it?
>
> I'm not on a GNU/Linux machine right now so I can't check.
Paul Eggert's changes fixed the issue for me.
Rahguzar
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
2024-07-25 6:38 ` Paul Eggert
@ 2024-07-25 9:55 ` Stefan Kangas
2024-07-25 14:47 ` Paul Eggert
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2024-07-25 9:55 UTC (permalink / raw)
To: Paul Eggert, Eli Zaretskii; +Cc: Rahguzar, 72278
Paul Eggert <eggert@cs.ucla.edu> writes:
> From 42cdfe7f60ef7ae3bccb5b1e43349c3a6b54ac4a Mon Sep 17 00:00:00 2001
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Wed, 24 Jul 2024 23:32:24 -0700
> Subject: [PATCH] Fix process-attributes rss and pmem on GNU/Linux
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Problem reported by Rahguzar <https://bugs.gnu.org/72278>.
> * src/sysdep.c (system_process_attributes):
> [GNU_LINUX || CYGWIN || __ANDROID__]: When computing rss and pmem,
> don’t assume pagesize is 4096; it could be greater.
> ---
> src/sysdep.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/sysdep.c b/src/sysdep.c
> index d916a695155..3955d796ca5 100644
> --- a/src/sysdep.c
> +++ b/src/sysdep.c
> @@ -3548,6 +3548,7 @@ procfs_ttyname (int rdev)
> }
> # endif /* GNU_LINUX || __ANDROID__ */
>
> +/* Total usable RAM in KiB. */
> static uintmax_t
> procfs_get_total_memory (void)
> {
> @@ -3737,8 +3738,13 @@ system_process_attributes (Lisp_Object pid)
> attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs);
> attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (thcount)), attrs);
> attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (vsize / 1024)), attrs);
> - attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (4 * rss)), attrs);
> - pmem = 4.0 * 100 * rss / procfs_get_total_memory ();
> +
> + /* RSS in KiB. */
> + uintmax_t rssk = rss;
> + rssk *= getpagesize () >> 10;
> +
> + attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (rssk)), attrs);
> + pmem = 100.0 * rssk / procfs_get_total_memory ();
Thanks, that looks like an improvement.
On Linux, page sizes can vary per process ("multiple page size
support"). Should we bother with that?
I also note that the man page for getpagesize says this:
This call first appeared in 4.2BSD. SVr4, 4.4BSD, SUSv2. In
SUSv2 the getpagesize() call was labeled LEGACY, and it was
removed in POSIX.1-2001.
> if (pmem > 100)
> pmem = 100;
> attrs = Fcons (Fcons (Qpmem, make_float (pmem)), attrs);
> --
> 2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
2024-07-25 9:55 ` Stefan Kangas
@ 2024-07-25 14:47 ` Paul Eggert
2024-07-26 22:33 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Paul Eggert @ 2024-07-25 14:47 UTC (permalink / raw)
To: Stefan Kangas, Eli Zaretskii; +Cc: Rahguzar, 72278
On 2024-07-25 02:55, Stefan Kangas wrote:
> On Linux, page sizes can vary per process ("multiple page size
> support"). Should we bother with that?
I thought that support didn't change what getpagesize returns or what
/proc/PID/stat reports, at least not in mainline Linux kernels. Am I
missing something?
> I also note that the man page for getpagesize says this:
>
> This call first appeared in 4.2BSD. SVr4, 4.4BSD, SUSv2. In
> SUSv2 the getpagesize() call was labeled LEGACY, and it was
> removed in POSIX.1-2001.
Emacs uses getpagesize in other places. I suppose we should change them
all to sysconf (_SC_PAGESIZE) on the off chance that there's a platform
somewhere where page sizes exceed 1 GiB. I don't know of any such
platform now, probably because so much software still uses getpagesize....
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
2024-07-25 14:47 ` Paul Eggert
@ 2024-07-26 22:33 ` Stefan Kangas
2024-07-27 1:40 ` Paul Eggert
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2024-07-26 22:33 UTC (permalink / raw)
To: Paul Eggert, Eli Zaretskii; +Cc: Rahguzar, 72278
Paul Eggert <eggert@cs.ucla.edu> writes:
> On 2024-07-25 02:55, Stefan Kangas wrote:
>> On Linux, page sizes can vary per process ("multiple page size
>> support"). Should we bother with that?
>
> I thought that support didn't change what getpagesize returns or what
> /proc/PID/stat reports, at least not in mainline Linux kernels. Am I
> missing something?
I don't know to be honest, which is why I'm asking. If you think using
getpagesize is all that we need then that's good enough for me.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#72278: 29.4; Proced reports incorrect results with 16KB page size
2024-07-26 22:33 ` Stefan Kangas
@ 2024-07-27 1:40 ` Paul Eggert
0 siblings, 0 replies; 11+ messages in thread
From: Paul Eggert @ 2024-07-27 1:40 UTC (permalink / raw)
To: Stefan Kangas, Eli Zaretskii; +Cc: Rahguzar, 72278
On 2024-07-26 15:33, Stefan Kangas wrote:
> Paul Eggert<eggert@cs.ucla.edu> writes:
>
>> On 2024-07-25 02:55, Stefan Kangas wrote:
>>> On Linux, page sizes can vary per process ("multiple page size
>>> support"). Should we bother with that?
>> I thought that support didn't change what getpagesize returns or what
>> /proc/PID/stat reports, at least not in mainline Linux kernels. Am I
>> missing something?
> I don't know to be honest, which is why I'm asking.
For recent Asahi Linux user-mode pages are always 16 KiB; see
<https://github.com/AsahiLinux/docs/wiki/Broken-Software>.
I'd be surprised if any Linux distro lets getpagesize calls differ among
processes running atop the same kernel. Although Linux does support huge
pages via (for example) mmap with MAP_HUGETLB, I would expect this to
not affect getpagesize or /proc/PID/stat. I haven't verified this by
running code or by scouting through kernel source, though.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-07-27 1:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.