Re: [PATCH v3 5/7] KVM: x86: Participate in bitmap-based PTE aging

2024-04-20 Thread Yu Zhao
On Fri, Apr 19, 2024 at 3:48 PM James Houghton wrote: > > On Fri, Apr 19, 2024 at 2:07 PM David Matlack wrote: > > > > On 2024-04-19 01:47 PM, James Houghton wrote: > > > On Thu, Apr 11, 2024 at 10:28 AM David Matlack > > > wrote: > > > > On 2024-04-11 10:08 AM, David Matlack wrote: > > > >

Re: [PATCH v3 6/7] KVM: arm64: Participate in bitmap-based PTE aging

2024-04-01 Thread Yu Zhao
kold == true, only age the pages that need aging according to the > passed-in bitmap. > > Suggested-by: Yu Zhao Thanks but I did not suggest this. What I have in v2 is RCU based. I hope Oliver or someone else can help make that work. Otherwise we can just drop this for now and revisit lat

Re: [PATCH -next v4 2/2] mm: vmscan: add new event to trace shrink lru

2023-12-20 Thread Yu Zhao
On Tue, Dec 19, 2023 at 6:22 PM Bixuan Cui wrote: > > From: cuibixuan > > Add a new event to calculate the shrink_inactive_list()/shrink_active_list() > execution time. > > Example of output: > kswapd0-103 [007] . 1098.353020: > mm_vmscan_lru_shrink_active_start: nid=0 >

Re: [PATCH 2/2] mm: multi-gen lru: fix stat count

2023-10-18 Thread Yu Zhao
On Wed, Oct 18, 2023 at 8:17 PM Huan Yang wrote: > > Hi Yu Zhao, > > Thanks for your reply. > > 在 2023/10/19 0:21, Yu Zhao 写道: > > On Wed, Oct 18, 2023 at 2:22 AM Huan Yang wrote: > >> For multi-gen lru reclaim in evict_folios, like shrink_inactive_list,

Re: [PATCH 1/2] tracing: mm: multigen-lru: fix mglru trace

2023-10-18 Thread Yu Zhao
On Wed, Oct 18, 2023 at 2:22 AM Huan Yang wrote: > > This patch add two reclaim stat: > nr_promote: nr_pages shrink before promote by folio_update_gen. > nr_demote: nr_pages NUMA demotion passed. The above isn't specific to MLGRU, so they should be in a separate patchset. > And then, use

Re: [PATCH 2/2] mm: multi-gen lru: fix stat count

2023-10-18 Thread Yu Zhao
On Wed, Oct 18, 2023 at 2:22 AM Huan Yang wrote: > > For multi-gen lru reclaim in evict_folios, like shrink_inactive_list, > gather folios which isolate to reclaim, and invoke shirnk_folio_list. > > But, when complete shrink, it not gather shrink reclaim stat into sc, > we can't get info like

Re: [PATCH v4] vmscan: add trace events for lru_gen

2023-10-01 Thread Yu Zhao
On Sun, Oct 1, 2023 at 5:41 PM Jaewon Kim wrote: > > Hello Yu Zhao > > Could you give me your comment? I am waiting for your opinion on the > reuse method. I'm planning to resend it as a complete patch with it. > Thank you. Acked-by: Yu Zhao

Re: [PATCH v4] vmscan: add trace events for lru_gen

2023-09-25 Thread Yu Zhao
On Mon, Sep 25, 2023 at 10:20 PM Jaewon Kim wrote: > > As the legacy lru provides, the lru_gen needs some trace events for > debugging. > > This commit introduces 2 trace events. > trace_mm_vmscan_lru_gen_scan > trace_mm_vmscan_lru_gen_evict > > Each event is similar to the following legacy

Re: [PATCH v2] nvdimm: Support sizeof(struct page) > MAX_STRUCT_PAGE_SIZE

