lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 May 2008 19:20:57 +0200
From:	Johannes Weiner <hannes@...urebad.de>
To:	Martin Schwidefsky <schwidefsky@...ibm.com>
Cc:	linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
	Heiko Carstens <heiko.carstens@...ibm.com>
Subject: Re: [patch 06/11] showmem: Only walk spanned pages.

Hi,

Martin Schwidefsky <schwidefsky@...ibm.com> writes:

> From: Heiko Carstens <heiko.carstens@...ibm.com>
>
> Convert show_mem() so its nearly the same as on x86/powerpc.
> Gives us proper locking and we get also rid of the only use of max_mapnr.
> Also the number of pages was contained in an int which might not be
> sufficient not too far in the future.
>
> Signed-off-by: Heiko Carstens <heiko.carstens@...ibm.com>
> Signed-off-by: Martin Schwidefsky <schwidefsky@...ibm.com>
> ---
>
>  arch/s390/mm/init.c |   42 +++++++++++++++++++++++-------------------
>  1 file changed, 23 insertions(+), 19 deletions(-)
>
> Index: quilt-2.6/arch/s390/mm/init.c
> ===================================================================
> --- quilt-2.6.orig/arch/s390/mm/init.c
> +++ quilt-2.6/arch/s390/mm/init.c
> @@ -44,30 +44,34 @@ char  empty_zero_page[PAGE_SIZE] __attri
>  
>  void show_mem(void)
>  {
> -	int i, total = 0, reserved = 0;
> -	int shared = 0, cached = 0;
> +	unsigned long i, total = 0, reserved = 0;
> +	unsigned long shared = 0, cached = 0;
> +	unsigned long flags;
>  	struct page *page;
> +	pg_data_t *pgdat;
>  
>  	printk("Mem-info:\n");
>  	show_free_areas();
> -	i = max_mapnr;
> -	while (i-- > 0) {
> -		if (!pfn_valid(i))
> -			continue;
> -		page = pfn_to_page(i);
> -		total++;
> -		if (PageReserved(page))
> -			reserved++;
> -		else if (PageSwapCache(page))
> -			cached++;
> -		else if (page_count(page))
> -			shared += page_count(page) - 1;
> +	for_each_online_pgdat(pgdat) {
> +		pgdat_resize_lock(pgdat, &flags);
> +		for (i = 0; i < pgdat->node_spanned_pages; i++) {
> +			if (!pfn_valid(pgdat->node_start_pfn + i))
> +				continue;
> +			page = pfn_to_page(pgdat->node_start_pfn + i);
> +			total++;
> +			if (PageReserved(page))
> +				reserved++;
> +			else if (PageSwapCache(page))
> +				cached++;
> +			else if (page_count(page))
> +				shared += page_count(page) - 1;
> +		}
> +		pgdat_resize_unlock(pgdat, &flags);
>  	}
> -	printk("%d pages of RAM\n", total);
> -	printk("%d reserved pages\n", reserved);
> -	printk("%d pages shared\n", shared);
> -	printk("%d pages swap cached\n", cached);
> -
> +	printk("%ld pages of RAM\n", total);
> +	printk("%ld reserved pages\n", reserved);
> +	printk("%ld pages shared\n", shared);
> +	printk("%ld pages swap cached\n", cached);

>  	printk("%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
>  	printk("%lu pages writeback\n", global_page_state(NR_WRITEBACK));
>  	printk("%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));

These are redundant, check show_free_areas().

	Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