[Crash-utility] [RFC PATCH 2/2] crash: kill dump_zone_page_usage()

Dave Anderson anderson at redhat.com
Fri Nov 21 16:45:50 UTC 2014



----- Original Message -----
> Most of the information provided by this function is duplicated in
> dump_zone_stats(). Also dump_zone_stats() is perhaps more useful.
> As such let's just remove dump_zone_page_usage().

Interesting -- I cannot even find a kernel version that satisfies 
the structure-member-existance requirements in order for the zone
statistics to even be displayed by that function.  But there
must have been some range of kernel releases where it did work,
so I'd prefer to just leave the function alone, albeit in a 
comatose state.

However, since it's so exceedingly rare, I agree that it's worth
removing it from the "help kmem" display.  (and for those antique
kernels where it still applies, it's just an added bonus)

Dave

> 
> Signed-off-by: Aaron Tomlin <atomlin at redhat.com>
> ---
>  help.c   |  7 -----
>  memory.c | 97
>  ----------------------------------------------------------------
>  2 files changed, 104 deletions(-)
> 
> diff --git a/help.c b/help.c
> index bedd7c3..cccef23 100644
> --- a/help.c
> +++ b/help.c
> @@ -5608,13 +5608,6 @@ char *help_kmem[] = {
>  "     COMMIT LIMIT  2952841      11.3 GB         ----",
>  "        COMMITTED  1158600       4.4 GB   39% of TOTAL LIMIT",
>  "    ",
> -"    ZONE  NAME      FREE   ACTIVE  INACTIVE_DIRTY  INACTIVE_CLEAN
> MIN/LOW/HIGH",
> -"      0   DMA        240     1166               7             161
> 128/256/384 ",
> -"      1   Normal     753    17009           27834               0
> 255/510/765 ",
> -"      2   HighMem      0        0               0               0     0/0/0
> ",
> -
> -
> -" ",
>  "  Display and verify free memory data:\n",
>  "    %s> kmem -f",
>  "    NODE",
> diff --git a/memory.c b/memory.c
> index 823ec75..428df2d 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -142,7 +142,6 @@ static int page_flags_init_from_pageflag_names(void);
>  static int page_flags_init_from_pageflags_enum(void);
>  static int translate_page_flags(char *, ulong);
>  static void dump_free_pages(struct meminfo *);
> -static int dump_zone_page_usage(void);
>  static void dump_multidimensional_free_pages(struct meminfo *);
>  static void dump_free_pages_zones_v1(struct meminfo *);
>  static void dump_free_pages_zones_v2(struct meminfo *);
> @@ -7365,101 +7364,6 @@ done_search:
>  	}
>  }
>  
> -
> -static char *
> -page_usage_hdr = "ZONE  NAME        FREE   ACTIVE  INACTIVE_DIRTY
> INACTIVE_CLEAN  MIN/LOW/HIGH";
> -
> -/*
> - *  Display info about the non-free pages in each zone.
> - */
> -static int
> -dump_zone_page_usage(void)
> -{
> -	int i, n;
> -	ulong value, node_zones;
> -	struct node_table *nt;
> -	ulong inactive_dirty_pages, inactive_clean_pages, active_pages;
> -	ulong free_pages, pages_min, pages_low, pages_high;
> -	char namebuf[BUFSIZE];
> -	char buf1[BUFSIZE];
> -	char buf2[BUFSIZE];
> -	char buf3[BUFSIZE];
> -
> -	if (!VALID_MEMBER(zone_struct_inactive_dirty_pages) ||
> -	    !VALID_MEMBER(zone_struct_inactive_clean_pages) ||
> -	    !VALID_MEMBER(zone_struct_active_pages) ||
> -	    !VALID_MEMBER(zone_struct_pages_min) ||
> -	    !VALID_MEMBER(zone_struct_pages_low) ||
> -	    !VALID_MEMBER(zone_struct_pages_high))
> -		return FALSE;
> -
> -	fprintf(fp, "\n");
> -
> -        for (n = 0; n < vt->numnodes; n++) {
> -                nt = &vt->node_table[n];
> -                node_zones = nt->pgdat + OFFSET(pglist_data_node_zones);
> -
> -		if ((vt->numnodes > 1) && (vt->flags & NODES)) {
> -                	fprintf(fp, "%sNODE\n %2d\n",
> -                        	n ? "\n" : "", nt->node_id);
> -                }
> -		fprintf(fp, "%s\n", page_usage_hdr);
> -
> -                for (i = 0; i < vt->nr_zones; i++) {
> -			readmem(node_zones+OFFSET(zone_struct_free_pages),
> -                                KVADDR, &free_pages, sizeof(ulong),
> -                                "node_zones free_pages", FAULT_ON_ERROR);
> -		        readmem(node_zones+
> -				OFFSET(zone_struct_inactive_dirty_pages),
> -		                KVADDR, &inactive_dirty_pages, sizeof(ulong),
> -		                "node_zones inactive_dirty_pages",
> -				FAULT_ON_ERROR);
> -		        readmem(node_zones+
> -				OFFSET(zone_struct_inactive_clean_pages),
> -		                KVADDR, &inactive_clean_pages, sizeof(ulong),
> -		                "node_zones inactive_clean_pages",
> -				FAULT_ON_ERROR);
> -		        readmem(node_zones+OFFSET(zone_struct_active_pages),
> -		                KVADDR, &active_pages, sizeof(ulong),
> -		                "node_zones active_pages", FAULT_ON_ERROR);
> -		        readmem(node_zones+OFFSET(zone_struct_pages_min),
> -		                KVADDR, &pages_min, sizeof(ulong),
> -		                "node_zones pages_min", FAULT_ON_ERROR);
> -		        readmem(node_zones+OFFSET(zone_struct_pages_low),
> -		                KVADDR, &pages_low, sizeof(ulong),
> -		                "node_zones pages_low", FAULT_ON_ERROR);
> -		        readmem(node_zones+OFFSET(zone_struct_pages_high),
> -		                KVADDR, &pages_high, sizeof(ulong),
> -		                "node_zones pages_high", FAULT_ON_ERROR);
> -
> -                        readmem(node_zones+OFFSET(zone_struct_name), KVADDR,
> -                                &value, sizeof(void *),
> -                                "node_zones name", FAULT_ON_ERROR);
> -                        if (read_string(value, buf1, BUFSIZE-1))
> -                                sprintf(namebuf, "%-8s", buf1);
> -                        else
> -                                sprintf(namebuf, "(unknown)");
> -
> -		        sprintf(buf2, "%ld/%ld/%ld",
> -				pages_min, pages_low, pages_high);
> -		        fprintf(fp, "%3d   %s %7ld  %7ld %15ld %15ld  %s\n",
> -				i,
> -				namebuf,
> -		                free_pages,
> -		                active_pages,
> -		                inactive_dirty_pages,
> -		                inactive_clean_pages,
> -		                mkstring(buf3, strlen("MIN/LOW/HIGH"),
> -				CENTER, buf2));
> -
> -			node_zones += SIZE(zone_struct);
> -		}
> -	}
> -
> -	return TRUE;
> -}
> -
> -
>  /*
>   *  Dump the num "order" contents of the zone_t free_area array.
>   */
> @@ -7960,7 +7864,6 @@ dump_kmeminfo(void)
>  			"COMMITTED", committed,
>  			pages_to_size(committed, buf), pct);
>  	}
> -	dump_zone_page_usage();
>  }
>  
>  /*
> --
> 1.9.3
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> 




More information about the Crash-utility mailing list