clean up show_free_areas()
Subsystems (5)
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
$ diffstat ../00_show_free_areas_core-4 include/linux/mm.h | 1 include/linux/swap.h | 3 -- mm/numa.c | 9 ------ mm/page_alloc.c | 73 ++++++++++++++++++++------------------------------- mm/swap_state.c | 6 ---- 5 files changed, 31 insertions(+), 61 deletions(-)
===== include/linux/mm.h 1.56 vs edited =====
include/linux/mm.h +0 -1
@@ -319,7 +319,6 @@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 1.47 vs edited =====
include/linux/swap.h +0 -3
@@ -163,10 +163,7 @@/* 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 void __delete_from_swap_cache (struct page *page);extern void delete_from_swap_cache (struct page *page);
===== mm/numa.c 1.5 vs edited =====
mm/numa.c +0 -9
@@ -46,15 +46,6 @@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. */
===== mm/page_alloc.c 1.78 vs edited =====
mm/page_alloc.c +30 -43
102 lines not on this page · raw message
===== mm/swap_state.c 1.33 vs edited =====
mm/swap_state.c +1 -5
@@ -42,8 +42,7 @@ 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 @@ 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) {