Skip to content

Commit

Permalink
mm: compaction: remove unnecessary is_via_compact_memory() checks
Browse files Browse the repository at this point in the history
Remove from all paths not reachable via /proc/sys/vm/compact_memory.

Signed-off-by: Johannes Weiner <[email protected]>
  • Loading branch information
hnaz committed Mar 9, 2023
1 parent 124a390 commit c8b38a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
11 changes: 1 addition & 10 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -2265,9 +2265,6 @@ bool compaction_zonelist_suitable(struct alloc_context *ac, int order,
unsigned long available;
unsigned long watermark;

if (is_via_compact_memory(order))
return true;

/* Allocation can already succeed, nothing to do */
watermark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
if (zone_watermark_ok(zone, order, watermark,
Expand Down Expand Up @@ -2812,9 +2809,6 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat)
if (!populated_zone(zone))
continue;

if (is_via_compact_memory(pgdat->kcompactd_max_order))
return true;

/* Allocation can already succeed, check other zones */
if (zone_watermark_ok(zone, pgdat->kcompactd_max_order,
min_wmark_pages(zone),
Expand Down Expand Up @@ -2859,9 +2853,6 @@ static void kcompactd_do_work(pg_data_t *pgdat)
if (compaction_deferred(zone, cc.order))
continue;

if (is_via_compact_memory(cc.order))
goto compact;

/* Allocation can already succeed, nothing to do */
if (zone_watermark_ok(zone, cc.order,
min_wmark_pages(zone), zoneid, 0))
Expand All @@ -2870,7 +2861,7 @@ static void kcompactd_do_work(pg_data_t *pgdat)
if (compaction_suitable(zone, cc.order,
zoneid) != COMPACT_CONTINUE)
continue;
compact:

if (kthread_should_stop())
return;

Expand Down
8 changes: 1 addition & 7 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -6076,9 +6076,6 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat,
if (!managed_zone(zone))
continue;

if (sc->order == -1) /* is_via_compact_memory() */
return false;

/* Allocation can already succeed, nothing to do */
if (zone_watermark_ok(zone, sc->order, min_wmark_pages(zone),
sc->reclaim_idx, 0))
Expand Down Expand Up @@ -6275,9 +6272,6 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc)
unsigned long watermark;
unsigned long free_pages;

if (sc->order == -1) /* is_via_compact_memory() */
goto suitable;

/* Allocation can already succeed, nothing to do */
if (zone_watermark_ok(zone, sc->order, min_wmark_pages(zone),
sc->reclaim_idx, 0))
Expand All @@ -6287,7 +6281,7 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc)
if (compaction_suitable(zone, sc->order,
sc->reclaim_idx) == COMPACT_SKIPPED)
return false;
suitable:

/*
* Compaction is already possible, but it takes time to run and there
* are potentially other callers using the pages just freed. So proceed
Expand Down

0 comments on commit c8b38a7

Please sign in to comment.