9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Anthony Martin <ality@pbrane.org>
To: 9fans <9fans@9fans.net>
Subject: Re: /proc/n/status's memory field
Date: Fri, 14 Aug 2020 21:50:57 -0700	[thread overview]
Message-ID: <20200815045057.GA585648@alice> (raw)
In-Reply-To: <CAFMepc=021Hzy5cLTr34RyzL_sNZJgp540iSMizn5YdR232xDg@mail.gmail.com>

Kyohei Kadota <lufia@lufia.org> once said:
> I'm reading proc(3). It describes the status file:
> 
> > the amount of memory used by the process, except its stack, in units of 1024 bytes
> 
> In /sys/src/9/pc/port/proc.c, it seems to me that procread sums all
> segment's size for that.
> Is the above statement correct?

The Labs kernel loops over [1,NSEG) to sum the segment sizes.
The index of the stack segment, SSEG, is zero so it is skipped.
This measurement is the total virtual address space in use by
the process minus the stack.

The 9front kernel loops over [0,NSEG) to scan the virtual page
table of each segment for used pages, summing as it goes. This
measurement is the total amount of memory in use by the process.

Cheers,
  Anthony

  reply	other threads:[~2020-08-15  4:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 17:54 Kyohei Kadota
2020-08-15  4:50 ` Anthony Martin [this message]
2020-08-17 11:37   ` [9fans] " Kyohei Kadota

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

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

  git send-email \
    --in-reply-to=20200815045057.GA585648@alice \
    --to=ality@pbrane.org \
    --cc=9fans@9fans.net \
    /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.
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 NNTP newsgroup(s).