2023-01-25 Thread Yu Zhao
e9f05dc66f9 ("libnvdimm/pfn_dev: increase MAX_STRUCT_PAGE_SIZE") > Cc: > Cc: Alexander Potapenko > Cc: Marco Elver > Reported-by: Jeff Moyer Thanks -- that BUILD_BUG_ON() has been a nuisance for some of my debug configs. Acked-by: Yu Zhao

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-15 Thread Yu Zhao
On Wed, Apr 14, 2021 at 9:00 PM Andi Kleen wrote: > > > We fall back to the rmap when it's obviously not smart to do so. There > > is still a lot of room for improvement in this function though, i.e., > > it should be per VMA and NUMA aware. > > Okay so it's more a question to tune the cross over

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
On Wed, Apr 14, 2021 at 1:42 PM Rik van Riel wrote: > > On Wed, 2021-04-14 at 13:14 -0600, Yu Zhao wrote: > > On Wed, Apr 14, 2021 at 9:59 AM Rik van Riel > > wrote: > > > On Wed, 2021-04-14 at 08:51 -0700, Andi Kleen wrote: > > > > >2) It will not

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
gt; Hello, > >>> > >>> > >>> Very interesting work, thank you for sharing this :) > >>> > >>> On Tue, 13 Apr 2021 00:56:17 -0600 Yu Zhao wrote: > >>> > >>>> What's new in v2 > >>>>

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
On Wed, Apr 14, 2021 at 9:59 AM Rik van Riel wrote: > > On Wed, 2021-04-14 at 08:51 -0700, Andi Kleen wrote: > > >2) It will not scan PTE tables under non-leaf PMD entries that > > > do not > > > have the accessed bit set, when > > > CONFIG_HAVE_ARCH_PARENT_PMD_YOUNG=y. > > > >

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
On Wed, Apr 14, 2021 at 9:51 AM Andi Kleen wrote: > > >2) It will not scan PTE tables under non-leaf PMD entries that do not > > have the accessed bit set, when > > CONFIG_HAVE_ARCH_PARENT_PMD_YOUNG=y. > > This assumes that workloads have reasonable locality. Could there > be a

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
On Wed, Apr 14, 2021 at 7:52 AM Rik van Riel wrote: > > On Wed, 2021-04-14 at 16:27 +0800, Huang, Ying wrote: > > Yu Zhao writes: > > > > > On Wed, Apr 14, 2021 at 12:15 AM Huang, Ying > > > wrote: > > > > > > > NUMA Optimization > &g

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
On Wed, Apr 14, 2021 at 01:16:52AM -0600, Yu Zhao wrote: > On Tue, Apr 13, 2021 at 10:50 PM Dave Chinner wrote: > > > > On Tue, Apr 13, 2021 at 09:40:12PM -0600, Yu Zhao wrote: > > > On Tue, Apr 13, 2021 at 5:14 PM Dave Chinner wrote: > > > > On Tue, Apr 13,

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Yu Zhao
On Wed, Apr 14, 2021 at 12:15 AM Huang, Ying wrote: > > Yu Zhao writes: > > > On Tue, Apr 13, 2021 at 8:30 PM Rik van Riel wrote: > >> > >> On Wed, 2021-04-14 at 09:14 +1000, Dave Chinner wrote: > >> > On Tue, Apr 13, 2021 at 10:13:24AM -0600,

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-13 Thread Yu Zhao
interesting work, thank you for sharing this :) > > > > > > On Tue, 13 Apr 2021 00:56:17 -0600 Yu Zhao wrote: > > > > > >> What's new in v2 > > >> > > >> Special thanks to Jens Axboe for reporting a regression in buf

Re: [PATCH v1 00/14] Multigenerational LRU

2021-04-13 Thread Yu Zhao
On Mon, Apr 12, 2021 at 9:02 PM Huang, Ying wrote: > > Yu Zhao writes: > > > On Tue, Mar 16, 2021 at 02:14:43PM -0700, Dave Hansen wrote: > >> On 3/16/21 1:30 PM, Yu Zhao wrote: > >> > On Tue, Mar 16, 2021 at 07:50:23AM -0700, Dave Hansen wrote: > >>

[PATCH v2 16/16] mm: multigenerational lru: documentation

2021-04-13 Thread Yu Zhao
Add Documentation/vm/multigen_lru.rst. Signed-off-by: Yu Zhao --- Documentation/vm/index.rst| 1 + Documentation/vm/multigen_lru.rst | 192 ++ 2 files changed, 193 insertions(+) create mode 100644 Documentation/vm/multigen_lru.rst diff --git

[PATCH v2 14/16] mm: multigenerational lru: user interface

2021-04-13 Thread Yu Zhao
ve generations and therefore protected from the eviction. Use "nr_to_reclaim" to limit the number of pages to be evicted. Multiple command lines are supported, so does concatenation with delimiters "," and ";". Signed-off-by: Yu Zhao --- mm/vmscan.c | 405 +

[PATCH v2 13/16] mm: multigenerational lru: page reclaim

2021-04-13 Thread Yu Zhao
. Signed-off-by: Yu Zhao --- include/linux/mmzone.h | 6 ++ mm/rmap.c | 6 ++ mm/vmscan.c| 236 + 3 files changed, 248 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index dcfadf6a8c07..a22e9e40083f 100644

[PATCH v2 15/16] mm: multigenerational lru: Kconfig

2021-04-13 Thread Yu Zhao
Add configuration options for the multigenerational lru. Signed-off-by: Yu Zhao --- mm/Kconfig | 55 ++ 1 file changed, 55 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 24c045b24b95..0be1c6c90cc0 100644 --- a/mm/Kconfig +++ b/mm

[PATCH v2 12/16] mm: multigenerational lru: eviction

2021-04-13 Thread Yu Zhao
of a selected type are empty, the eviction increments min_seq[2] indexed by this selected type. Signed-off-by: Yu Zhao --- mm/vmscan.c | 341 1 file changed, 341 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 31e1b4155677..6239b1acd84f 100644

[PATCH v2 10/16] mm: multigenerational lru: mm_struct list

2021-04-13 Thread Yu Zhao
an mm_struct is being used on any CPUs or has been used since the last time a worker looked at it. In other words, workers will not be given an mm_struct that belongs to a process that has been sleeping. Signed-off-by: Yu Zhao --- fs/exec.c | 2 + include/linux/memcontrol.h | 6

[PATCH v2 11/16] mm: multigenerational lru: aging

2021-04-13 Thread Yu Zhao
or PTE table before it returns to the PGD table. This optimizes workloads that have large numbers of tiny VMAs, especially when CONFIG_PGTABLE_LEVELS=5. Signed-off-by: Yu Zhao --- mm/vmscan.c | 700 1 file changed, 700 insertions(+) diff

