All of lore.kernel.org
 help / color / mirror / Atom feed
* [failures] mm-vmscan-remove-unnecessary-lruvec-adding.patch removed from -mm tree
@ 2020-03-06  2:50 akpm
  2020-03-06  3:32 ` Qian Cai
  0 siblings, 1 reply; 14+ messages in thread
From: akpm @ 2020-03-06  2:50 UTC (permalink / raw)
  To: aarcange, alex.shi, daniel.m.jordan, hannes, hughd, khlebnikov,
	kirill, kravetz, mhocko, mm-commits, tj, vdavydov.dev, willy,
	yang.shi


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@linux.alibaba.com>
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@linux-foundation.org: coding style fixes]
Link: http://lkml.kernel.org/r/1583146830-169516-2-git-send-email-alex.shi@linux.alibaba.com
Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Yang Shi <yang.shi@linux.alibaba.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Kravetz <kravetz@us.ibm.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 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@linux.alibaba.com 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-03-07  3:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-06  2:50 [failures] mm-vmscan-remove-unnecessary-lruvec-adding.patch removed from -mm tree akpm
2020-03-06  3:32 ` Qian Cai
2020-03-06  3:38   ` Matthew Wilcox
2020-03-06  3:50     ` Qian Cai
2020-03-06  4:17       ` Hugh Dickins
2020-03-06  4:42         ` Alex Shi
2020-03-06  4:46           ` Qian Cai
2020-03-06 13:30         ` Alex Shi
2020-03-06 14:54         ` Johannes Weiner
2020-03-06  9:04   ` Alex Shi
2020-03-06 11:58     ` Alex Shi
2020-03-07  2:27       ` Qian Cai
2020-03-07  3:26         ` Alex Shi
2020-03-07  3:31           ` Qian Cai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.