9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* /proc/n/status's memory field
@ 2020-08-14 17:54 Kyohei Kadota
  2020-08-15  4:50 ` Anthony Martin
  0 siblings, 1 reply; 3+ messages in thread
From: Kyohei Kadota @ 2020-08-14 17:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi.

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: /proc/n/status's memory field
  2020-08-14 17:54 /proc/n/status's memory field Kyohei Kadota
@ 2020-08-15  4:50 ` Anthony Martin
  2020-08-17 11:37   ` [9fans] " Kyohei Kadota
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Martin @ 2020-08-15  4:50 UTC (permalink / raw)
  To: 9fans

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Re: /proc/n/status's memory field
  2020-08-15  4:50 ` Anthony Martin
@ 2020-08-17 11:37   ` Kyohei Kadota
  0 siblings, 0 replies; 3+ messages in thread
From: Kyohei Kadota @ 2020-08-17 11:37 UTC (permalink / raw)
  To: 9fans

Thanks.

I've misread Labs kernel's initial index to zero until now.

2020年8月15日(土) 13:51 Anthony Martin <ality@pbrane.org>:
>
> 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
>
> ------------------------------------------
> 9fans: 9fans
> Permalink: https://9fans.topicbox.com/groups/9fans/Tc2c9fe27a3a2dd4c-M9bf220c6eb9f6bf0e10d813e
> Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-17 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 17:54 /proc/n/status's memory field Kyohei Kadota
2020-08-15  4:50 ` Anthony Martin
2020-08-17 11:37   ` [9fans] " Kyohei Kadota

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).