Skip to content

Commit

Permalink
mm: setup_per_zone_inactive_ratio - do not call for int_sqrt if not n…
Browse files Browse the repository at this point in the history
…eeded

int_sqrt() returns 0 if its argument is zero so call it if only needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Cyrill Gorcunov authored and Linus Torvalds committed Jun 17, 2009
1 parent af16677 commit 5c87ead
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4471,8 +4471,9 @@ static void setup_per_zone_inactive_ratio(void)

/* Zone size in gigabytes */
gb = zone->present_pages >> (30 - PAGE_SHIFT);
ratio = int_sqrt(10 * gb);
if (!ratio)
if (gb)
ratio = int_sqrt(10 * gb);
else
ratio = 1;

zone->inactive_ratio = ratio;
Expand Down

0 comments on commit 5c87ead

Please sign in to comment.