Skip to content

mm/swap: remove boilerplate

Yu Zhao linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesIn review 4 of 5 applied

Patches in v1 4 of 5 applied

#Subject and filesSizeRepliesApplied
1/5mm/swap: reduce indentation levelmm/swap.c+109 -1000 repliesApplied
2/5mm/swap: rename cpu_fbatches->activatemm/swap.c+9 -90 repliesApplied
3/5mm/swap: fold lru_rotate into cpu_fbatchesmm/swap.c+16 -200 repliesApplied
4/5mm/swap: remove remaining _fn suffixmm/swap.c+15 -150 repliesApplied
5/5mm/swap: remove boilerplatemm/swap.c+37 -706 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH mm-unstable v1 0/5] mm/swap: remove boilerplate

Use folio_activate() as an example:

Before this series
------------------

    if (!folio_test_active(folio) && !folio_test_unevictable(folio)) {
      struct folio_batch *fbatch;

      folio_get(folio);
      if (!folio_test_clear_lru(folio)) {
        folio_put(folio);
        return;
      }

      local_lock(&cpu_fbatches.lock);
      fbatch = this_cpu_ptr(&cpu_fbatches.activate);
      folio_batch_add_and_move(fbatch, folio, folio_activate_fn);
      local_unlock(&cpu_fbatches.lock);
    }

}

After this series
-----------------
void folio_activate(struct folio *folio)

  {
    if (folio_test_active(folio) || folio_test_unevictable(folio))
      return;
  
    folio_batch_add_and_move(folio, lru_activate, true);

}

And this is applied to all 6 folio_batch handlers in mm/swap.c.

bloat-o-meter
-------------
add/remove: 12/13 grow/shrink: 3/2 up/down: 4653/-4721 (-68)
...
Total: Before=28083019, After=28082951, chg -0.00%

Yu Zhao (5):
mm/swap: reduce indentation level
mm/swap: rename cpu_fbatches->activate
mm/swap: fold lru_rotate into cpu_fbatches
mm/swap: remove remaining _fn suffix
mm/swap: remove boilerplate

 mm/swap.c | 296 ++++++++++++++++++++++++------------------------------
 1 file changed, 134 insertions(+), 162 deletions(-)
Signature · 1 line
2.45.2.803.g4e1b14247a-goog