linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: "fengguang.wu" <fengguang.wu@intel.com>,
	majianpeng <majianpeng@gmail.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm: Fix signal SIGFPE in slabinfo.c.
Date: Mon, 2 Jul 2012 14:49:23 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1207021448340.31690@router.home> (raw)
In-Reply-To: <201206260930282811070@gmail.com>

Acked-by: Christoph Lameter <cl@linux.com>

On Tue, 26 Jun 2012, majianpeng wrote:

> In function slab_stats(), if total_free is equal zero, it will error.
> So fix it.
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
>  tools/vm/slabinfo.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c
> index 164cbcf..808d5a9 100644
> --- a/tools/vm/slabinfo.c
> +++ b/tools/vm/slabinfo.c
> @@ -437,34 +437,34 @@ static void slab_stats(struct slabinfo *s)
>  	printf("Fastpath             %8lu %8lu %3lu %3lu\n",
>  		s->alloc_fastpath, s->free_fastpath,
>  		s->alloc_fastpath * 100 / total_alloc,
> -		s->free_fastpath * 100 / total_free);
> +		total_free ? s->free_fastpath * 100 / total_free : 0);
>  	printf("Slowpath             %8lu %8lu %3lu %3lu\n",
>  		total_alloc - s->alloc_fastpath, s->free_slowpath,
>  		(total_alloc - s->alloc_fastpath) * 100 / total_alloc,
> -		s->free_slowpath * 100 / total_free);
> +		total_free ? s->free_slowpath * 100 / total_free : 0);
>  	printf("Page Alloc           %8lu %8lu %3lu %3lu\n",
>  		s->alloc_slab, s->free_slab,
>  		s->alloc_slab * 100 / total_alloc,
> -		s->free_slab * 100 / total_free);
> +		total_free ? s->free_slab * 100 / total_free : 0);
>  	printf("Add partial          %8lu %8lu %3lu %3lu\n",
>  		s->deactivate_to_head + s->deactivate_to_tail,
>  		s->free_add_partial,
>  		(s->deactivate_to_head + s->deactivate_to_tail) * 100 / total_alloc,
> -		s->free_add_partial * 100 / total_free);
> +		total_free ? s->free_add_partial * 100 / total_free : 0);
>  	printf("Remove partial       %8lu %8lu %3lu %3lu\n",
>  		s->alloc_from_partial, s->free_remove_partial,
>  		s->alloc_from_partial * 100 / total_alloc,
> -		s->free_remove_partial * 100 / total_free);
> +		total_free ? s->free_remove_partial * 100 / total_free : 0);
>
>  	printf("Cpu partial list     %8lu %8lu %3lu %3lu\n",
>  		s->cpu_partial_alloc, s->cpu_partial_free,
>  		s->cpu_partial_alloc * 100 / total_alloc,
> -		s->cpu_partial_free * 100 / total_free);
> +		total_free ? s->cpu_partial_free * 100 / total_free : 0);
>
>  	printf("RemoteObj/SlabFrozen %8lu %8lu %3lu %3lu\n",
>  		s->deactivate_remote_frees, s->free_frozen,
>  		s->deactivate_remote_frees * 100 / total_alloc,
> -		s->free_frozen * 100 / total_free);
> +		total_free ? s->free_frozen * 100 / total_free : 0);
>
>  	printf("Total                %8lu %8lu\n\n", total_alloc, total_free);
>
>

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

       reply	other threads:[~2012-07-02 19:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201206260930282811070@gmail.com>
2012-07-02 19:49 ` Christoph Lameter [this message]
2012-07-02 20:12   ` Pekka Enberg
2012-07-02 20:29     ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1207021448340.31690@router.home \
    --to=cl@linux.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=majianpeng@gmail.com \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox