From: William Lee Irwin III <wli@holomorphy.com>
To: Albert Cahalan <albert@users.sf.net>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: fix text reporting in O(1) proc_pid_statm()
Date: Tue, 24 Aug 2004 20:04:37 -0700 [thread overview]
Message-ID: <20040825030437.GO2793@holomorphy.com> (raw)
In-Reply-To: <1093402351.434.631.camel@cube>
On Tue, 2004-08-24 at 19:12, William Lee Irwin III wrote:
>> The current 2.6 semantics are purely virtual, so this merely
>> reimplements those semantics more efficiently. The scheme you
>> describe would require accounting at the time of pte modification
>> to implement in a like fashion, which has been rejected.
On Tue, Aug 24, 2004 at 10:52:31PM -0400, Albert Cahalan wrote:
> Hmmm, why not reject RSS too then? It's the same thing.
> If trs and drs and so on were kept, then rss would
> just be the sum of them. Per-permission tracking
> seems about right:
> rss[perms] += change;
> (where "perms" is rwx plus shared/private and dirty/clean)
> At some point, it would be good to have per-vma rss.
> This would be displayed by the pmap command's -x option.
> (added to /proc/*/maps right before the filename)
Generally the way these patches have operated is accounting
only the interesting combinations of those with respect to
reporting in the interest of conserving space in the mm. These
have also been combined with various checks on e.g. address
ranges and some special casing of hugetlb. So it's not been
quite as simple as all that.
The code from my 2.6.0-test7-bk1 forward port of the Red Hat patches
for this was as follows:
static inline void vm_account(struct vm_area_struct *vma, pte_t pte,
unsigned long addr, long adjustment)
{
struct mm_struct *mm = vma->vm_mm;
unsigned long pfn;
struct page *page;
if (!pte_present(pte))
return;
pfn = pte_pfn(pte);
if (!pfn_valid(pfn))
goto out;
page = pfn_to_page(pfn);
if (PageReserved(page))
goto out;
if (vma->vm_flags & VM_EXECUTABLE)
mm->text += adjustment;
else if (vma->vm_flags & (VM_STACK_FLAGS & (VM_GROWSUP | VM_GROWSDOWN))) {
mm->data += adjustment;
mm->stack += adjustment;
} else if (addr >= TASK_UNMAPPED_BASE)
mm->lib += adjustment;
else
mm->data += adjustment;
if (page_mapping(page))
mm->shared += adjustment;
out:
if (pte_write(pte))
mm->dirty += adjustment;
}
-- wli
next prev parent reply other threads:[~2004-08-25 3:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-24 23:06 fix text reporting in O(1) proc_pid_statm() Albert Cahalan
2004-08-24 23:12 ` William Lee Irwin III
2004-08-24 23:18 ` William Lee Irwin III
2004-08-24 23:24 ` William Lee Irwin III
2004-08-25 0:01 ` William Lee Irwin III
2004-08-25 2:52 ` Albert Cahalan
2004-08-25 3:04 ` William Lee Irwin III [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-08-22 8:34 2.6.8.1-mm4 Andrew Morton
2004-08-23 20:21 ` 2.6.8.1-mm4 wli
2004-08-24 6:14 ` 2.6.8.1-mm4 Andrew Morton
2004-08-24 7:55 ` O(1) proc_pid_statm() William Lee Irwin III
2004-08-24 17:05 ` fix text reporting in " William Lee Irwin III
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=20040825030437.GO2793@holomorphy.com \
--to=wli@holomorphy.com \
--cc=albert@users.sf.net \
--cc=linux-kernel@vger.kernel.org \
/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