From: David Miller <davem@davemloft.net>
To: m.kozlowski@tuxland.pl
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
sparclinux@vger.kernel.org
Subject: Re: Linux 2.6.25-rc7 sparc64 loops forever on cat /proc/<pid>/pagemap
Date: Wed, 26 Mar 2008 17:35:27 -0700 (PDT) [thread overview]
Message-ID: <20080326.173527.193701097.davem@davemloft.net> (raw)
In-Reply-To: <200803261302.46313.m.kozlowski@tuxland.pl>
From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Date: Wed, 26 Mar 2008 13:02:45 +0100
> cat /proc/<pid>/pagemap
>
> and
>
> cat /proc/<pid>/task/<pid>/pagemap
>
> eats up to 100% of CPU while looping forever somewhere. On the other
> hand on my old x86 the same commands take well below 1s so I
> guess that is the expected behaviour.
The patch below will speed this up for 32-bit processes but for 64-bit
ones it's still going to take a long time.
Cat'ing this file writes a 64-bit value for every possible page in the
task's address space, which for 64-bit is an enormous number of
entries.
This is not how this file is supposed to be used. Programs are
supposed to inspect /proc/${PID}/maps, and use those ranges to lseek()
around the pagemap file and fish out the values they need.
This expensive operation is quite harmless, the process can still be
killed, it is not unstoppable.
commit c101b088ba0ed16d7109b2f3c2d16798d162a535
Author: David S. Miller <davem@davemloft.net>
Date: Wed Mar 26 17:32:33 2008 -0700
[SPARC64]: Define TASK_SIZE_OF()
This make "cat /proc/${PID}/pagemap" more efficient for
32-bit tasks.
Based upon a report by Mariusz Kozlowski.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index 8da484c..885b6a1 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -37,6 +37,9 @@
#endif
#define TASK_SIZE ((unsigned long)-VPTE_SIZE)
+#define TASK_SIZE_OF(tsk) \
+ (test_tsk_thread_flag(tsk,TIF_32BIT) ? \
+ (1UL << 32UL) : TASK_SIZE)
#ifdef __KERNEL__
#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
next prev parent reply other threads:[~2008-03-27 0:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-26 2:07 Linux 2.6.25-rc7 Linus Torvalds
2008-03-26 10:42 ` sparc64 BUG: using smp_processor_id() in preemptible Mariusz Kozlowski
2008-03-26 11:16 ` David Miller
2008-03-26 11:25 ` David Miller
2008-03-26 11:46 ` Mariusz Kozlowski
2008-03-26 11:51 ` David Miller
2008-03-26 12:10 ` Mariusz Kozlowski
2008-03-27 3:25 ` Andrew Morton
2008-03-27 6:33 ` David Miller
2008-03-26 12:02 ` Linux 2.6.25-rc7 sparc64 loops forever on cat /proc/<pid>/pagemap Mariusz Kozlowski
2008-03-27 0:35 ` David Miller [this message]
2008-03-28 11:33 ` Mariusz Kozlowski
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=20080326.173527.193701097.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=m.kozlowski@tuxland.pl \
--cc=sparclinux@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®