804114 Commits

Author SHA1 Message Date
Yu Zhao
fed98f389b
BACKPORT: include/linux/mm_inline.h: shuffle lru list addition and deletion functions
These functions will call page_lru() in the following patches.  Move them
below page_lru() to avoid the forward declaration.

Link: https://lore.kernel.org/linux-mm/20201207220949.830352-3-yuzhao@google.com/
Link: https://lkml.kernel.org/r/20210122220600.906146-3-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit f90d8191ac864df33b1898bc7edc54eaa24e22bc)
Bug: 228114874
Change-Id: I32b8565107c9134e656b43886c00105eb07b34dd
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:15:22 +00:00
Yu Zhao
ef2bf9d2b6
BACKPORT: mm/vmscan.c: use add_page_to_lru_list()
Patch series "mm: lru related cleanups", v2.

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.

This patch (of 10):

There is add_page_to_lru_list(), and move_pages_to_lru() should reuse it,
not duplicate it.

Link: https://lkml.kernel.org/r/20210122220600.906146-1-yuzhao@google.com
Link: https://lore.kernel.org/linux-mm/20201207220949.830352-2-yuzhao@google.com/
Link: https://lkml.kernel.org/r/20210122220600.906146-2-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Reviewed-by: Alex Shi <alex.shi@linux.alibaba.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Roman Gushchin <guro@fb.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 42895ea73bcd37c4a79e4c9f681ab8b82243c7f7)
Bug: 228114874
Change-Id: I7e09be6bedcd451c4e8c790c969306b6ca3adebd
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:15:22 +00:00
Yu Zhao
cd9efd8380
BACKPORT: mm: use self-explanatory macros rather than "2"
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alex Shi <alex.shi@linux.alibaba.com>
Link: http://lkml.kernel.org/r/20200831175042.3527153-2-yuzhao@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ed0173733dd468883198c3136284394320b8fad6)
Bug: 228114874
Change-Id: Ifbc0e8976a29d914ade5a84a8a1fff069cb2d3bb
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:15:20 +00:00
Yu Zhao
83d218260d
BACKPORT: mm: remove superfluous __ClearPageActive()
To activate a page, mark_page_accessed() always holds a reference on it.
It either gets a new reference when adding a page to
lru_pvecs.activate_page or reuses an existing one it previously got when
it added a page to lru_pvecs.lru_add.  So it doesn't call SetPageActive()
on a page that doesn't have any reference left.  Therefore, the race is
impossible these days (I didn't brother to dig into its history).

For other paths, namely reclaim and migration, a reference count is always
held while calling SetPageActive() on a page.

SetPageSlabPfmemalloc() also uses SetPageActive(), but it's irrelevant to
LRU pages.

Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Qian Cai <cai@lca.pw>
Link: http://lkml.kernel.org/r/20200818184704.3625199-2-yuzhao@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 6f4dd8de4835563de9bae797ce1d7a13465a7a7d)
Bug: 228114874
Change-Id: Ie432a8580024926fe9d0fa18eeb5a31b23593b21
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:14:41 +00:00
Joonsoo Kim
367332e909
BACKPORT: mm/swapcache: support to handle the shadow entries
Workingset detection for anonymous page will be implemented in the
following patch and it requires to store the shadow entries into the
swapcache.  This patch implements an infrastructure to store the shadow
entry in the swapcache.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: http://lkml.kernel.org/r/1595490560-15117-5-git-send-email-iamjoonsoo.kim@lge.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 3852f6768ede542ed48b9077bedf482c7ecb6327)
Bug: 228114874
Signed-off-by: Yu Zhao <yuzhao@google.org>
Change-Id: Ie95a3e7ef0bd487746bfdb08e279c3f7ab5ca17a
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:14:41 +00:00
Wei Yang
1163615c6d
UPSTREAM: mm/vmscan.c: use update_lru_size() in update_lru_sizes()
We already defined the helper update_lru_size().

Let's use this to reduce code duplication.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Link: http://lkml.kernel.org/r/20200331221550.1011-1-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit a892cb6b977ffe209683809e5e9d627656d20aa8)
Bug: 228114874
Signed-off-by: Yu Zhao <yuzhao@google.org>
Change-Id: I7f0b264466a00539302476b56ac9759d26f7de50
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:14:41 +00:00
Jia He
16bde28931
UPSTREAM: arm64: cpufeature: introduce helper cpu_has_hw_af()
We unconditionally set the HW_AFDBM capability and only enable it on
CPUs which really have the feature. But sometimes we need to know
whether this cpu has the capability of HW AF. So decouple AF from
DBM by a new helper cpu_has_hw_af().

If later we noticed a potential performance issue on this path, we can
turn it into a static label as with other CPU features.

Signed-off-by: Jia He <justin.he@arm.com>
Suggested-by: Suzuki Poulose <Suzuki.Poulose@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 47d7b15b88f96a90694cfc607d0717d62dff6c45)
Bug: 228114874
Signed-off-by: Yu Zhao <yuzhao@google.org>
Change-Id: Ie0c4482c4cc0d23d75ed22bfaedb7e32a448f293
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:14:41 +00:00
Yu Zhao
1a86bed8d9
UPSTREAM: mm: replace list_move_tail() with add_page_to_lru_list_tail()
This is a cleanup patch that replaces two historical uses of
list_move_tail() with relatively recent add_page_to_lru_list_tail().