[PATCH v2 08/16] mm: multigenerational lru: groundwork

2021-04-13 Thread Yu Zhao
During a scan, the eviction sorts pages according to their generation numbers, if the aging has found them referenced. When it finds all the per-zone lists of a selected type are empty, the eviction increments min_seq[2] indexed by this selected type. Signed-off-by: Yu Zhao --- fs/fuse

[PATCH v2 09/16] mm: multigenerational lru: activation

2021-04-13 Thread Yu Zhao
q-1 (modulo MAX_NR_GENS), which are considered active and protected from the eviction. Other generations, which may or may not exist, are considered inactive. Signed-off-by: Yu Zhao --- fs/proc/task_mmu.c| 3 +- include/linux/mm_inline.h | 101 + include/linux/swa

[PATCH v2 01/16] include/linux/memcontrol.h: do not warn in page_memcg_rcu() if !CONFIG_MEMCG

2021-04-13 Thread Yu Zhao
but it also forces unnecessary locking upon users who have no interest in CONFIG_MEMCG. This patch removes the assertion for !CONFIG_MEMCG, because page_memcg_rcu() has a few callers and there are no concerns regarding their correctness at the moment. Signed-off-by: Yu Zhao --- include/linux/memcontrol.h

[PATCH v2 04/16] include/linux/cgroup.h: export cgroup_mutex

2021-04-13 Thread Yu Zhao
cgroup_mutex is needed to synchronize with memcg creations. Signed-off-by: Yu Zhao --- include/linux/cgroup.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 4f2f79de083e..bd5744360cfa 100644 --- a/include

[PATCH v2 06/16] mm, x86: support the access bit on non-leaf PMD entries

2021-04-13 Thread Yu Zhao
2019), section 4.8 Signed-off-by: Yu Zhao --- arch/Kconfig | 9 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 2 +- arch/x86/mm/pgtable.c | 5 - include/linux/pgtable.h| 4 ++-- 5 files changed, 17 insertions(+), 4 deletions

[PATCH v2 05/16] mm/swap.c: export activate_page()

2021-04-13 Thread Yu Zhao
activate_page() is needed to activate pages that are already on lru or queued in lru_pvecs.lru_add. The exported function is a merger between the existing activate_page() and __lru_cache_activate_page(). Signed-off-by: Yu Zhao --- include/linux/swap.h | 1 + mm/swap.c| 28

[PATCH v2 03/16] include/linux/huge_mm.h: define is_huge_zero_pmd() if !CONFIG_TRANSPARENT_HUGEPAGE

2021-04-13 Thread Yu Zhao
Currently is_huge_zero_pmd() only exists when CONFIG_TRANSPARENT_HUGEPAGE=y. This patch adds the function for !CONFIG_TRANSPARENT_HUGEPAGE. Signed-off-by: Yu Zhao --- include/linux/huge_mm.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/linux/huge_mm.h b/include/linux

[PATCH v2 02/16] include/linux/nodemask.h: define next_memory_node() if !CONFIG_NUMA

2021-04-13 Thread Yu Zhao
Currently next_memory_node only exists when CONFIG_NUMA=y. This patch adds the macro for !CONFIG_NUMA. Signed-off-by: Yu Zhao --- include/linux/nodemask.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index ac398e143c9a..89fe4e3592f9

[PATCH v2 07/16] mm/vmscan.c: refactor shrink_node()

2021-04-13 Thread Yu Zhao
Heuristics that determine scan balance between anon and file LRUs are rather independent. Move them into a separate function to improve readability. Signed-off-by: Yu Zhao --- mm/vmscan.c | 186 +++- 1 file changed, 98 insertions(+), 88 deletions

[PATCH v2 00/16] Multigenerational LRU Framework

2021-04-13 Thread Yu Zhao
omputer https://research.google/pubs/pub44271/ 3. Evaluation of NUMA-Aware Scheduling in Warehouse-Scale Clusters https://research.google/pubs/pub48329/ 4. Software-defined far memory in warehouse-scale computers https://research.google/pubs/pub48551/ 5. Borg: the Next Generation https://rese

Re: [RFC] mm: activate access-more-than-once page via NUMA balancing

2021-04-10 Thread Yu Zhao
On Fri, Mar 26, 2021 at 12:21 AM Huang, Ying wrote: > > Mel Gorman writes: > > > On Thu, Mar 25, 2021 at 12:33:45PM +0800, Huang, Ying wrote: > >> > I caution against this patch. > >> > > >> > It's non-deterministic for a number of reasons. As it requires NUMA > >> > balancing to be enabled, the

Re: [PATCH] mm/frontswap: fix frontswap_register_ops() race with swapon and swapoff

2021-04-10 Thread Yu Zhao
On Sat, Apr 10, 2021 at 5:01 AM Miaohe Lin wrote: > > On 2021/4/10 18:42, Yu Zhao wrote: > > On Sat, Apr 10, 2021 at 1:30 AM Miaohe Lin wrote: > >> > >> Hi: > >> On 2021/4/5 18:20, Miaohe Lin wrote: > >>> frontswap_register_ops can race with

Re: [PATCH v1 09/14] mm: multigenerational lru: mm_struct list

