Skip to contentSkip to conversation

Neaten page virtual choice

PATCH In review Matthew Wilcox 3 participants 4 messages Dec 2, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Neaten page virtual choice

Make it more obvious that WANT_PAGE_VIRTUAL/HASHED_PAGE_VIRTUAL/!HIGHMEM is a three way choice.

Index: linux/include/linux/mm.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/linux/mm.h,v
retrieving revision 1.22

include/linux/mm.h +12 -19
diff -u -p -r1.22 mm.h
@@ -414,29 +414,22 @@ static inline void *lowmem_page_address(
 	return __va(page_to_pfn(page) << PAGE_SHIFT);
 }
 
-#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
-#define HASHED_PAGE_VIRTUAL
-#endif
-
 #if defined(WANT_PAGE_VIRTUAL)
-#define page_address(page) ((page)->virtual)
-#define set_page_address(page, address)			\
+  #define page_address(page) ((page)->virtual)
+  #define set_page_address(page, address)			\
 	do {						\
 		(page)->virtual = (address);		\
 	} while(0)
-#define page_address_init()  do { } while(0)
-#endif
-
-#if defined(HASHED_PAGE_VIRTUAL)
-void *page_address(struct page *page);
-void set_page_address(struct page *page, void *virtual);
-void page_address_init(void);
-#endif
-
-#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL)
-#define page_address(page) lowmem_page_address(page)
-#define set_page_address(page, address)  do { } while(0)
-#define page_address_init()  do { } while(0)
+  #define page_address_init()  do { } while(0)
+#elif defined(CONFIG_HIGHMEM)
+  #define HASHED_PAGE_VIRTUAL
+  void *page_address(struct page *page);
+  void set_page_address(struct page *page, void *virtual);
+  void page_address_init(void);
+#else
+  #define page_address(page) lowmem_page_address(page)
+  #define set_page_address(page, address)  do { } while(0)
+  #define page_address_init()  do { } while(0)
 #endif
 
 /*

Index: linux/mm/highmem.c
===================================================================
RCS file: /var/cvs/linux-2.6/mm/highmem.c,v
retrieving revision 1.8

mm/highmem.c +2 -2
diff -u -p -r1.8 highmem.c
@@ -483,7 +483,7 @@ void blk_queue_bounce(request_queue_t *q
 
 EXPORT_SYMBOL(blk_queue_bounce);
 
-#if defined(HASHED_PAGE_VIRTUAL)
+#ifdef HASHED_PAGE_VIRTUAL
 
 #define PA_HASH_ORDER	7
 
@@ -602,4 +602,4 @@ void __init page_address_init(void)
 	spin_lock_init(&pool_lock);
 }
 
-#endif	/* defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) */
+#endif	/* HASHED_PAGE_VIRTUAL */
Signature · 11 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

include/linux/mm.h static inline void *lowmem_page_address( · line 419

Quoted 5 lines

#if defined(WANT_PAGE_VIRTUAL)

include/linux/mm.h +2 -2
-#define page_address(page) ((page)->virtual)
-#define set_page_address(page, address)			\
+  #define page_address(page) ((page)->virtual)
+  #define set_page_address(page, address)			\

urgg, this is a horrible non-standard indentation.

If you look at other kernel source you see either:

- no indentation inside #ifdef at all (seems like most of the source)
- indentation after the leading #
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw

--Christoph Hellwig <[email protected]> wrote (on Thursday, December 02, 2004 18:35:06 +0000):

Quoted 8 lines

include/linux/mm.h static inline void *lowmem_page_address( · line 419

Quoted 5 lines
 # if defined(WANT_PAGE_VIRTUAL)
include/linux/mm.h +2 -2
-#define page_address(page) ((page)->virtual)
-#define set_page_address(page, address)			\
+  #define page_address(page) ((page)->virtual)
+  #define set_page_address(page, address)			\

urgg, this is a horrible non-standard indentation.

Quoted 4 lines

If you look at other kernel source you see either:

- no indentation inside #ifdef at all (seems like most of the source)
- indentation after the leading #

To be fair, both of those seem far more horrible than the above ;-) Though I'd agree it's not exactly standard.

M.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 5 lines
Quoted 2 lines

- no indentation inside #ifdef at all (seems like most of the source)
- indentation after the leading #

To be fair, both of those seem far more horrible than the above ;-) Though I'd agree it's not exactly standard.

I completely disagree.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>