aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-12-14 20:58:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:15 -0500
commitefa90a981bbc891efad96db2a75b5487e00852ca (patch)
treefc64a5d5b71e84eb1eec2810fb0568a79a361827 /include
parentf29ad6a99b596b8169744d107bf088e8be9e8d0d (diff)
swap_info: change to array of pointers
The swap_info_struct is only 76 or 104 bytes, but it does seem wrong to reserve an array of about 30 of them in bss, when most people will want only one. Change swap_info[] to an array of pointers. That does need a "type" field in the structure: pack it as a char with next type and short prio (aha, char is unsigned by default on PowerPC). Use the (admittedly peculiar) name "type" throughout for this index. /proc/swaps does not take swap_lock: I wouldn't want it to, but do take care with barriers when adding a new item to the array (never removed). Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/swap.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 82aa7e121c05..f1c248796fb8 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -159,9 +159,10 @@ enum {
159 * The in-memory structure used to track swap areas. 159 * The in-memory structure used to track swap areas.
160 */ 160 */
161struct swap_info_struct { 161struct swap_info_struct {
162 unsigned long flags; 162 unsigned long flags; /* SWP_USED etc: see above */
163 int prio; /* swap priority */ 163 signed short prio; /* swap priority of this type */
164 int next; /* next entry on swap list */ 164 signed char type; /* strange name for an index */
165 signed char next; /* next type on the swap list */
165 struct file *swap_file; 166 struct file *swap_file;
166 struct block_device *bdev; 167 struct block_device *bdev;
167 struct list_head extent_list; 168 struct list_head extent_list;