2021-04-10 Thread Yu Zhao
On Wed, Mar 24, 2021 at 12:58 AM Huang, Ying wrote: > > Yu Zhao writes: > > > On Mon, Mar 22, 2021 at 11:13:19AM +0800, Huang, Ying wrote: > >> Yu Zhao writes: > >> > >> > On Wed, Mar 17, 2021 at 11:37:38AM +0800, Huang, Ying wrote: > >>

Re: [PATCH] mm/frontswap: fix frontswap_register_ops() race with swapon and swapoff

2021-04-10 Thread Yu Zhao
On Sat, Apr 10, 2021 at 1:30 AM Miaohe Lin wrote: > > Hi: > On 2021/4/5 18:20, Miaohe Lin wrote: > > frontswap_register_ops can race with swapon. Consider the following scene: > > Any comment or suggestion? Or is this race window too theoretical to fix? > Thanks. Let me run a stress test and get

Re: [PATCH v1 00/14] Multigenerational LRU

2021-04-10 Thread Yu Zhao
On Tue, Mar 16, 2021 at 02:14:43PM -0700, Dave Hansen wrote: > On 3/16/21 1:30 PM, Yu Zhao wrote: > > On Tue, Mar 16, 2021 at 07:50:23AM -0700, Dave Hansen wrote: > >> I think it would also be very worthwhile to include some research in > >> this series about why the

Re: [Question] Is there a race window between swapoff vs synchronous swap_readpage

2021-03-29 Thread Yu Zhao
On Mon, Mar 29, 2021 at 9:44 PM Huang, Ying wrote: > > Miaohe Lin writes: > > > On 2021/3/30 9:57, Huang, Ying wrote: > >> Hi, Miaohe, > >> > >> Miaohe Lin writes: > >> > >>> Hi all, > >>> I am investigating the swap code, and I found the below possible race > >>> window: > >>> > >>> CPU 1

Re: [PATCH v1 09/14] mm: multigenerational lru: mm_struct list

2021-03-22 Thread Yu Zhao
On Mon, Mar 22, 2021 at 11:13:19AM +0800, Huang, Ying wrote: > Yu Zhao writes: > > > On Wed, Mar 17, 2021 at 11:37:38AM +0800, Huang, Ying wrote: > >> Yu Zhao writes: > >> > >> > On Tue, Mar 16, 2021 at 02:44:31PM +0800, Huang, Ying wrote: > >

Re: [PATCH v1 14/14] mm: multigenerational lru: documentation

