Skip to content

Commit

Permalink
mm/compaction: cleanup on compaction_deferred
Browse files Browse the repository at this point in the history
When CONFIG_COMPACTION is enabled, compaction_deferred() tries to
recalculate the deferred limit again, which isn't necessary.

When CONFIG_COMPACTION is disabled, compaction_deferred() should return
"true" or "false" since it has "bool" for its return value.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
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>
  • Loading branch information
Gavin Shan authored and Linus Torvalds committed Aug 1, 2012
1 parent 3c935d1 commit c59e261
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/compaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static inline bool compaction_deferred(struct zone *zone, int order)
if (++zone->compact_considered > defer_limit)
zone->compact_considered = defer_limit;

return zone->compact_considered < (1UL << zone->compact_defer_shift);
return zone->compact_considered < defer_limit;
}

#else
Expand All @@ -85,7 +85,7 @@ static inline void defer_compaction(struct zone *zone, int order)

static inline bool compaction_deferred(struct zone *zone, int order)
{
return 1;
return true;
}

#endif /* CONFIG_COMPACTION */
Expand Down

0 comments on commit c59e261

Please sign in to comment.