linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcg: use do_div to divide s64 in 32 bit machine.
@ 2010-11-05 16:08 Minchan Kim
  2010-11-05 16:34 ` Greg Thelen
  2010-11-06  1:03 ` hannes
  0 siblings, 2 replies; 31+ messages in thread
From: Minchan Kim @ 2010-11-05 16:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Dave Young, Greg Thelen, Andrea Righi, KAMEZAWA Hiroyuki,
	Daisuke Nishimura, Balbir Singh, Wu Fengguang,
	Linux Kernel Mailing List, linux-mm, Minchan Kim

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@gmail.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
 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);
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2010-11-16  3:49 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-05 16:08 [PATCH] memcg: use do_div to divide s64 in 32 bit machine Minchan Kim
2010-11-05 16:34 ` Greg Thelen
2010-11-06  1:03 ` hannes
2010-11-06 17:19   ` Greg Thelen
2010-11-06 17:31     ` Minchan Kim
2010-11-07 22:14     ` [patch 0/4] memcg: variable type fixes Johannes Weiner
2010-11-07 22:14     ` [patch 1/4] memcg: use native word to represent dirtyable pages Johannes Weiner
2010-11-07 22:56       ` Minchan Kim
2010-11-08 22:25         ` Greg Thelen
2010-11-08 22:38           ` Johannes Weiner
2010-11-08 22:43             ` Greg Thelen
2010-11-16  3:37       ` KAMEZAWA Hiroyuki
2010-11-07 22:14     ` [patch 2/4] memcg: catch negative per-cpu sums in dirty info Johannes Weiner
2010-11-07 23:26       ` Minchan Kim
2010-11-08 22:28         ` Greg Thelen
2010-11-16  3:39       ` KAMEZAWA Hiroyuki
2010-11-07 22:14     ` [patch 3/4] memcg: break out event counters from other stats Johannes Weiner
2010-11-07 23:52       ` Minchan Kim
2010-11-08 23:20         ` Greg Thelen
2010-11-16  3:41       ` KAMEZAWA Hiroyuki
2010-11-07 22:14     ` [patch 4/4] memcg: use native word page statistics counters Johannes Weiner
2010-11-08  0:01       ` Minchan Kim
2010-11-08  9:08         ` Johannes Weiner
2010-11-08 22:51         ` Greg Thelen
2010-11-08  0:07       ` Minchan Kim
2010-11-08  9:37         ` memcg writeout throttling, was: " Johannes Weiner
2010-11-08 15:45           ` Wu Fengguang
2010-11-08 19:00             ` Greg Thelen
2010-11-08 23:27       ` Greg Thelen
2010-11-08 23:45         ` Johannes Weiner
2010-11-16  3:44       ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).