linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value
@ 2016-09-21  4:27 zijun_hu
  2016-09-21 21:21 ` David Rientjes
  0 siblings, 1 reply; 10+ messages in thread
From: zijun_hu @ 2016-09-21  4:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, zijun_hu, tj, mingo, rientjes,
	iamjoonsoo.kim, mgorman

From: zijun_hu <zijun_hu@htc.com>

correct lazy_max_pages() return value if the number of online
CPUs is power of 2

Signed-off-by: zijun_hu <zijun_hu@htc.com>
---
 mm/vmalloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index a125ae8..2804224 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -594,7 +594,9 @@ static unsigned long lazy_max_pages(void)
 {
 	unsigned int log;
 
-	log = fls(num_online_cpus());
+	log = num_online_cpus();
+	if (log > 1)
+		log = (unsigned int)get_count_order(log);
 
 	return log * (32UL * 1024 * 1024 / PAGE_SIZE);
 }
-- 
1.9.1

--
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>

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

end of thread, other threads:[~2016-09-23  7:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-21  4:27 [PATCH 3/5] mm/vmalloc.c: correct lazy_max_pages() return value zijun_hu
2016-09-21 21:21 ` David Rientjes
2016-09-21 23:30   ` zijun_hu
2016-09-22  0:35     ` David Rientjes
2016-09-22  1:13       ` zijun_hu
2016-09-22 12:37         ` Michal Hocko
2016-09-22 16:30           ` zijun_hu
2016-09-23  3:30             ` Nicholas Piggin
2016-09-23  5:00               ` zijun_hu
2016-09-23  7:27                 ` Nicholas Piggin

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).