diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2014-08-06 19:05:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-06 21:01:16 -0400 |
commit | 7be12fc9f8dcae7f4c9647d495bd64fc4ffb6836 (patch) | |
tree | 0a70ae16ee1b68e4187da2471793a78a8cf6320b /mm/page_alloc.c | |
parent | 4f7c6b49c45a398d72763d1f0e64ddff8b3653c7 (diff) |
mm: page_alloc: simplify drain_zone_pages by using min()
Instead of open-coding getting minimal value of two, just use min macro.
That is why it is there for. While changing the function also change
type of batch local variable to match type of per_cpu_pages::batch
(which is int).
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8c4f1b220ab9..c1c6cb78e5ca 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1257,15 +1257,11 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, | |||
1257 | void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) | 1257 | void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) |
1258 | { | 1258 | { |
1259 | unsigned long flags; | 1259 | unsigned long flags; |
1260 | int to_drain; | 1260 | int to_drain, batch; |
1261 | unsigned long batch; | ||
1262 | 1261 | ||
1263 | local_irq_save(flags); | 1262 | local_irq_save(flags); |
1264 | batch = ACCESS_ONCE(pcp->batch); | 1263 | batch = ACCESS_ONCE(pcp->batch); |
1265 | if (pcp->count >= batch) | 1264 | to_drain = min(pcp->count, batch); |
1266 | to_drain = batch; | ||
1267 | else | ||
1268 | to_drain = pcp->count; | ||
1269 | if (to_drain > 0) { | 1265 | if (to_drain > 0) { |
1270 | free_pcppages_bulk(zone, to_drain, pcp); | 1266 | free_pcppages_bulk(zone, to_drain, pcp); |
1271 | pcp->count -= to_drain; | 1267 | pcp->count -= to_drain; |