From: Andrew Morton <akpm@osdl.org>
To: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
Cc: michael@metaparadigm.com, linux-kernel@vger.kernel.org, hugh@veritas.com
Subject: Re: [STACK] >3k call path in ide
Date: Thu, 10 Jun 2004 16:10:21 -0700 [thread overview]
Message-ID: <20040610161021.7997ad9d.akpm@osdl.org> (raw)
In-Reply-To: <20040610225938.GF3340@wohnheim.fh-wedel.de>
Jörn Engel <joern@wohnheim.fh-wedel.de> wrote:
>
> read_page_state doesn't exist in 2.6.7-rc3 or 2.6.6-mm5. How is it
> defined?
It was in 2.6.7-rc3-mm1.
struct page_state is large (148 bytes) and we put them on the stack in awkward
code paths (page reclaim...)
So implement a simple read_page_state() which can be used to pluck out a
single member from the all-cpus page_state accumulators.
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
25-akpm/include/linux/page-flags.h | 4 ++++
25-akpm/mm/page_alloc.c | 17 +++++++++++++++++
2 files changed, 21 insertions(+)
diff -puN include/linux/page-flags.h~read_page_state include/linux/page-flags.h
--- 25/include/linux/page-flags.h~read_page_state Wed Jun 9 17:06:33 2004
+++ 25-akpm/include/linux/page-flags.h Wed Jun 9 17:06:33 2004
@@ -139,6 +139,10 @@ DECLARE_PER_CPU(struct page_state, page_
extern void get_page_state(struct page_state *ret);
extern void get_full_page_state(struct page_state *ret);
+extern unsigned long __read_page_state(unsigned offset);
+
+#define read_page_state(member) \
+ __read_page_state(offsetof(struct page_state, member))
#define mod_page_state(member, delta) \
do { \
diff -puN mm/page_alloc.c~read_page_state mm/page_alloc.c
--- 25/mm/page_alloc.c~read_page_state Wed Jun 9 17:06:33 2004
+++ 25-akpm/mm/page_alloc.c Wed Jun 9 17:11:57 2004
@@ -947,6 +947,23 @@ void get_full_page_state(struct page_sta
__get_page_state(ret, sizeof(*ret) / sizeof(unsigned long));
}
+unsigned long __read_page_state(unsigned offset)
+{
+ unsigned long ret = 0;
+ int cpu;
+
+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
+ unsigned long in;
+
+ if (!cpu_possible(cpu))
+ continue;
+
+ in = (unsigned long)&per_cpu(page_states, cpu) + offset;
+ ret += *((unsigned long *)in);
+ }
+ return ret;
+}
+
void get_zone_counts(unsigned long *active,
unsigned long *inactive, unsigned long *free)
{
_
next prev parent reply other threads:[~2004-06-10 23:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-09 12:29 Jörn Engel
2004-06-09 15:23 ` Michael Clark
2004-06-09 16:29 ` Jörn Engel
2004-06-09 19:27 ` Andrew Morton
2004-06-10 22:59 ` Jörn Engel
2004-06-10 23:10 ` Andrew Morton [this message]
2004-06-11 10:53 ` Jörn Engel
2004-10-15 1:58 ` Rusty Russell
2004-06-15 23:34 ` [PATCH] " Randy.Dunlap
2004-06-16 7:11 ` Florian Schirmer
2004-06-16 9:47 ` Jörn Engel
2004-06-16 9:55 ` Florian Schirmer
2004-06-16 10:00 ` Jörn Engel
2004-06-16 17:37 ` [PATCH] [STACK] reduce " Randy.Dunlap
2004-06-16 17:57 ` Jörn Engel
2004-06-16 18:16 ` Randy.Dunlap
2004-06-16 18:29 ` Jörn Engel
2004-06-16 18:49 ` Randy.Dunlap
2004-06-16 18:58 ` Brian Gerst
2004-06-16 19:52 ` Randy.Dunlap
2004-06-16 22:53 ` Randy.Dunlap
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=20040610161021.7997ad9d.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@metaparadigm.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 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®