2021-03-22 Thread Yu Zhao
On Fri, Mar 19, 2021 at 05:31:20PM +0800, Alex Shi wrote: > > > 在 2021/3/13 下午3:57, Yu Zhao 写道: > > +Recipes > > +--- > > +:Android on ARMv8.1+: ``X=4``, ``N=0`` > > + > > +:Android on pre-ARMv8.1 CPUs: Not recommended due to the lack of > > + `

Re: [PATCH v1 09/14] mm: multigenerational lru: mm_struct list

2021-03-17 Thread Yu Zhao
On Wed, Mar 17, 2021 at 11:37:38AM +0800, Huang, Ying wrote: > Yu Zhao writes: > > > On Tue, Mar 16, 2021 at 02:44:31PM +0800, Huang, Ying wrote: > >> Yu Zhao writes: > >> > >> > On Tue, Mar 16, 2021 at 10:07:36AM +0800, Huang

Re: [PATCH v1 11/14] mm: multigenerational lru: page activation

2021-03-16 Thread Yu Zhao
On Tue, Mar 16, 2021 at 04:34:37PM +, Matthew Wilcox wrote: > On Sat, Mar 13, 2021 at 12:57:44AM -0700, Yu Zhao wrote: > > In the page fault path, we want to add pages to the per-zone lists > > index by max_seq as they cannot be evicted without going through > > the aging

Re: [PATCH v1 00/14] Multigenerational LRU

2021-03-16 Thread Yu Zhao
On Tue, Mar 16, 2021 at 07:50:23AM -0700, Dave Hansen wrote: > On 3/15/21 7:24 PM, Yu Zhao wrote: > > On Mon, Mar 15, 2021 at 11:00:06AM -0700, Dave Hansen wrote: > >> How bad does this scanning get in the worst case if there's a lot of > >> sharing? > > >

Re: [PATCH v1 10/14] mm: multigenerational lru: core

2021-03-16 Thread Yu Zhao
On Tue, Mar 16, 2021 at 04:53:53PM +0800, Huang, Ying wrote: > Yu Zhao writes: > > > On Tue, Mar 16, 2021 at 02:52:52PM +0800, Huang, Ying wrote: > >> Yu Zhao writes: > >> > >> > On Tue, Mar 16, 2021 at 10:08:51AM +0800, Huang, Ying wro

Re: [PATCH v1 10/14] mm: multigenerational lru: core

2021-03-16 Thread Yu Zhao
On Tue, Mar 16, 2021 at 02:52:52PM +0800, Huang, Ying wrote: > Yu Zhao writes: > > > On Tue, Mar 16, 2021 at 10:08:51AM +0800, Huang, Ying wrote: > >> Yu Zhao writes: > >> [snip] > >> > >> > +/* Main function used by foreground, background

Re: [PATCH v1 09/14] mm: multigenerational lru: mm_struct list

2021-03-16 Thread Yu Zhao
On Tue, Mar 16, 2021 at 02:44:31PM +0800, Huang, Ying wrote: > Yu Zhao writes: > > > On Tue, Mar 16, 2021 at 10:07:36AM +0800, Huang, Ying wrote: > >> Rik van Riel writes: > >> > >> > On Sat, 2021-03-13 at 00:57 -0700, Yu Zhao wrote: > >>

Re: [PATCH v1 10/14] mm: multigenerational lru: core

2021-03-15 Thread Yu Zhao
On Tue, Mar 16, 2021 at 10:08:51AM +0800, Huang, Ying wrote: > Yu Zhao writes: > [snip] > > > +/* Main function used by foreground, background and user-triggered aging. > > */ > > +static bool walk_mm_list(struct lruvec *lruvec, unsigned long next_seq, >

Re: [PATCH v1 09/14] mm: multigenerational lru: mm_struct list

2021-03-15 Thread Yu Zhao
On Tue, Mar 16, 2021 at 10:07:36AM +0800, Huang, Ying wrote: > Rik van Riel writes: > > > On Sat, 2021-03-13 at 00:57 -0700, Yu Zhao wrote: > > > >> +/* > >> + * After pages are faulted in, they become the youngest generation. > >> They must &

Re: [PATCH v1 00/14] Multigenerational LRU

2021-03-15 Thread Yu Zhao
On Mon, Mar 15, 2021 at 11:38:20AM -0700, Yang Shi wrote: > On Fri, Mar 12, 2021 at 11:57 PM Yu Zhao wrote: > > > > TLDR > > > > The current page reclaim is too expensive in terms of CPU usage and > > often making poor choices about what to evict. We wou

Re: [PATCH v1 00/14] Multigenerational LRU

2021-03-15 Thread Yu Zhao
On Mon, Mar 15, 2021 at 11:00:06AM -0700, Dave Hansen wrote: > On 3/12/21 11:57 PM, Yu Zhao wrote: > > Background > > == > > DRAM is a major factor in total cost of ownership, and improving > > memory overcommit brings a high return on investment. Over the

Re: [PATCH v1 00/14] Multigenerational LRU

2021-03-15 Thread Yu Zhao
On Mon, Mar 15, 2021 at 09:13:50AM +0800, Hillf Danton wrote: > On Sat, 13 Mar 2021 00:57:33 -0700 Yu Zhao wrote: > > TLDR > > > > The current page reclaim is too expensive in terms of CPU usage and > > often making poor choices about what to evict. We would lik

Re: [PATCH v1 10/14] mm: multigenerational lru: core

2021-03-14 Thread Yu Zhao
On Sun, Mar 14, 2021 at 07:02:01PM -0700, Andi Kleen wrote: > Yu Zhao writes: Hi Andi! Recovering the context a bit: err = -EBUSY; > > + > > +#ifdef CONFIG_MEMCG > > + if (memcg && atomic_read(>moving_account)) > > +

Re: [PATCH v1 06/14] mm, x86: support the access bit on non-leaf PMD entries

2021-03-14 Thread Yu Zhao
On Sun, Mar 14, 2021 at 04:22:03PM -0700, Dave Hansen wrote: > On 3/12/21 11:57 PM, Yu Zhao wrote: > > Some architectures support the accessed bit on non-leaf PMD entries > > (parents) in addition to leaf PTE entries (children) where pages are > > mapped, e.g., x86_64

Re: [PATCH v1 06/14] mm, x86: support the access bit on non-leaf PMD entries

2021-03-14 Thread Yu Zhao
On Sun, Mar 14, 2021 at 08:27:29PM -0400, Zi Yan wrote: > On 14 Mar 2021, at 20:03, Yu Zhao wrote: > > > On Sun, Mar 14, 2021 at 10:51:03PM +, Matthew Wilcox wrote: > >> On Sun, Mar 14, 2021 at 06:12:42PM -0400, Zi Yan wrote: > >>> On 13 Mar 2021, at 2:57,

Re: [PATCH v1 00/14] Multigenerational LRU

2021-03-14 Thread Yu Zhao
On Sun, Mar 14, 2021 at 06:48:17PM -0400, Zi Yan wrote: > On 13 Mar 2021, at 2:57, Yu Zhao wrote: > > Problems > > > > 31.03% page_vma_mapped_walk > > 25.59% lzo1x_1_do_compress > >4.63% do_raw_spin_lock > >3.89%

Re: [PATCH v1 06/14] mm, x86: support the access bit on non-leaf PMD entries

2021-03-14 Thread Yu Zhao
On Sun, Mar 14, 2021 at 10:51:03PM +, Matthew Wilcox wrote: > On Sun, Mar 14, 2021 at 06:12:42PM -0400, Zi Yan wrote: > > On 13 Mar 2021, at 2:57, Yu Zhao wrote: > > > > > Some architectures support the accessed bit on non-leaf PMD entries > > > (parents

Re: [PATCH v1 01/14] include/linux/memcontrol.h: do not warn in page_memcg_rcu() if !CONFIG_MEMCG

2021-03-13 Thread Yu Zhao
On Sat, Mar 13, 2021 at 03:09:18PM +, Matthew Wilcox wrote: > On Sat, Mar 13, 2021 at 12:57:34AM -0700, Yu Zhao wrote: > > We want to make sure the rcu lock is held while using > > page_memcg_rcu(). But having a WARN_ON_ONCE() in page_memcg_rcu() when > > !CONFIG_MEMCG i

[PATCH v1 12/14] mm: multigenerational lru: user space interface

2021-03-13 Thread Yu Zhao
;-1 are active generations and therefore protected from the eviction. "nr_to_reclaim" can be used to limit the number of pages to be evicted. Multiple command lines are supported, so does concatenation with delimiters "," and ";". Signed-off-by: Yu Zhao --- mm/vmscan.c | 3

[PATCH v1 13/14] mm: multigenerational lru: Kconfig

2021-03-13 Thread Yu Zhao
Add configuration options for multigenerational lru. Signed-off-by: Yu Zhao --- mm/Kconfig | 29 + 1 file changed, 29 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 24c045b24b95..3a5bcc2d7a45 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -872,4 +872,33

[PATCH v1 14/14] mm: multigenerational lru: documentation

2021-03-13 Thread Yu Zhao
Add Documentation/vm/multigen_lru.rst. Signed-off-by: Yu Zhao --- Documentation/vm/index.rst| 1 + Documentation/vm/multigen_lru.rst | 210 ++ 2 files changed, 211 insertions(+) create mode 100644 Documentation/vm/multigen_lru.rst diff --git

[PATCH v1 08/14] mm/vmscan.c: refactor shrink_node()

2021-03-13 Thread Yu Zhao
Heuristics in shrink_node() are rather independent and can be refactored into a separate function to improve readability. Signed-off-by: Yu Zhao --- mm/vmscan.c | 186 +++- 1 file changed, 98 insertions(+), 88 deletions(-) diff --git a/mm

[PATCH v1 10/14] mm: multigenerational lru: core

2021-03-13 Thread Yu Zhao
] indexed by this selected type. The eviction triggers the aging when both of min_seq[2] reaches max_seq-1, assuming both anon and file types are reclaimable. Signed-off-by: Yu Zhao --- include/linux/mm.h|1 + include/linux/mm_inline.h | 194 + include/linux

[PATCH v1 11/14] mm: multigenerational lru: page activation

2021-03-13 Thread Yu Zhao
number of a page with max_seq and max_seq-1, which are active generations and protected from the eviction. Other generations, which may or may not exist, are inactive. Signed-off-by: Yu Zhao --- fs/proc/task_mmu.c| 3 ++- include/linux/mm_inline.h | 52

[PATCH v1 09/14] mm: multigenerational lru: mm_struct list

2021-03-13 Thread Yu Zhao
has reached the end of the list. This infrastructure also tracks whether an mm_struct is being used on any CPUs or has been used since the last time a worker looked at it. In other words, workers will not be given an mm_struct that belongs to a process that has been sleeping. Signed-off-by: Yu

[PATCH v1 07/14] mm/pagewalk.c: add pud_entry_post() for post-order traversals

2021-03-13 Thread Yu Zhao
walk_pte_range() works for the PTE entries of a PMD entry: they only need to take PTL once to search all the child entries of a parent entry. Signed-off-by: Yu Zhao --- include/linux/pagewalk.h | 4 mm/pagewalk.c| 5 + 2 files changed, 9 insertions(+) diff --git a/include

[PATCH v1 06/14] mm, x86: support the access bit on non-leaf PMD entries

2021-03-13 Thread Yu Zhao
Manual Volume 3 (October 2019), section 4.8 Signed-off-by: Yu Zhao --- arch/Kconfig | 8 arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h | 2 +- arch/x86/mm/pgtable.c | 5 - include/linux/pgtable.h| 4 ++-- 5 files changed, 16

[PATCH v1 03/14] include/linux/huge_mm.h: define is_huge_zero_pmd() if !CONFIG_TRANSPARENT_HUGEPAGE

2021-03-13 Thread Yu Zhao
Currently is_huge_zero_pmd() only exists when CONFIG_TRANSPARENT_HUGEPAGE=y. This patch defines the function for the !CONFIG_TRANSPARENT_HUGEPAGE case. Signed-off-by: Yu Zhao --- include/linux/huge_mm.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/linux/huge_mm.h b/include

[PATCH v1 01/14] include/linux/memcontrol.h: do not warn in page_memcg_rcu() if !CONFIG_MEMCG

2021-03-13 Thread Yu Zhao
if (page_memcg_rcu(page2) == memcg) do something to page2 too as it cannot be migrated away from the memcg either. unlock_page_memcg(page1) (rcu_read_unlock() if CONFIG_MEMCG=y) This patch removes the WARN_ON_ONCE() from page_memcg_rcu() for the !CONFIG_MEMCG case. Signed-off-by: Yu

[PATCH v1 05/14] mm/swap.c: export activate_page()

2021-03-13 Thread Yu Zhao
Export activate_page(), which is a merger between the existing activate_page() and __lru_cache_activate_page(), so it can be used to activate pages that are already on lru or queued in lru_pvecs.lru_add. Signed-off-by: Yu Zhao --- include/linux/swap.h | 1 + mm/swap.c| 28

[PATCH v1 04/14] include/linux/cgroup.h: export cgroup_mutex

2021-03-13 Thread Yu Zhao
Export cgroup_mutex so it can be used to synchronize with memcg allocations. Signed-off-by: Yu Zhao --- include/linux/cgroup.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 4f2f79de083e..bd5744360cfa

[PATCH v1 02/14] include/linux/nodemask.h: define next_memory_node() if !CONFIG_NUMA

2021-03-13 Thread Yu Zhao
Currently next_memory_node only exists when CONFIG_NUMA=y. This patch defines the macro for the !CONFIG_NUMA case. Signed-off-by: Yu Zhao --- include/linux/nodemask.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index ac398e143c9a

[PATCH v1 00/14] Multigenerational LRU

2021-03-13 Thread Yu Zhao
xt Generation https://research.google/pubs/pub49065/ Yu Zhao (14): include/linux/memcontrol.h: do not warn in page_memcg_rcu() if !CONFIG_MEMCG include/linux/nodemask.h: define next_memory_node() if !CONFIG_NUMA include/linux/huge_mm.h: define is_huge_zero_pmd() if !CONFIG_TRANSPARENT_HU

[PATCH 2/2] mm: clean up include/linux/page-flags-layout.h

2021-03-03 Thread Yu Zhao
Tidy things up and delete comments stating the obvious with typos or making no sense. Signed-off-by: Yu Zhao --- include/linux/page-flags-layout.h | 62 +++ mm/mm_init.c | 4 -- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git

[PATCH 1/2] mm: correctly determine LAST_CPUPID_WIDTH

2021-03-03 Thread Yu Zhao
. This means we need to use NODES_WIDTH, not NODES_SHIFT. Signed-off-by: Yu Zhao --- include/linux/page-flags-layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h index 7d4ec26d8a3e..295c2c687d2c 100644

Re: [PATCH v2 3/3] mm: use PF_ONLY_HEAD for PG_active and PG_unevictable

2021-03-01 Thread Yu Zhao
On Mon, Mar 01, 2021 at 02:50:07PM +0300, Kirill A. Shutemov wrote: > On Fri, Feb 26, 2021 at 12:13:14PM +, Matthew Wilcox wrote: > > On Fri, Feb 26, 2021 at 02:17:18AM -0700, Yu Zhao wrote: > > > All places but one test, set or clear PG_active and PG_unevictable on > &g

Re: [PATCH v2 2/3] mm: use PF_NO_TAIL for PG_lru

2021-02-26 Thread Yu Zhao
On Fri, Feb 26, 2021 at 02:17:17AM -0700, Yu Zhao wrote: > Trying to set or clear PG_lru on tail pages has been considered buggy. > Enforce this rule by changing the policy for PG_lru from PF_HEAD to > PF_NO_TAIL. This means setting or clearing PG_lru on tail pages won't > b

Re: [PATCH v2 3/3] mm: use PF_ONLY_HEAD for PG_active and PG_unevictable

2021-02-26 Thread Yu Zhao
On Fri, Feb 26, 2021 at 12:13:14PM +, Matthew Wilcox wrote: > On Fri, Feb 26, 2021 at 02:17:18AM -0700, Yu Zhao wrote: > > All places but one test, set or clear PG_active and PG_unevictable on > > small or head pages. Use compound_head() explicitly for that singleton > >

Re: [PATCH v2 0/3] trim the uses of compound_head()

2021-02-26 Thread Yu Zhao
On Fri, Feb 26, 2021 at 11:52:03AM +0100, Vlastimil Babka wrote: > On 2/26/21 10:17 AM, Yu Zhao wrote: > > Patch series "mm: lru related cleanups" starting at commit 42895ea73bcd > > ("mm/vmscan.c: use add_page_to_lru_list()") bloated vmlinux by 1777 > &

[PATCH v2 3/3] mm: use PF_ONLY_HEAD for PG_active and PG_unevictable

2021-02-26 Thread Yu Zhao
All places but one test, set or clear PG_active and PG_unevictable on small or head pages. Use compound_head() explicitly for that singleton so the rest can rid of redundant compound_head(). bloat-o-meter result: add/remove: 0/0 grow/shrink: 3/38 up/down: 388/-4270 (-3882) Signed-off-by: Yu

[PATCH v2 2/3] mm: use PF_NO_TAIL for PG_lru

2021-02-26 Thread Yu Zhao
l -- even if a piece of buggy code has gotten away with compound_page(tail)->flags, it will run into trouble with lru list addition and deletion because they use tail->lru rather than compound_page(tail)->lru. bloat-o-meter result: add/remove: 0/0 grow/shrink: 0/11 up/down: 0/-535 (

[PATCH v2 1/3] mm: bypass compound_head() for PF_NO_TAIL when enforce=1

2021-02-26 Thread Yu Zhao
correction" is beneficial. bloat-o-meter result: add/remove: 0/0 grow/shrink: 4/62 up/down: 309/-2851 (-2542) Signed-off-by: Yu Zhao --- include/linux/page-flags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h

[PATCH v2 0/3] trim the uses of compound_head()

2021-02-26 Thread Yu Zhao
-hanging fruit, this v2 removes compound_head() completely from Page{Active,Unevictable}. bloat-o-meter result before and after the series: add/remove: 0/0 grow/shrink: 6/92 up/down: 697/-7656 (-6959) Yu Zhao (3): mm: bypass compound_head() for PF_NO_TAIL when enforce=1 mm: use PF_NO_TA

Re: [PATCH] mm: test page->flags directly in page_lru()

2021-02-24 Thread Yu Zhao
On Thu, Feb 25, 2021 at 03:55:53AM +, Matthew Wilcox wrote: > On Wed, Feb 24, 2021 at 04:50:39PM -0700, Yu Zhao wrote: > > On Wed, Feb 24, 2021 at 10:48:46PM +, Matthew Wilcox wrote: > > > On Wed, Feb 24, 2021 at 03:34:16PM -0700, Yu Zhao wrote: > > > > &

Re: [PATCH] mm: test page->flags directly in page_lru()

2021-02-24 Thread Yu Zhao
On Wed, Feb 24, 2021 at 10:48:46PM +, Matthew Wilcox wrote: > On Wed, Feb 24, 2021 at 03:34:16PM -0700, Yu Zhao wrote: > > > If only somebody were working on a patch series to get rid of > > > all those calls to compound_head()! Some reviews on > > > ht

Re: [PATCH] mm: test page->flags directly in page_lru()

2021-02-24 Thread Yu Zhao
On Wed, Feb 24, 2021 at 09:56:39PM +, Matthew Wilcox wrote: > On Wed, Feb 24, 2021 at 05:15:58AM -0800, Andrew Morton wrote: > > Here's what the preprocessor produces for an allmodconfig version of > > PageActive(): > > > > static inline __attribute__((__gnu_inline__))

Re: [PATCH] mm: test page->flags directly in page_lru()

2021-02-24 Thread Yu Zhao
On Wed, Feb 24, 2021 at 05:15:58AM -0800, Andrew Morton wrote: > On Wed, 24 Feb 2021 01:48:07 -0700 Yu Zhao wrote: > > > Currently page_lru() uses Page{Active,Unevictable} to determine which > > lru list a page belongs to. Page{Active,Unevictable} contain > > compo

[PATCH] mm: test page->flags directly in page_lru()

2021-02-24 Thread Yu Zhao
scripts/bloat-o-meter results before and after the entire series: Glang: add/remove: 0/1 grow/shrink: 7/10 up/down: 191/-1189 (-998) GCC: add/remove: 0/1 grow/shrink: 9/9 up/down: 1010/-783 (227) Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 21 +++-- 1 file changed, 7 in

Re: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions

2021-02-24 Thread Yu Zhao
On Wed, Feb 24, 2021 at 04:06:45PM +0800, Alex Shi wrote: > > > 在 2021/2/24 下午1:29, Yu Zhao 写道: > > On Tue, Feb 23, 2021 at 02:50:11PM -0800, Andrew Morton wrote: > >> On Tue, 26 Jan 2021 15:14:38 -0700 Yu Zhao wrote: > >> > >>> On Tue, Jan 26, 2

Re: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions

2021-02-23 Thread Yu Zhao
On Tue, Feb 23, 2021 at 02:50:11PM -0800, Andrew Morton wrote: > On Tue, 26 Jan 2021 15:14:38 -0700 Yu Zhao wrote: > > > On Tue, Jan 26, 2021 at 10:01:11PM +, Matthew Wilcox wrote: > > > On Fri, Jan 22, 2021 at 03:05:53PM -0700, Yu Zhao wrote: > > > > +++ b/m

Re: [page-reclaim] Augmented Page Reclaim

2021-02-09 Thread Yu Zhao
On Tue, Feb 09, 2021 at 01:32:58PM -0800, Jesse Barnes wrote: > > == > > Augmented Page Reclaim > > == > > We would like to share a work with you and see if there is enough > > interest to warrant a run for the mainline. This work is a part of > > result

Re: Augmented Page Reclaim

2021-02-02 Thread Yu Zhao
1 at 01:57:15AM -0700, Yu Zhao wrote: > > > Versatility > > === > > Userspace can trigger aging and eviction independently via the > > ``debugfs`` interface [note]_ for working set estimation, proactive > > 1. `Long-term SLOs for reclaimed cloud comput

