From: Robert Foss <redacted>
This series provides the /proc/PID/totmaps feature, which
summarizes the information provided by /proc/PID/smaps for
improved performance and usability reasons.
A use case is to speed up monitoring of memory consumption in
environments where RSS isn't precise.
For example Chrome tends to many processes which have hundreds of VMAs
with a substantial amount of shared memory, and the error of using
RSS rather than PSS tends to be very large when looking at overall
memory consumption. PSS isn't kept as a single number that's exported
like RSS, so to calculate PSS means having to parse a very large smaps
file.
This process is slow and has to be repeated for many processes, and we
found that the just act of doing the parsing was taking up a
significant amount of CPU time, so this patch is an attempt to make
that process cheaper.
/proc/PID/totmaps provides roughly a 2x speedup compared to parsing
/proc/PID/smaps with awk.
$ ps aux | grep firefox
robertfoss 5025 24.3 13.7 3562820 2219616 ? Rl Aug15 277:44 /usr/lib/firefox/firefox https://allg.one/xpb
$ awk '/^[0-9a-f]/{print}' /proc/5025/smaps | wc -l
1503
$ /usr/bin/time -v -p zsh -c "(repeat 25 {cat /proc/5025/totmaps})"
[...]
Command being timed: "zsh -c (repeat 25 {cat /proc/5025/totmaps})"
User time (seconds): 0.00
System time (seconds): 0.40
Percent of CPU this job got: 90%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.45
$ /usr/bin/time -v -p zsh -c "repeat 25 { awk '/^Rss/{rss+=\$2} /^Pss/{pss+=\$2} END {printf \"rss:%d pss:%d\n\", rss, pss}\' /proc/5025/smaps }"
[...]
Command being timed: "zsh -c repeat 25 { awk '/^Rss/{rss+=$2} /^Pss/{pss+=$2} END {printf "rss:%d pss:%d\n", rss, pss}\' /proc/5025/smaps }"
User time (seconds): 0.37
System time (seconds): 0.45
Percent of CPU this job got: 92%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.89
Changes since v1:
- Removed IS_ERR check from get_task_mm() function
- Changed comment format
- Moved proc_totmaps_operations declaration inside internal.h
- Switched to using do_maps_open() in totmaps_open() function,
which provides privilege checking
- Error handling reworked for totmaps_open() function
- Switched to stack allocated struct mem_size_stats mss_sum in
totmaps_proc_show() function
- Removed get_task_mm() in totmaps_proc_show() since priv->mm
already is available
- Added support to proc_map_release() fork priv==NULL, to allow
function to be used for all failure cases
- Added proc_totmaps_op and for it helper functions
- Added documention in separate patch
- Removed totmaps_release() since it was just a wrapper for proc_map_release()
Changes since v2:
- Removed struct mem_size_stats *mss from struct proc_maps_private
- Removed priv->task assignment in totmaps_open() call
- Moved some assignements calls totmaps_open() around to increase code
clarity
- Moved some function calls to unlock data structures before printing
Changes since v3:
- Fixed typo in totmaps documentation
- Fixed issue where proc_map_release wasn't called on error
- Fixed put_task_struct not being called during .release()
Changes since v4:
- Prevent access to invalid processes
Robert Foss (3):
mm, proc: Implement /proc/<pid>/totmaps
Documentation/filesystems: Fixed typo
Documentation/filesystems: Added /proc/PID/totmaps documentation
Documentation/filesystems/proc.txt | 23 +++++-
fs/proc/base.c | 1 +
fs/proc/internal.h | 2 +
fs/proc/task_mmu.c | 148 +++++++++++++++++++++++++++++++++++++
4 files changed, 173 insertions(+), 1 deletion(-)
--
2.7.4
@@ -11,6 +11,7 @@ Version 1.3 Kernel version 2.2.12 Kernel version 2.4.0-test11-pre4 ------------------------------------------------------------------------------ fixes/update part 1.1 Stefani Seibold <stefani@seibold.net> June 9 2009+add totmaps Robert Foss <robert.foss@collabora.com> August 12 2016 Table of Contents -----------------
@@ -147,6 +148,8 @@ Table 1-1: Process specific entries in /proc stack Report full stack trace, enable via CONFIG_STACKTRACE smaps an extension based on maps, showing the memory consumption of each mapping and flags associated with it+ totmaps an extension based on maps, showing the total memory+ consumption of all mappings numa_maps an extension based on maps, showing the memory locality and binding policy as well as mem usage (in pages) of each mapping. ..............................................................................
@@ -515,6 +518,24 @@ be vanished or the reverse -- new added. This file is only present if the CONFIG_MMU kernel configuration option is enabled.+The /proc/PID/totmaps is an extension based on maps, showing the memory+consumption totals for all of the process's mappings. It lists the sums of the+same statistics as /proc/PID/smaps.++The process' mappings will be summarized as a series of lines like the+following:++Rss: 4256 kB+Pss: 1170 kB+Shared_Clean: 2720 kB+Shared_Dirty: 1136 kB+Private_Clean: 0 kB+Private_Dirty: 400 kB+Referenced: 4256 kB+Anonymous: 1536 kB+AnonHugePages: 0 kB+Swap: 0 kB+ The /proc/PID/clear_refs is used to reset the PG_Referenced and ACCESSED/YOUNG bits on both physical and virtual pages associated with a process, and the soft-dirty bit on pte (see Documentation/vm/soft-dirty.txt for details).
@@ -145,7 +145,7 @@ Table 1-1: Process specific entries in /proc symbol the task is blocked in - or "0" if not blocked. pagemap Page table stack Report full stack trace, enable via CONFIG_STACKTRACE- smaps a extension based on maps, showing the memory consumption of+ smaps an extension based on maps, showing the memory consumption of each mapping and flags associated with it numa_maps an extension based on maps, showing the memory locality and binding policy as well as mem usage (in pages) of each mapping.
From: Robert Foss <redacted>
This is based on earlier work by Thiago Goncales. It implements a new
per process proc file which summarizes the contents of the smaps file
but doesn't display any addresses. It gives more detailed information
than statm like the PSS (proprotional set size). It differs from the
original implementation in that it doesn't use the full blown set of
seq operations, uses a different termination condition, and doesn't
displayed "Locked" as that was broken on the original implemenation.
This new proc file provides information faster than parsing the potentially
huge smaps file.
Tested-by: Robert Foss <redacted>
Signed-off-by: Robert Foss <redacted>
Signed-off-by: Sonny Rao <redacted>
---
fs/proc/base.c | 1 +
fs/proc/internal.h | 2 +
fs/proc/task_mmu.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 151 insertions(+)
Why? I mean, why not walk_page_range() ? You do not need this for-each-vma
loop at all? At least if you change this patch to use the ONE() helper, and
everything else looks unneeded in this case.
Oleg.
On Mon, Sep 5, 2016 at 1:14 PM, [off-list ref] wrote:
From: Robert Foss <redacted>
Fixed a -> an typo.
Signed-off-by: Robert Foss <redacted>
Acked-by: Kees Cook <redacted>
This could be taken directly into the docs tree, I think -- no reason
to make it depend on the rest of the series.
-Kees
@@ -145,7 +145,7 @@ Table 1-1: Process specific entries in /proc symbol the task is blocked in - or "0" if not blocked. pagemap Page table stack Report full stack trace, enable via CONFIG_STACKTRACE- smaps a extension based on maps, showing the memory consumption of+ smaps an extension based on maps, showing the memory consumption of each mapping and flags associated with it numa_maps an extension based on maps, showing the memory locality and binding policy as well as mem usage (in pages) of each mapping.--
From: Robert Foss <hidden> Date: 2016-09-08 00:22:20
On 2016-09-07 07:22 PM, Kees Cook wrote:
On Mon, Sep 5, 2016 at 1:14 PM, [off-list ref] wrote:
quoted
From: Robert Foss <robert.foss-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Fixed a -> an typo.
Signed-off-by: Robert Foss <robert.foss-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Acked-by: Kees Cook <redacted>
This could be taken directly into the docs tree, I think -- no reason
to make it depend on the rest of the series.
Agreed. Would you like a separate submission for that?
Rob.
From: Michal Hocko <mhocko@kernel.org> Date: 2016-09-12 12:03:08
On Mon 05-09-16 16:14:06, robert.foss@collabora.com wrote:
From: Robert Foss <redacted>
This series provides the /proc/PID/totmaps feature, which
summarizes the information provided by /proc/PID/smaps for
improved performance and usability reasons.
A use case is to speed up monitoring of memory consumption in
environments where RSS isn't precise.
For example Chrome tends to many processes which have hundreds of VMAs
with a substantial amount of shared memory, and the error of using
RSS rather than PSS tends to be very large when looking at overall
memory consumption. PSS isn't kept as a single number that's exported
like RSS, so to calculate PSS means having to parse a very large smaps
file.
This process is slow and has to be repeated for many processes, and we
found that the just act of doing the parsing was taking up a
significant amount of CPU time, so this patch is an attempt to make
that process cheaper.
I still maintain my concerns about a single pss value. It might work in
a very specific situations where the consumer knows what is shared but
other than that the value can be more misleading than helpful. So a NACK
from me until I am shown that this is usable in general and still
helpful.
--
Michal Hocko
SUSE Labs
On Mon, Sep 12, 2016 at 5:02 AM, Michal Hocko [off-list ref] wrote:
On Mon 05-09-16 16:14:06, robert.foss-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org wrote:
quoted
From: Robert Foss <robert.foss-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
This series provides the /proc/PID/totmaps feature, which
summarizes the information provided by /proc/PID/smaps for
improved performance and usability reasons.
A use case is to speed up monitoring of memory consumption in
environments where RSS isn't precise.
For example Chrome tends to many processes which have hundreds of VMAs
with a substantial amount of shared memory, and the error of using
RSS rather than PSS tends to be very large when looking at overall
memory consumption. PSS isn't kept as a single number that's exported
like RSS, so to calculate PSS means having to parse a very large smaps
file.
This process is slow and has to be repeated for many processes, and we
found that the just act of doing the parsing was taking up a
significant amount of CPU time, so this patch is an attempt to make
that process cheaper.
I still maintain my concerns about a single pss value. It might work in
a very specific situations where the consumer knows what is shared but
other than that the value can be more misleading than helpful. So a NACK
from me until I am shown that this is usable in general and still
helpful.
I know you think Pss isn't useful in general (though I'll point out
two other independent people said they found it useful) but how about
the other fields like Swap, Private_Dirty and Private_Shared?
If we removed Pss would you still NACK it?
From: Michal Hocko <mhocko@kernel.org> Date: 2016-09-12 17:15:14
On Mon 12-09-16 08:31:36, Sonny Rao wrote:
On Mon, Sep 12, 2016 at 5:02 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 05-09-16 16:14:06, robert.foss@collabora.com wrote:
quoted
From: Robert Foss <redacted>
This series provides the /proc/PID/totmaps feature, which
summarizes the information provided by /proc/PID/smaps for
improved performance and usability reasons.
A use case is to speed up monitoring of memory consumption in
environments where RSS isn't precise.
For example Chrome tends to many processes which have hundreds of VMAs
with a substantial amount of shared memory, and the error of using
RSS rather than PSS tends to be very large when looking at overall
memory consumption. PSS isn't kept as a single number that's exported
like RSS, so to calculate PSS means having to parse a very large smaps
file.
This process is slow and has to be repeated for many processes, and we
found that the just act of doing the parsing was taking up a
significant amount of CPU time, so this patch is an attempt to make
that process cheaper.
I still maintain my concerns about a single pss value. It might work in
a very specific situations where the consumer knows what is shared but
other than that the value can be more misleading than helpful. So a NACK
from me until I am shown that this is usable in general and still
helpful.
I know you think Pss isn't useful in general (though I'll point out
two other independent people said they found it useful)
sure, and one of them admitted that the value is useful because they
_know_ the resource. The other was quite vague for me to understand
all the details. Please, try to understand that once you provide a user
API then it will carved in stone. If the interface is poor and ambigous
it will bite us later. One very specific usecase doesn't justify
something that might be really misleading for 90% of cases.
but how about the other fields like Swap, Private_Dirty and
Private_Shared?
Private_Shared can be pretty confusing as well without the whole context
as well see my other emails in the original thread (just to remind
shmem/tmpfs makes all this really confusing).
--
Michal Hocko
SUSE Labs
On Mon, Sep 12, 2016 at 10:15 AM, Michal Hocko [off-list ref] wrote:
On Mon 12-09-16 08:31:36, Sonny Rao wrote:
quoted
On Mon, Sep 12, 2016 at 5:02 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 05-09-16 16:14:06, robert.foss-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org wrote:
quoted
From: Robert Foss <robert.foss-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
This series provides the /proc/PID/totmaps feature, which
summarizes the information provided by /proc/PID/smaps for
improved performance and usability reasons.
A use case is to speed up monitoring of memory consumption in
environments where RSS isn't precise.
For example Chrome tends to many processes which have hundreds of VMAs
with a substantial amount of shared memory, and the error of using
RSS rather than PSS tends to be very large when looking at overall
memory consumption. PSS isn't kept as a single number that's exported
like RSS, so to calculate PSS means having to parse a very large smaps
file.
This process is slow and has to be repeated for many processes, and we
found that the just act of doing the parsing was taking up a
significant amount of CPU time, so this patch is an attempt to make
that process cheaper.
I still maintain my concerns about a single pss value. It might work in
a very specific situations where the consumer knows what is shared but
other than that the value can be more misleading than helpful. So a NACK
from me until I am shown that this is usable in general and still
helpful.
I know you think Pss isn't useful in general (though I'll point out
two other independent people said they found it useful)
sure, and one of them admitted that the value is useful because they
_know_ the resource. The other was quite vague for me to understand
all the details. Please, try to understand that once you provide a user
API then it will carved in stone. If the interface is poor and ambigous
it will bite us later. One very specific usecase doesn't justify
something that might be really misleading for 90% of cases.
quoted
but how about the other fields like Swap, Private_Dirty and
Private_Shared?
Private_Shared can be pretty confusing as well without the whole context
as well see my other emails in the original thread (just to remind
shmem/tmpfs makes all this really confusing).
But this is exactly the issue -- RSS is can be just as confusing if
you don't know something about the application. I think the issue is
how common that situation is, and you seem to believe that it's so
uncommon that it's actually better to keep the information more
difficult to get for those of us who know something about our systems.
That's fine, I guess we just have to disagree here, thanks for look at this.
Why? I mean, why not walk_page_range() ? You do not need this for-each-vma
loop at all? At least if you change this patch to use the ONE() helper, and
everything else looks unneeded in this case.
Oleg.
From: Michal Hocko <mhocko@kernel.org> Date: 2016-09-13 07:12:17
On Mon 12-09-16 10:28:53, Sonny Rao wrote:
On Mon, Sep 12, 2016 at 10:15 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 12-09-16 08:31:36, Sonny Rao wrote:
[...]
quoted
quoted
but how about the other fields like Swap, Private_Dirty and
Private_Shared?
Private_Shared can be pretty confusing as well without the whole context
as well see my other emails in the original thread (just to remind
shmem/tmpfs makes all this really confusing).
But this is exactly the issue -- RSS is can be just as confusing if
you don't know something about the application.
I agree that rss can be confusing but we will not make the situation any
better if we add yet another confusing metric.
I think the issue is
how common that situation is, and you seem to believe that it's so
uncommon that it's actually better to keep the information more
difficult to get for those of us who know something about our systems.
That's fine, I guess we just have to disagree here, thanks for look at this.
I think you should just step back and think more about what exactly
you expect from the counter(s). I believe what you want is an
estimate of a freeable memory when the particular process dies or is
killed. That would mean resident single mapped private anonymous memory
+ unlinked single mapped shareable mappings + single mapped swapped out
memory. Maybe I've missed something but it should be something along
those lines. Definitely something that the current smaps infrastructure
doesn't give you, though.
--
Michal Hocko
SUSE Labs
On Tue, Sep 13, 2016 at 12:12 AM, Michal Hocko [off-list ref] wrote:
On Mon 12-09-16 10:28:53, Sonny Rao wrote:
quoted
On Mon, Sep 12, 2016 at 10:15 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 12-09-16 08:31:36, Sonny Rao wrote:
[...]
quoted
quoted
quoted
but how about the other fields like Swap, Private_Dirty and
Private_Shared?
Private_Shared can be pretty confusing as well without the whole context
as well see my other emails in the original thread (just to remind
shmem/tmpfs makes all this really confusing).
But this is exactly the issue -- RSS is can be just as confusing if
you don't know something about the application.
I agree that rss can be confusing but we will not make the situation any
better if we add yet another confusing metric.
quoted
I think the issue is
how common that situation is, and you seem to believe that it's so
uncommon that it's actually better to keep the information more
difficult to get for those of us who know something about our systems.
That's fine, I guess we just have to disagree here, thanks for look at this.
I think you should just step back and think more about what exactly
you expect from the counter(s). I believe what you want is an
estimate of a freeable memory when the particular process dies or is
killed. That would mean resident single mapped private anonymous memory
+ unlinked single mapped shareable mappings + single mapped swapped out
memory. Maybe I've missed something but it should be something along
those lines. Definitely something that the current smaps infrastructure
doesn't give you, though.
Yes your description of what we want is pretty good. Having a
reasonable lower bound on the estimate is fine, though we probably
want to break out swapped out memory separately. Given that smaps
doesn't provide this in a straightforward way, what do you think is
the right way to provide this information?
From: Michal Hocko <mhocko@kernel.org> Date: 2016-09-14 09:12:14
On Tue 13-09-16 13:27:39, Sonny Rao wrote:
On Tue, Sep 13, 2016 at 12:12 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 12-09-16 10:28:53, Sonny Rao wrote:
quoted
On Mon, Sep 12, 2016 at 10:15 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 12-09-16 08:31:36, Sonny Rao wrote:
[...]
quoted
quoted
quoted
but how about the other fields like Swap, Private_Dirty and
Private_Shared?
Private_Shared can be pretty confusing as well without the whole context
as well see my other emails in the original thread (just to remind
shmem/tmpfs makes all this really confusing).
But this is exactly the issue -- RSS is can be just as confusing if
you don't know something about the application.
I agree that rss can be confusing but we will not make the situation any
better if we add yet another confusing metric.
quoted
I think the issue is
how common that situation is, and you seem to believe that it's so
uncommon that it's actually better to keep the information more
difficult to get for those of us who know something about our systems.
That's fine, I guess we just have to disagree here, thanks for look at this.
I think you should just step back and think more about what exactly
you expect from the counter(s). I believe what you want is an
estimate of a freeable memory when the particular process dies or is
killed. That would mean resident single mapped private anonymous memory
+ unlinked single mapped shareable mappings + single mapped swapped out
memory. Maybe I've missed something but it should be something along
those lines. Definitely something that the current smaps infrastructure
doesn't give you, though.
Yes your description of what we want is pretty good. Having a
reasonable lower bound on the estimate is fine, though we probably
want to break out swapped out memory separately.
Why would you want to separate that?
Given that smaps
doesn't provide this in a straightforward way, what do you think is
the right way to provide this information?
I would be tempted to sneak it into /proc/<pid>/statm because that looks
like a proper place but getting this information is not for free
performance wise so I am not really sure something that relies on this
file would see unexpected stalls. Maybe this could be worked around by
some caching... I would suggest to check who is actually using this file
(top/ps etc...)
If this would be unacceptable then a new file could be considered.
--
Michal Hocko
SUSE Labs
From: Robert Foss <hidden> Date: 2016-09-19 15:16:44
On 2016-09-14 05:12 AM, Michal Hocko wrote:
On Tue 13-09-16 13:27:39, Sonny Rao wrote:
quoted
On Tue, Sep 13, 2016 at 12:12 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 12-09-16 10:28:53, Sonny Rao wrote:
quoted
On Mon, Sep 12, 2016 at 10:15 AM, Michal Hocko [off-list ref] wrote:
quoted
On Mon 12-09-16 08:31:36, Sonny Rao wrote:
[...]
quoted
quoted
quoted
but how about the other fields like Swap, Private_Dirty and
Private_Shared?
Private_Shared can be pretty confusing as well without the whole context
as well see my other emails in the original thread (just to remind
shmem/tmpfs makes all this really confusing).
But this is exactly the issue -- RSS is can be just as confusing if
you don't know something about the application.
I agree that rss can be confusing but we will not make the situation any
better if we add yet another confusing metric.
quoted
I think the issue is
how common that situation is, and you seem to believe that it's so
uncommon that it's actually better to keep the information more
difficult to get for those of us who know something about our systems.
That's fine, I guess we just have to disagree here, thanks for look at this.
I think you should just step back and think more about what exactly
you expect from the counter(s). I believe what you want is an
estimate of a freeable memory when the particular process dies or is
killed. That would mean resident single mapped private anonymous memory
+ unlinked single mapped shareable mappings + single mapped swapped out
memory. Maybe I've missed something but it should be something along
those lines. Definitely something that the current smaps infrastructure
doesn't give you, though.
Yes your description of what we want is pretty good. Having a
reasonable lower bound on the estimate is fine, though we probably
want to break out swapped out memory separately.
Why would you want to separate that?
quoted
Given that smaps
doesn't provide this in a straightforward way, what do you think is
the right way to provide this information?
I would be tempted to sneak it into /proc/<pid>/statm because that looks
like a proper place but getting this information is not for free
performance wise so I am not really sure something that relies on this
file would see unexpected stalls. Maybe this could be worked around by
some caching... I would suggest to check who is actually using this file
(top/ps etc...)
What would this caching look like? Can any information be re-used between vma walks?
If this would be unacceptable then a new file could be considered.
From: Michal Hocko <mhocko@kernel.org> Date: 2016-09-19 19:32:43
On Mon 19-09-16 11:16:31, Robert Foss wrote:
On 2016-09-14 05:12 AM, Michal Hocko wrote:
quoted
On Tue 13-09-16 13:27:39, Sonny Rao wrote:
[...]
quoted
quoted
Given that smaps
doesn't provide this in a straightforward way, what do you think is
the right way to provide this information?
I would be tempted to sneak it into /proc/<pid>/statm because that looks
like a proper place but getting this information is not for free
performance wise so I am not really sure something that relies on this
file would see unexpected stalls. Maybe this could be worked around by
some caching... I would suggest to check who is actually using this file
(top/ps etc...)
What would this caching look like? Can any information be re-used between
vma walks?
yes basically return the same value if called within HZ or something
similar. But that assumes that statm latency really matters and it is
called often enough.
--
Michal Hocko
SUSE Labs
From: Robert Foss <hidden> Date: 2016-09-20 00:27:42
On 2016-09-19 03:32 PM, Michal Hocko wrote:
On Mon 19-09-16 11:16:31, Robert Foss wrote:
quoted
On 2016-09-14 05:12 AM, Michal Hocko wrote:
quoted
On Tue 13-09-16 13:27:39, Sonny Rao wrote:
[...]
quoted
quoted
quoted
Given that smaps
doesn't provide this in a straightforward way, what do you think is
the right way to provide this information?
I would be tempted to sneak it into /proc/<pid>/statm because that looks
like a proper place but getting this information is not for free
performance wise so I am not really sure something that relies on this
file would see unexpected stalls. Maybe this could be worked around by
some caching... I would suggest to check who is actually using this file
(top/ps etc...)
What would this caching look like? Can any information be re-used between
vma walks?
yes basically return the same value if called within HZ or something
similar. But that assumes that statm latency really matters and it is
called often enough.
Any single application querying more often than HZ, would presumably do so for accuracy reasons.
However for multiple applications that combined query more often than HZ, this would most definitely be halpful in terms of performance.
@Sonny, does chromiumos fall into the first or second category?
On Mon, Sep 19, 2016 at 5:27 PM, Robert Foss [off-list ref] wrote:
On 2016-09-19 03:32 PM, Michal Hocko wrote:
quoted
On Mon 19-09-16 11:16:31, Robert Foss wrote:
quoted
On 2016-09-14 05:12 AM, Michal Hocko wrote:
quoted
On Tue 13-09-16 13:27:39, Sonny Rao wrote:
[...]
quoted
quoted
quoted
Given that smaps
doesn't provide this in a straightforward way, what do you think is
the right way to provide this information?
I would be tempted to sneak it into /proc/<pid>/statm because that looks
like a proper place but getting this information is not for free
performance wise so I am not really sure something that relies on this
file would see unexpected stalls. Maybe this could be worked around by
some caching... I would suggest to check who is actually using this file
(top/ps etc...)
What would this caching look like? Can any information be re-used between
vma walks?
yes basically return the same value if called within HZ or something
similar. But that assumes that statm latency really matters and it is
called often enough.
Any single application querying more often than HZ, would presumably do so
for accuracy reasons.
However for multiple applications that combined query more often than HZ,
this would most definitely be halpful in terms of performance.
@Sonny, does chromiumos fall into the first or second category?
It's a single application -- and it definitely doesn't query at HZ --
especially given how long it takes to gather the data :-)