Skip to content

mm: lru related cleanups

Yu Zhao linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 14 repliesIn review 7 of 10 applied
  2. v111 patches 15 repliesSuperseded

Changes in v2 from the cover letter

dropped the last patch in this series based on the discussion here:
https://lore.kernel.org/patchwork/patch/1350552/#1550430

Patches in v2 7 of 10 applied

#Subject and filesSizeRepliesApplied
1/10mm: use add_page_to_lru_list()mm/vmscan.c+1 -52 repliesApplied
2/10mm: shuffle lru list addition and deletion functionsinclude/linux/mm_inline.h+21 -212 repliesApplied
3/10mm: don't pass "enum lru_list" to lru list addition functionsinclude/linux/mm_inline.h mm/swap.c mm/vmscan.c+15 -1410 replies
4/10mm: don't pass "enum lru_list" to trace_mm_lru_insertion()include/trace/events/pagemap.h mm/swap.c+5 -110 replies
5/10mm: don't pass "enum lru_list" to del_page_from_lru_list()include/linux/mm_inline.h mm/compaction.c mm/mlock.c +2 more+17 -230 replies
6/10mm: add __clear_page_lru_flags() to replace page_off_lru()include/linux/mm_inline.h mm/swap.c mm/vmscan.c+13 -240 repliesApplied
7/10mm: VM_BUG_ON lru page flagsinclude/linux/mm_inline.h mm/swap.c mm/vmscan.c+4 -30 repliesApplied
8/10mm: fold page_lru_base_type() into its sole callerinclude/linux/mm_inline.h+6 -210 repliesApplied
9/10mm: fold __update_lru_size() into its sole callerinclude/linux/mm_inline.h+1 -80 repliesApplied
10/10mm: make lruvec_lru_size() staticinclude/linux/mmzone.h mm/vmscan.c+2 -324 repliesApplied

Reviews trailers per patch

6 of 10 patches have a Reviewed-by or Acked-by.

PatchAlex ShiVlastimil BabkaMiaohe Lin
1/10R-b A-b R-b
2/10A-b R-b
3/10
4/10R-b
5/10
6/10
7/10
8/10R-b
9/10R-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/10] mm: lru related cleanups

The cleanups are intended to reduce the verbosity in lru list operations and make them less error-prone. A typical example would be how the patches change __activate_page():

static void __activate_page(struct page *page, struct lruvec *lruvec) {
if (!PageActive(page) && !PageUnevictable(page)) {
- int lru = page_lru_base_type(page);
int nr_pages = thp_nr_pages(page);

- del_page_from_lru_list(page, lruvec, lru);
+ del_page_from_lru_list(page, lruvec);
SetPageActive(page);
- lru += LRU_ACTIVE;
- add_page_to_lru_list(page, lruvec, lru);
+ add_page_to_lru_list(page, lruvec);
trace_mm_lru_activate(page);

There are a few more places like __activate_page() and they are unnecessarily repetitive in terms of figuring out which list a page should be added onto or deleted from. And with the duplicated code removed, they are easier to read, IMO.

Patch 1 to 5 basically cover the above. Patch 6 and 7 make code more robust by improving bug reporting. Patch 8, 9 and 10 take care of some dangling helpers left in header files.

v1 -> v2:
dropped the last patch in this series based on the discussion here:
https://lore.kernel.org/patchwork/patch/1350552/#1550430

Yu Zhao (10):
mm: use add_page_to_lru_list()
mm: shuffle lru list addition and deletion functions
mm: don't pass "enum lru_list" to lru list addition functions
mm: don't pass "enum lru_list" to trace_mm_lru_insertion()
mm: don't pass "enum lru_list" to del_page_from_lru_list()
mm: add __clear_page_lru_flags() to replace page_off_lru()
mm: VM_BUG_ON lru page flags
mm: fold page_lru_base_type() into its sole caller
mm: fold __update_lru_size() into its sole caller
mm: make lruvec_lru_size() static

 include/linux/mm_inline.h      | 113 ++++++++++++++-------------------
 include/linux/mmzone.h         |   2 -
 include/trace/events/pagemap.h |  11 ++--
 mm/compaction.c                |   2 +-
 mm/mlock.c                     |   3 +-
 mm/swap.c                      |  50 ++++++---------
 mm/vmscan.c                    |  21 ++----
 7 files changed, 77 insertions(+), 125 deletions(-)
Signature · 1 line
2.30.0.280.ga3ce27912f-goog