Skip to contentSkip to conversation

show_free_areas() cleanup

PATCH In review Andrew Morton 1 participant 1 message Jul 28, 2002

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

PATCH 4/13 show_free_areas() cleanup

Cleanup to show_free_areas() from Bill Irwin:

show_free_areas() and show_free_areas_core() is a mess.
(1) it uses a bizarre and ugly form of list iteration to walk buddy lists use standard list functions instead
(2) it prints the same information repeatedly once per-node rationalize the braindamaged iteration logic
(3) show_free_areas_node() is useless and not called anywhere remove it entirely
(4) show_free_areas() itself just calls show_free_areas_core() remove show_free_areas_core() and do the stuff directly
(5) SWAP_CACHE_INFO is always #defined, remove it
(6) INC_CACHE_INFO() doesn't use the do { } while (0) construct

This patch also includes Matthew Dobson's patch which removes mm/numa.c:node_lock. The consensus is that it doesn't do anything now that show_free_areas_node() isn't there.

 include/linux/mm.h   |    1 
 include/linux/swap.h |    3 --
 mm/numa.c            |   16 +----------
 mm/page_alloc.c      |   73 ++++++++++++++++++++-------------------------------
 mm/swap_state.c      |    6 ----
 5 files changed, 33 insertions(+), 66 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~show_free_areas +0 -1
@@ -327,7 +327,6 @@ static inline void set_page_zone(struct 
 extern struct page *mem_map;
 
 extern void show_free_areas(void);
-extern void show_free_areas_node(pg_data_t *pgdat);
 
 extern int fail_writepage(struct page *);
 struct page * shmem_nopage(struct vm_area_struct * vma, unsigned long address, int unused);
include/linux/swap.h renamed from include/linux/swap.h~show_free_areas +0 -3
@@ -176,10 +176,7 @@ int rw_swap_page_sync(int rw, swp_entry_
 /* linux/mm/page_alloc.c */
 
 /* linux/mm/swap_state.c */
-#define SWAP_CACHE_INFO
-#ifdef SWAP_CACHE_INFO
 extern void show_swap_cache_info(void);
-#endif
 extern int add_to_swap_cache(struct page *, swp_entry_t);
 extern int add_to_swap(struct page *);
 extern void __delete_from_swap_cache(struct page *page);
mm/numa.c renamed from mm/numa.c~show_free_areas +2 -14
@@ -44,17 +44,6 @@ struct page * alloc_pages_node(int nid, 
 
 #define LONG_ALIGN(x) (((x)+(sizeof(long))-1)&~((sizeof(long))-1))
 
-static spinlock_t node_lock = SPIN_LOCK_UNLOCKED;
-
-void show_free_areas_node(pg_data_t *pgdat)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&node_lock, flags);
-	show_free_areas_core(pgdat);
-	spin_unlock_irqrestore(&node_lock, flags);
-}
-
 /*
  * Nodes can be initialized parallely, in no particular order.
  */
@@ -106,11 +95,10 @@ struct page * _alloc_pages(unsigned int 
 #ifdef CONFIG_NUMA
 	temp = NODE_DATA(numa_node_id());
 #else
-	spin_lock_irqsave(&node_lock, flags);
-	if (!next) next = pgdat_list;
+	if (!next)
+		next = pgdat_list;
 	temp = next;
 	next = next->node_next;
-	spin_unlock_irqrestore(&node_lock, flags);
 #endif
 	start = temp;
 	while (temp) {
mm/page_alloc.c renamed from mm/page_alloc.c~show_free_areas +30 -43

102 lines not on this page · raw message

mm/swap_state.c renamed from mm/swap_state.c~show_free_areas +1 -5
@@ -42,8 +42,7 @@ struct address_space swapper_space = {
 	private_list:	LIST_HEAD_INIT(swapper_space.private_list),
 };
 
-#ifdef SWAP_CACHE_INFO
-#define INC_CACHE_INFO(x)	(swap_cache_info.x++)
+#define INC_CACHE_INFO(x)	do { swap_cache_info.x++; } while (0)
 
 static struct {
 	unsigned long add_total;
@@ -61,9 +60,6 @@ void show_swap_cache_info(void)
 		swap_cache_info.find_success, swap_cache_info.find_total,
 		swap_cache_info.noent_race, swap_cache_info.exist_race);
 }
-#else
-#define INC_CACHE_INFO(x)	do { } while (0)
-#endif
 
 int add_to_swap_cache(struct page *page, swp_entry_t entry)
 {

.