Re: [PATCH] memcg: use do_div to divide s64 in 32 bit machine.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Minchan Kim <minchan.kim@xxxxxxxxx> writes:

> Use do_div to divide s64 value. Otherwise, build would be failed
> like Dave Young reported.
>
> mm/built-in.o: In function `mem_cgroup_dirty_info':
> /home/dave/vdb/build/mm/linux-2.6.36/mm/memcontrol.c:1251: undefined
> reference to `__divdi3'
> /home/dave/vdb/build/mm/linux-2.6.36/mm/memcontrol.c:1259: undefined
> reference to `__divdi3'
> make: *** [.tmp_vmlinux1] Error 1
>
> Tested-by: Dave Young <hidave.darkstar@xxxxxxxxx>
> Signed-off-by: Minchan Kim <minchan.kim@xxxxxxxxx>
Tested-by: Greg Thelen <gthelen@xxxxxxxxxx>

Thanks for report and the patch.

> ---
>  mm/memcontrol.c |   16 +++++++++-------
>  1 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 76386f4..a15d95e 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1247,18 +1247,20 @@ bool mem_cgroup_dirty_info(unsigned long sys_available_mem,
>  	if (dirty_param.dirty_bytes)
>  		info->dirty_thresh =
>  			DIV_ROUND_UP(dirty_param.dirty_bytes, PAGE_SIZE);
> -	else
> -		info->dirty_thresh =
> -			(dirty_param.dirty_ratio * available_mem) / 100;
> +	else {
> +		info->dirty_thresh = dirty_param.dirty_ratio * available_mem;
> +		do_div(info->dirty_thresh, 100);
> +	}
>  
>  	if (dirty_param.dirty_background_bytes)
>  		info->background_thresh =
>  			DIV_ROUND_UP(dirty_param.dirty_background_bytes,
>  				     PAGE_SIZE);
> -	else
> -		info->background_thresh =
> -			(dirty_param.dirty_background_ratio *
> -			       available_mem) / 100;
> +	else {
> +		info->background_thresh = dirty_param.dirty_background_ratio *
> +			available_mem;
> +		do_div(info->background_thresh, 100);
> +	}
>  
>  	info->nr_reclaimable =
>  		mem_cgroup_page_stat(MEMCG_NR_RECLAIM_PAGES);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]