提交 e80ee884 编写于 作者: N Nick Piggin 提交者: Linus Torvalds

[PATCH] mm: micro optimise zone_watermark_ok

Having min be a signed quantity means gcc can't turn high latency divides
into shifts.  There happen to be two such divides for GFP_ATOMIC (ie.
networking, ie.  important) allocations, one of which depends on the other.
 Fixing this makes code smaller as a bonus.

Shame on somebody (probably me).
Signed-off-by: NNick Piggin <npiggin@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b2abacf3
...@@ -900,7 +900,8 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, ...@@ -900,7 +900,8 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
int classzone_idx, int alloc_flags) int classzone_idx, int alloc_flags)
{ {
/* free_pages my go negative - that's OK */ /* free_pages my go negative - that's OK */
long min = mark, free_pages = z->free_pages - (1 << order) + 1; unsigned long min = mark;
long free_pages = z->free_pages - (1 << order) + 1;
int o; int o;
if (alloc_flags & ALLOC_HIGH) if (alloc_flags & ALLOC_HIGH)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册