Augmented Page Reclaim

2021-02-02 Thread Yu Zhao
== Augmented Page Reclaim == We would like to share a work with you and see if there is enough interest to warrant a run for the mainline. This work is a part of result from a decade of research and experimentation in memory overcommit at Google: an

Re: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions

2021-01-26 Thread Yu Zhao
On Tue, Jan 26, 2021 at 08:13:11PM +0100, Vlastimil Babka wrote: > On 1/22/21 11:05 PM, Yu Zhao wrote: > > The "enum lru_list" parameter to add_page_to_lru_list() and > > add_page_to_lru_list_tail() is redundant in the sense that it can > > be extracted from the &quo

Re: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions

2021-01-26 Thread Yu Zhao
On Tue, Jan 26, 2021 at 10:01:11PM +, Matthew Wilcox wrote: > On Fri, Jan 22, 2021 at 03:05:53PM -0700, Yu Zhao wrote: > > +++ b/mm/swap.c > > @@ -231,7 +231,7 @@ static void pagevec_move_tail_fn(struct page *page, > > struct lruvec *lruvec) > >

[PATCH v2 02/10] mm: shuffle lru list addition and deletion functions

2021-01-22 Thread Yu Zhao
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-yuz...@google.com/ Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 42

[PATCH v2 05/10] mm: don't pass "enum lru_list" to del_page_from_lru_list()

2021-01-22 Thread Yu Zhao
fixes them. This patch may have left page_off_lru() seemingly odd, and we'll take care of it in the next patch. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-6-yuz...@google.com/ Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 5 +++-- mm/compaction.c | 2 +-

  1   2   3   4   5   >