From: Andrew Morton <akpm@osdl.org>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: linux-kernel@vger.kernel.org, Prasanna Meda <pmeda@akamai.com>
Subject: Re: mysterious /proc/<pid>/maps breakage with static binaries in 2.6.10-mm2
Date: Fri, 7 Jan 2005 10:04:22 -0800 [thread overview]
Message-ID: <20050107100422.4dfb8025.akpm@osdl.org> (raw)
In-Reply-To: <1105088099.11504.12.camel@localhost>
Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
> In 2.6.10-mm2, if I look at the maps of a process execve'd from a static
> executable, /proc/<pid>/maps looks wrong.
The first versions of speedup-proc-pid-maps was dodgy. Does this fix?
--- 25/fs/proc/task_mmu.c~speedup-proc-pid-maps-fix 2005-01-07 10:03:04.313758952 -0800
+++ 25-akpm/fs/proc/task_mmu.c 2005-01-07 10:03:04.317758344 -0800
@@ -133,6 +133,15 @@ static void *m_start(struct seq_file *m,
tail_map = get_gate_vma(task);
down_read(&mm->mmap_sem);
+ /*
+ * First map is special, since we remember last_addr
+ * rather than current_addr to hit with mmap_cache most of the time.
+ */
+ if (!l) {
+ map = mm->mmap;
+ goto out;
+ }
+
/* Start with last addr hint */
map = find_vma(mm, last_addr);
if (map) {
@@ -140,7 +149,7 @@ static void *m_start(struct seq_file *m,
goto out;
}
- /* Check the map index is within the range */
+ /* Check the map index is within the range, and do linear scan */
if ((unsigned long)l < mm->map_count) {
map = mm->mmap;
while (l-- && map)
@@ -179,16 +188,16 @@ static void *m_next(struct seq_file *m,
{
struct task_struct *task = m->private;
struct vm_area_struct *map = v;
+ struct vm_area_struct *tail_map = get_gate_vma(task);
+
(*pos)++;
if (map && map->vm_next) {
- m->version = map->vm_next->vm_start;
+ m->version = (map != tail_map)? map->vm_start: -1UL;
return map->vm_next;
}
m_stop(m, v);
m->version = -1UL;
- if (map != get_gate_vma(task))
- return get_gate_vma(task);
- return NULL;
+ return (map != tail_map)? tail_map: NULL;
}
struct seq_operations proc_pid_maps_op = {
_
prev parent reply other threads:[~2005-01-07 18:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-07 8:54 mysterious /proc/<pid>/maps breakage with static binaries in 2.6.10-mm2 Jeremy Fitzhardinge
2005-01-07 9:04 ` Jeremy Fitzhardinge
2005-01-07 9:45 ` Jeremy Fitzhardinge
2005-01-07 18:04 ` Andrew Morton [this message]
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=20050107100422.4dfb8025.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeda@akamai.com \
/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 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.