From: "Martin J. Bligh" <mbligh@aracnet.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-mm mailing list <linux-mm@kvack.org>
Subject: Breakout struct page
Date: Sat, 05 Oct 2002 00:18:23 -0700 [thread overview]
Message-ID: <1165733025.1033777103@[10.10.2.3]> (raw)
[-- Attachment #1: Type: text/plain, Size: 5091 bytes --]
This very boring patch breaks out struct page into it's own header
file. This should allow you to do struct page arithmetic in other
header files using static inlines instead of horribly complex macros
... by just including <linux/struct_page.h>, which avoids dependency
problems.
(inlined to read, attatched for lower probability of mangling)
Martin.
diff -purN -X /home/mbligh/.diff.exclude virgin/include/linux/mm.h struct_page/include/linux/mm.h
--- virgin/include/linux/mm.h Fri Oct 4 12:15:24 2002
+++ struct_page/include/linux/mm.h Fri Oct 4 23:10:08 2002
@@ -132,55 +132,7 @@ struct vm_operations_struct {
struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int unused);
};
-/* forward declaration; pte_chain is meant to be internal to rmap.c */
-struct pte_chain;
-
-/*
- * Each physical page in the system has a struct page associated with
- * it to keep track of whatever it is we are using the page for at the
- * moment. Note that we have no way to track which tasks are using
- * a page.
- *
- * Try to keep the most commonly accessed fields in single cache lines
-
* here (16 bytes or greater). This ordering should be particularly
- * beneficial on 32-bit processors.
- *
- * The first line is data used in page cache lookup, the second line
- * is used for linear searches (eg. clock algorithm scans).
- *
- * TODO: make this structure smaller, it could be as small as 32 bytes.
- */
-struct page {
- unsigned long flags; /* atomic flags, some possibly
- updated asynchronously */
- atomic_t count; /* Usage count, see below. */
- struct list_head list; /* ->mapping has some page lists. */
- struct address_space *mapping; /* The inode (or ...) we belong to. */
- unsigned long index; /* Our offset within mapping. */
- struct list_head lru; /* Pageout list, eg. active_list;
- protected by
zone->lru_lock !! */
- union {
- struct pte_chain *chain;/* Reverse pte mapping pointer.
- * protected by PG_chainlock */
- pte_addr_t direct;
- } pte;
- unsigned long private; /* mapping-private opaque data */
-
- /*
- * On machines where all RAM is mapped into kernel address space,
- * we can simply calculate the virtual address. On machines with
- * highmem some memory is mapped into kernel virtual memory
- * dynamically, so we need a place to store that address.
- * Note that this field could be 16 bits on x86 ... ;)
- *
- * Architectures with slow multiplication can define
- * WANT_PAGE_VIRTUAL in asm/page.h
- */
-#if defined(WANT_PAGE_VIRTUAL)
- void *virtual; /* Kernel virtual address (NULL if
- not kmapped, ie.
highmem) */
-#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
-};
+#include <linux/struct_page.h>
/*
* FIXME: take this include out, include page-flags.h in
diff -purN -X /home/mbligh/.diff.exclude virgin/include/linux/struct_page.h struct_page/include/linux/struct_page.h
--- virgin/include/linux/struct_page.h Wed Dec 31 16:00:00 1969
+++ struct_page/include/linux/struct_page.h Fri Oct 4 23:09:15 2002
@@ -0,0 +1,54 @@
+#ifndef _LINUX_STRUCT_PAGE_H
+#define _LINUX_STRUCT_PAGE_H
+
+/* forward declaration; pte_chain is meant to be internal to rmap.c */
+struct pte_chain;
+
+/*
+ * Each physical page in the system has a struct page associated with
+ * it to keep track of whatever it is we are using the page for at the
+ * moment. Note that we have
no way to track which tasks are using
+ * a page.
+ *
+ * Try to keep the most commonly accessed fields in single cache lines
+ * here (16 bytes or greater). This ordering should be particularly
+ * beneficial on 32-bit processors.
+ *
+ * The first line is data used in page cache lookup, the second line
+ * is used for linear searches (eg. clock algorithm scans).
+ *
+ * TODO: make this structure smaller, it could be as small as 32 bytes.
+ */
+struct page {
+ unsigned long flags; /* atomic flags, some possibly
+ updated asynchronously */
+ atomic_t count; /* Usage count, see below. */
+ struct list_head list; /* ->mapping has some page lists. */
+ struct address_space *mapping; /* The inode (or ...) we belong to. */
+ unsigned long
index; /* Our offset within mapping. */
+ struct list_head lru; /* Pageout list, eg. active_list;
+ protected by zone->lru_lock !! */
+ union {
+ struct pte_chain *chain;/* Reverse pte mapping pointer.
+ * protected by PG_chainlock */
+ pte_addr_t direct;
+ } pte;
+ unsigned long private; /* mapping-private opaque data */
+
+ /*
+ * On machines where all RAM is mapped into kernel address space,
+ * we can simply calculate the virtual address. On machines with
+ * highmem some memory is mapped into kernel virtual memory
+ * dynamically, so we need a place to store that address.
+ * Note that this field could be 16 bits on x86 ... ;)
+ *
+ * Architectures with slow multiplication can define
+ * WANT_PAGE_VIRTUAL in asm/page.h
+ */
+#if defined(WANT_PAGE_VIRTUAL)
+ void *virtual; /* Kernel virtual address (NULL if
+ not kmapped, ie. highmem) */
+#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
+};
+
+#endif
[-- Attachment #2: struct_page --]
[-- Type: application/octet-stream, Size: 4734 bytes --]
diff -purN -X /home/mbligh/.diff.exclude virgin/include/linux/mm.h struct_page/include/linux/mm.h
--- virgin/include/linux/mm.h Fri Oct 4 12:15:24 2002
+++ struct_page/include/linux/mm.h Fri Oct 4 23:10:08 2002
@@ -132,55 +132,7 @@ struct vm_operations_struct {
struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int unused);
};
-/* forward declaration; pte_chain is meant to be internal to rmap.c */
-struct pte_chain;
-
-/*
- * Each physical page in the system has a struct page associated with
- * it to keep track of whatever it is we are using the page for at the
- * moment. Note that we have no way to track which tasks are using
- * a page.
- *
- * Try to keep the most commonly accessed fields in single cache lines
- * here (16 bytes or greater). This ordering should be particularly
- * beneficial on 32-bit processors.
- *
- * The first line is data used in page cache lookup, the second line
- * is used for linear searches (eg. clock algorithm scans).
- *
- * TODO: make this structure smaller, it could be as small as 32 bytes.
- */
-struct page {
- unsigned long flags; /* atomic flags, some possibly
- updated asynchronously */
- atomic_t count; /* Usage count, see below. */
- struct list_head list; /* ->mapping has some page lists. */
- struct address_space *mapping; /* The inode (or ...) we belong to. */
- unsigned long index; /* Our offset within mapping. */
- struct list_head lru; /* Pageout list, eg. active_list;
- protected by zone->lru_lock !! */
- union {
- struct pte_chain *chain;/* Reverse pte mapping pointer.
- * protected by PG_chainlock */
- pte_addr_t direct;
- } pte;
- unsigned long private; /* mapping-private opaque data */
-
- /*
- * On machines where all RAM is mapped into kernel address space,
- * we can simply calculate the virtual address. On machines with
- * highmem some memory is mapped into kernel virtual memory
- * dynamically, so we need a place to store that address.
- * Note that this field could be 16 bits on x86 ... ;)
- *
- * Architectures with slow multiplication can define
- * WANT_PAGE_VIRTUAL in asm/page.h
- */
-#if defined(WANT_PAGE_VIRTUAL)
- void *virtual; /* Kernel virtual address (NULL if
- not kmapped, ie. highmem) */
-#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
-};
+#include <linux/struct_page.h>
/*
* FIXME: take this include out, include page-flags.h in
diff -purN -X /home/mbligh/.diff.exclude virgin/include/linux/struct_page.h struct_page/include/linux/struct_page.h
--- virgin/include/linux/struct_page.h Wed Dec 31 16:00:00 1969
+++ struct_page/include/linux/struct_page.h Fri Oct 4 23:09:15 2002
@@ -0,0 +1,54 @@
+#ifndef _LINUX_STRUCT_PAGE_H
+#define _LINUX_STRUCT_PAGE_H
+
+/* forward declaration; pte_chain is meant to be internal to rmap.c */
+struct pte_chain;
+
+/*
+ * Each physical page in the system has a struct page associated with
+ * it to keep track of whatever it is we are using the page for at the
+ * moment. Note that we have no way to track which tasks are using
+ * a page.
+ *
+ * Try to keep the most commonly accessed fields in single cache lines
+ * here (16 bytes or greater). This ordering should be particularly
+ * beneficial on 32-bit processors.
+ *
+ * The first line is data used in page cache lookup, the second line
+ * is used for linear searches (eg. clock algorithm scans).
+ *
+ * TODO: make this structure smaller, it could be as small as 32 bytes.
+ */
+struct page {
+ unsigned long flags; /* atomic flags, some possibly
+ updated asynchronously */
+ atomic_t count; /* Usage count, see below. */
+ struct list_head list; /* ->mapping has some page lists. */
+ struct address_space *mapping; /* The inode (or ...) we belong to. */
+ unsigned long index; /* Our offset within mapping. */
+ struct list_head lru; /* Pageout list, eg. active_list;
+ protected by zone->lru_lock !! */
+ union {
+ struct pte_chain *chain;/* Reverse pte mapping pointer.
+ * protected by PG_chainlock */
+ pte_addr_t direct;
+ } pte;
+ unsigned long private; /* mapping-private opaque data */
+
+ /*
+ * On machines where all RAM is mapped into kernel address space,
+ * we can simply calculate the virtual address. On machines with
+ * highmem some memory is mapped into kernel virtual memory
+ * dynamically, so we need a place to store that address.
+ * Note that this field could be 16 bits on x86 ... ;)
+ *
+ * Architectures with slow multiplication can define
+ * WANT_PAGE_VIRTUAL in asm/page.h
+ */
+#if defined(WANT_PAGE_VIRTUAL)
+ void *virtual; /* Kernel virtual address (NULL if
+ not kmapped, ie. highmem) */
+#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
+};
+
+#endif
next reply other threads:[~2002-10-05 7:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-05 7:18 Martin J. Bligh [this message]
2002-10-05 8:22 ` Andrew Morton
2002-10-07 18:30 ` Christoph Hellwig
2002-10-07 18:43 ` Martin J. Bligh
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='1165733025.1033777103@[10.10.2.3]' \
--to=mbligh@aracnet.com \
--cc=akpm@digeo.com \
--cc=linux-mm@kvack.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