The patch titled Subject: mm/vmscan: remove unnecessary lruvec adding has been removed from the -mm tree. Its filename was mm-vmscan-remove-unnecessary-lruvec-adding.patch This patch was dropped because it had testing failures ------------------------------------------------------ From: Alex Shi <alex.shi@xxxxxxxxxxxxxxxxx> Subject: mm/vmscan: remove unnecessary lruvec adding Patch series "per lruvec lru_lock for memcg", v9. A partial merge. The first 6 patches from a 20 patch series. Some code cleanups and minimal optimizations. This patch (of 6): We don't have to add a freeable page into lru and then remove from it. This change saves a couple of actions and makes the moving more clear. The SetPageLRU needs to be kept here for list intergrity. Otherwise: #0 mave_pages_to_lru #1 release_pages if (put_page_testzero()) if !put_page_testzero !PageLRU //skip lru_lock list_add(&page->lru,) list_add(&page->lru,) //corrupt [akpm@xxxxxxxxxxxxxxxxxxxx: coding style fixes] Link: http://lkml.kernel.org/r/1583146830-169516-2-git-send-email-alex.shi@xxxxxxxxxxxxxxxxx Signed-off-by: Alex Shi <alex.shi@xxxxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx> Cc: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx> Cc: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Mike Kravetz <kravetz@xxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) --- a/mm/vmscan.c~mm-vmscan-remove-unnecessary-lruvec-adding +++ a/mm/vmscan.c @@ -1838,26 +1838,29 @@ static unsigned noinline_for_stack move_ while (!list_empty(list)) { page = lru_to_page(list); VM_BUG_ON_PAGE(PageLRU(page), page); + list_del(&page->lru); if (unlikely(!page_evictable(page))) { - list_del(&page->lru); spin_unlock_irq(&pgdat->lru_lock); putback_lru_page(page); spin_lock_irq(&pgdat->lru_lock); continue; } - lruvec = mem_cgroup_page_lruvec(page, pgdat); + /* + * The SetPageLRU needs to be kept here for list intergrity. + * Otherwise: + * #0 mave_pages_to_lru #1 release_pages + * if (put_page_testzero()) + * if !put_page_testzero + * !PageLRU //skip lru_lock + * list_add(&page->lru,) + * list_add(&page->lru,) //corrupt + */ SetPageLRU(page); - lru = page_lru(page); - - nr_pages = hpage_nr_pages(page); - update_lru_size(lruvec, lru, page_zonenum(page), nr_pages); - list_move(&page->lru, &lruvec->lists[lru]); - if (put_page_testzero(page)) { + if (unlikely(put_page_testzero(page))) { __ClearPageLRU(page); __ClearPageActive(page); - del_page_from_lru_list(page, lruvec, lru); if (unlikely(PageCompound(page))) { spin_unlock_irq(&pgdat->lru_lock); @@ -1865,9 +1868,16 @@ static unsigned noinline_for_stack move_ spin_lock_irq(&pgdat->lru_lock); } else list_add(&page->lru, &pages_to_free); - } else { - nr_moved += nr_pages; + continue; } + + lruvec = mem_cgroup_page_lruvec(page, pgdat); + lru = page_lru(page); + nr_pages = hpage_nr_pages(page); + + update_lru_size(lruvec, lru, page_zonenum(page), nr_pages); + list_add(&page->lru, &lruvec->lists[lru]); + nr_moved += nr_pages; } /* _ Patches currently in -mm which might be from alex.shi@xxxxxxxxxxxxxxxxx are ocfs2-remove-fs_ocfs2_nm.patch ocfs2-remove-unused-macros.patch ocfs2-use-ocfs2_sec_bits-in-macro.patch ocfs2-remove-dlm_lock_is_remote.patch ocfs2-remove-useless-err.patch mm-memcg-fold-lock_page_lru-into-commit_charge.patch mm-page_idle-no-unlikely-double-check-for-idle-page-counting.patch mm-thp-move-lru_add_page_tail-func-to-huge_memoryc.patch mm-thp-clean-up-lru_add_page_tail.patch mm-thp-narrow-lru-locking.patch