Link: http://lkml.kernel.org/r/20190716212436.7137-1-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit e7a1aaf28770c1f7a06c50cbd02ca0f27ce61ec5)
Bug: 228114874
Change-Id: I47d474271dfb5fdcc28e062b1db86ecbccbf85d0
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-01 09:14:41 +00:00
azrim
c5bdec1129
Revert "mm: only drain per-cpu pagevecs once per pagevec usage"
This reverts commit 8fbf24ee0ee3486e8985c4b963c2bc83c9e74d1c.
2022-07-01 09:13:43 +00:00
azrim
2c5929ae4f
Revert "mm, pagevec: remove cold parameter for pagevecs"
This reverts commit 9443cf7bcca4bd5a56a070fd422710e3438db00c.
2022-07-01 09:13:34 +00:00
azrim
aa4e942d07
Revert "mm, pagevec: rename pagevec drained field"
This reverts commit b698bab3fb23bbc51f113883f9c62cd3b8838342.
2022-07-01 09:13:21 +00:00
azrim
57dc933b43
Revert "mm: get 7% more pages in a pagevec"
This reverts commit 215918c2f11f9278835a0e3de46e8752ed4bc7c9.
2022-07-01 09:13:10 +00:00
azrim
9cf99304e0
Revert "mm: Remove process reclaim"
This reverts commit dc764e5ee6beea09484106bef29c37fdc1f64503.
2022-07-01 09:11:34 +00:00
azrim
860035e0e4
Revert "mm: per-process reclaim"
This reverts commit 72220ad54da1487e95ed99d469702c6975d12b24.
2022-07-01 09:11:23 +00:00
azrim
e3b4c2139d
Revert "mm: perproc-reclaim: do not discarding file-backed pages"
This reverts commit feff085d5c3fa2dcf736c5ba1cd331ad9eadabe0.
2022-07-01 09:10:49 +00:00
azrim
6f09eb3c14
Revert "mm: perproc-reclaim: do not scanning anonymous vma"
This reverts commit a9b4957653fcc867fe9fd6358e03302d44f90c23.
2022-07-01 09:10:29 +00:00
azrim
da73461511
Revert "mm: abort per-process reclaim"
This reverts commit 6e6e36e8ce2e2c5e16c41bab390cc42ff19b6f1c.
2022-07-01 09:10:19 +00:00
azrim
e0c33343a9
Revert "BACKPORT: page_alloc: consider highatomic reserve in watermark fast"
This reverts commit 9ad9dbeb3574ad797b2e7c47ba6b3c76683b034a.
2022-07-01 09:08:29 +00:00
azrim
2128a9554a
Revert "mm, compaction: raise compaction priority after it withdrawns"
This reverts commit 1ce0e3166160dec7c4d567cd9baa029013ed00af.
2022-07-01 09:08:17 +00:00
azrim
8f12c9736e
Revert "mm: reclaim more pages to find free pages in compaction"
This reverts commit 6e93bc3e86387c2a88e5e02a4f8347d91ce0a36c.
2022-07-01 09:08:06 +00:00
azrim
b1a539daf7
Revert "mm: introduce deactivate_page"
This reverts commit be7a87c7d612a71e12267def1761091d2817d476.
2022-07-01 09:07:54 +00:00
azrim
8aa10e2cc5
Revert "UPSTREAM: mm: replace list_move_tail() with add_page_to_lru_list_tail()"
This reverts commit 0488665840f7851a937dedef051cc5bc1a6cf3bd.
2022-07-01 09:06:22 +00:00
azrim
3c0b4163fb
Revert "UPSTREAM: mm/vmscan.c: use update_lru_size() in update_lru_sizes()"
This reverts commit e0d2cd6fde5bc14d0a87c3ee5ddfc50803d370f3.
2022-07-01 09:06:12 +00:00
azrim
6bcfe1bf37
Revert "BACKPORT: mm: remove superfluous __ClearPageActive()"
This reverts commit 4c40b566cb5c48f4b9b17f29aba5044638a5f1d6.
2022-07-01 09:06:04 +00:00
azrim
c563deafe9
Revert "BACKPORT: mm: use self-explanatory macros rather than "2""
This reverts commit c874a42b903651f8a0900637148db90d42617034.
2022-07-01 09:05:54 +00:00
azrim
609b12093a
Revert "BACKPORT: mm/vmscan.c: use add_page_to_lru_list()"
This reverts commit c59c1de05c3abad2a85cfe783b3512e3aa1d35fb.
2022-07-01 09:05:33 +00:00
azrim
d81afe5f50
Revert "BACKPORT: include/linux/mm_inline.h: shuffle lru list addition and deletion functions"
This reverts commit d4e55f69635889f2b55ad92018d97134f463a67a.
2022-07-01 09:05:18 +00:00
azrim
f4d0b65ee5
Revert "BACKPORT: mm: don't pass "enum lru_list" to lru list addition functions"
This reverts commit a982a833bcfd9fabb38906b045d848aab2625be8.
2022-07-01 09:05:02 +00:00
azrim
3d4078ef6e
Revert "BACKPORT: mm/swap.c: don't pass "enum lru_list" to trace_mm_lru_insertion()"
This reverts commit 78733943f9a599c0319b780e1f7aeace700b58f8.
2022-07-01 09:04:50 +00:00
azrim
acf071c96b
Revert "BACKPORT: mm/swap.c: don't pass "enum lru_list" to del_page_from_lru_list()"
This reverts commit ab4b57fe4682a6246055e00f8dca5b90ea37dce0.
2022-07-01 09:04:09 +00:00
azrim
7f3803b3bd
Revert "BACKPORT: mm: add __clear_page_lru_flags() to replace page_off_lru()"
This reverts commit a68a203906589bee95afbf10c1b386bf76d612e2.
2022-07-01 09:03:57 +00:00
azrim
cba9062e83
Revert "UPSTREAM: mm: VM_BUG_ON lru page flags"
This reverts commit aae8c5a11011f8c54b0a58b536ad1361fc65d3ad.
2022-07-01 09:03:44 +00:00
azrim
5eb6024425
Revert "BACKPORT: include/linux/mm_inline.h: fold page_lru_base_type() into its sole caller"
This reverts commit 2571d9cfe164f6f31183dee27b24f8fe0c78a1d6.
2022-07-01 09:02:52 +00:00
azrim
58128f6499
Revert "UPSTREAM: include/linux/mm_inline.h: fold __update_lru_size() into its sole caller"
This reverts commit 095bbffc9e0db6fe536d509cd049e6ce6fd1bf7b.
2022-07-01 09:02:38 +00:00
azrim
2b480a1324
Revert "BACKPORT: mm/swapcache: support to handle the shadow entries"
This reverts commit ba5735bbdc8e461b1120424b2ffdce532f284e50.
2022-07-01 09:02:16 +00:00
azrim
571b7ad2f4
Revert "BACKPORT: FROMLIST: include/linux/mm.h: do not warn in page_memcg_rcu() if !CONFIG_MEMCG"
This reverts commit 831c8c52c2d2030a28c36dedba7632e4063346c7.
2022-07-01 09:02:03 +00:00
azrim
a392be83ab
Revert "FROMLIST: include/linux/nodemask.h: define next_memory_node() if !CONFIG_NUMA"
This reverts commit 3bd16485cc45da889bd338b5a9543e1c951e4e01.
2022-07-01 09:01:49 +00:00
azrim
8edc855af8
Revert "FROMLIST: include/linux/cgroup.h: export cgroup_mutex"
This reverts commit 983523c9e4158f3de23c6779270c9a2ecdf5ab0f.
2022-07-01 09:01:40 +00:00
azrim
9e39677245
Revert "BACKPORT: FROMLIST: mm, x86: support the access bit on non-leaf PMD entries"
This reverts commit 8ffd1a0994765f4062723ad1c50153feaed3d493.
2022-07-01 09:01:26 +00:00
azrim
96749960e6
Revert "BACKPORT: FROMLIST: mm/workingset.c: refactor pack_shadow() and unpack_shadow()"
This reverts commit a0b119972826ed2292a1c7d803f2a9ad745e8ff6.
2022-07-01 08:29:10 +00:00
azrim
57edc9ecb2
Revert "BACKPORT: FROMLIST: mm: multigenerational lru: groundwork"
This reverts commit c721ce1a3fffa3284aae195d5d6b09869f4a0411.
2022-07-01 08:29:02 +00:00
azrim
10addd7e22
Revert "BACKPORT: FROMLIST: mm: multigenerational lru: activation"
This reverts commit a1790dfaabf7be9da0ef1017c5346063603b95df.
2022-07-01 08:28:50 +00:00
azrim
56639afc94
Revert "BACKPORT: FROMLIST: mm: multigenerational lru: mm_struct list"
This reverts commit c629993da74fc72c35b79f813c71faea66f5ab63.
2022-07-01 08:28:42 +00:00
azrim
9dfc1faf40
Revert "BACKPORT: FROMLIST: mm: multigenerational lru: aging"
This reverts commit e881609e5e141c5d5f0af59969df0830b106cdc3.
2022-07-01 08:28:29 +00:00
azrim
1f8d8f23b9
Revert "BACKPORT: FROMLIST: mm: multigenerational lru: eviction"
This reverts commit 8560f8e0380c6232aa0e754888f8e186b897f0b4.
2022-07-01 08:28:20 +00:00
azrim
2d3c6f5a7e
Revert "BACKPORT: FROMLIST: mm: multigenerational lru: user interface"
This reverts commit 33b792640665b1d67c0e2114459f5f292540d24b.
2022-07-01 08:28:02 +00:00
azrim
20a79114d5
Revert "FROMLIST: mm: multigenerational lru: Kconfig"
This reverts commit 110e9f339eb08fb30791579d01089b80dd7ebf39.
2022-07-01 08:27:50 +00:00
azrim
f60c6e5b01
Revert "CHROMIUM: mm: multigenerational lru: scan kvm mmu pages"
This reverts commit 6609d555046f58a202b4bdd868c241385852f677.
2022-07-01 08:27:36 +00:00
azrim
5e7b250f8f
Revert "CHROMIUM: mm: multigenerational lru: add arch_has_hw_pte_young()"
This reverts commit 4b202024f242f911711c6bcb59c26b6f6e975964.
2022-07-01 08:27:20 +00:00
azrim
8a3ec6e207
Revert "FIXUP: CHROMIUM: mm: multigenerational lru: scan kvm mmu pages"
This reverts commit 712310fd0db3056acbb8ca16dc6a81174b9b830e.
2022-07-01 08:27:13 +00:00