All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: linux-next@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Nitin Gupta <ngupta@vflare.org>, Greg KH <greg@kroah.com>,
	driverdevel <devel@driverdev.osuosl.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] zcache: Use div_u64 for 64-bit division
Date: Thu, 4 Aug 2011 15:17:07 -0700	[thread overview]
Message-ID: <20110804151707.ccb67e28.rdunlap@xenotime.net> (raw)
In-Reply-To: <1312495234-20961-1-git-send-email-cascardo@holoscopio.com>

On Thu,  4 Aug 2011 19:00:33 -0300 Thadeu Lima de Souza Cascardo wrote:

> xv_get_total_size_bytes returns a u64 value and it's used in a division.
> This causes build failures in 32-bit architectures, as reported by Randy
> Dunlap.
> 
> Reported-by: Randy Dunlap <rdunlap@xenotime.net>
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
> Cc: Nitin Gupta <ngupta@vflare.org>
> Cc: Greg KH <greg@kroah.com>
> Cc: driverdevel <devel@driverdev.osuosl.org>
> Cc: linux-next@vger.kernel.org
> Cc: LKML <linux-kernel@vger.kernel.org>

Acked-by: Randy Dunlap <rdunlap@xenotime.net>

Thanks.

> ---
>  drivers/staging/zcache/zcache-main.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index 66469ac..2c41c44 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -28,6 +28,7 @@
>  #include <linux/spinlock.h>
>  #include <linux/types.h>
>  #include <linux/atomic.h>
> +#include <linux/math64.h>
>  #include "tmem.h"
>  
>  #include "../zram/xvmalloc.h" /* if built in drivers/staging */
> @@ -1162,6 +1163,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
>  	uint16_t client_id = get_client_id_from_client(cli);
>  	unsigned long zv_mean_zsize;
>  	unsigned long curr_pers_pampd_count;
> +	u64 total_zsize;
>  
>  	if (eph) {
>  		ret = zcache_compress(page, &cdata, &clen);
> @@ -1194,8 +1196,9 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
>  		}
>  		/* reject if mean compression is too poor */
>  		if ((clen > zv_max_mean_zsize) && (curr_pers_pampd_count > 0)) {
> -			zv_mean_zsize = xv_get_total_size_bytes(cli->xvpool) /
> -						curr_pers_pampd_count;
> +			total_zsize = xv_get_total_size_bytes(cli->xvpool);
> +			zv_mean_zsize = div_u64(total_zsize,
> +						curr_pers_pampd_count);
>  			if (zv_mean_zsize > zv_max_mean_zsize) {
>  				zcache_mean_compress_poor++;
>  				goto out;
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2011-08-04 22:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04  4:58 linux-next: Tree for Aug 4 Stephen Rothwell
2011-08-04 21:24 ` linux-next: Tree for Aug 4 (zcache) Randy Dunlap
2011-08-04 21:44   ` Greg KH
2011-08-04 21:51     ` Randy Dunlap
2011-08-04 21:54       ` Thadeu Lima de Souza Cascardo
2011-08-04 21:54         ` Thadeu Lima de Souza Cascardo
2011-08-04 22:00       ` [PATCH] zcache: Use div_u64 for 64-bit division Thadeu Lima de Souza Cascardo
2011-08-04 22:17         ` Randy Dunlap [this message]
2011-08-04 22:22 ` [PATCH -next] drivers/base/inode.c: let vmstat_text be optional Randy Dunlap
2011-08-04 22:22   ` Randy Dunlap
2011-08-05  2:38   ` Cong Wang
2011-08-05  2:38     ` Cong Wang
2011-08-05  2:38     ` Cong Wang
2011-08-05  5:43     ` Randy Dunlap
2011-08-05  5:43       ` Randy Dunlap
2011-08-05  8:02       ` Cong Wang
2011-08-05  8:02         ` Cong Wang
2011-08-05  8:02         ` Cong Wang
2011-08-23 21:39   ` Andrew Morton
2011-08-23 21:39     ` Andrew Morton
2011-08-24  3:34     ` [Patch] numa: introduce CONFIG_NUMA_SYSFS for drivers/base/node.c Cong Wang
2011-08-25  2:14       ` Randy Dunlap
2011-08-25  2:14         ` Randy Dunlap
2011-08-25  3:31         ` Cong Wang
2011-08-25  3:31           ` Cong Wang
2011-08-25  3:50           ` Randy Dunlap
2011-08-25  3:50             ` Randy Dunlap
2011-08-25  5:04             ` David Rientjes
2011-08-25  5:04               ` David Rientjes
2011-08-25 10:22               ` Cong Wang
2011-08-25 10:22                 ` Cong Wang
2011-08-25 10:22                 ` Cong Wang
2011-08-25 20:57                 ` David Rientjes
2011-08-25 20:57                   ` David Rientjes
2011-08-29  2:29                   ` Cong Wang
2011-08-29  2:29                     ` Cong Wang
2011-08-29  2:29                     ` Cong Wang
2011-08-25  5:55           ` [patch] numa: fix NUMA compile error when sysfs and procfs are disabled David Rientjes
2011-08-25  5:55             ` David Rientjes
2011-08-25 17:17             ` Randy Dunlap
2011-08-25 17:17               ` Randy Dunlap

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=20110804151707.ccb67e28.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=cascardo@holoscopio.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.