Re: [PATCH v1 01/18] mm: allow for detecting underflows with page_mapcount() again

2024-04-09 Thread Zi Yan
t;_mapcount) + 1; > + int mapcount = atomic_read(&page->_mapcount); > > /* Handle page_has_type() pages */ > - if (mapcount < 0) > - mapcount = 0; > + mapcount = page_type_has_type(mapcount) ? 0 : mapcount + 1; > if (unlikely(PageComp

Re: [PATCH v1 04/18] mm: track mapcount of large folios in single value

2024-04-09 Thread Zi Yan
On 9 Apr 2024, at 15:22, David Hildenbrand wrote: > Let's track the mapcount of large folios in a single value. The mapcount of > a large folio currently corresponds to the sum of the entire mapcount and > all page mapcounts. > > This sum is what we actually want to know in folio_mapcount() and it

Re: [PATCH v2 00/25] mm: introduce numa_memblks

2024-07-24 Thread Zi Yan
On 24 Jul 2024, at 18:44, Zi Yan wrote: > On 23 Jul 2024, at 2:41, Mike Rapoport wrote: > >> From: "Mike Rapoport (Microsoft)" >> >> Hi, >> >> Following the discussion about handling of CXL fixed memory windows on >> arm64 [1] I decided to bite

Re: [PATCH v2 00/25] mm: introduce numa_memblks

2024-07-24 Thread Zi Yan
On 24 Jul 2024, at 20:35, Zi Yan wrote: > On 24 Jul 2024, at 18:44, Zi Yan wrote: > >> On 23 Jul 2024, at 2:41, Mike Rapoport wrote: >> >>> From: "Mike Rapoport (Microsoft)" >>> >>> Hi, >>> >>> Following the discussion abou

Re: [PATCH v5 2/4] mm: document (m)THP defer usage

2025-04-30 Thread Zi Yan
ize (must be a power of 2 of PAGE_SIZE and > supported anonymous THP) and is one of ``always``, ``madvise``, > -``never`` or ``inherit``. > +``defer``, ``never`` or ``inherit``. > > For example, the following will set 16K, 32K, 64K THP to ``always``, > set 128K, 512K to ``inherit``, set 256K to ``madvise`` and 1M, 2M Otherwise, LGTM. Thanks. Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH v5 3/4] khugepaged: add defer option to mTHP options

2025-04-30 Thread Zi Yan
led early. */ > if ((tva_flags & TVA_ENFORCE_SYSFS) && vma_is_anonymous(vma)) { And code here becomes tva_flags & (TVA_ENFORCE_SYSFS | TVA_IN_KHUGEPAGE). Otherwise, LGTM. Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH v5 4/4] selftests: mm: add defer to thp setting parser

2025-04-30 Thread Zi Yan
changed, 2 insertions(+) > Acked-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH v5 1/4] mm: defer THP insertion to khugepaged

2025-04-29 Thread Zi Yan
A_IN_PF) && hugepage_global_defer() && > + !(vm_flags & VM_HUGEPAGE)) > + return 0; > + > /* Optimization to check if required orders are enabled early. */ > if ((tva_flags & TVA_ENFORCE_SYSFS) && vma_is_anonymous(vma)) { > unsigned long mask = READ_ONCE(huge_anon_orders_always); > - This newline should stay, right? The rest looks good to me. Thanks. Acked-by: Zi Yan Best Regards, Yan, Zi

Re: [PATCH RFC 03/29] mm/zsmalloc: drop PageIsolated() related VM_BUG_ONs

2025-06-18 Thread Zi Yan
loc.c | 5 - > 2 files changed, 10 deletions(-) > Acked-by: Zi Yan Best Regards, Yan, Zi

Re: [PATCH RFC 04/29] mm/page_alloc: allow for making page types sticky until freed

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 13:39, David Hildenbrand wrote: > Let's allow for not clearing a page type before freeing a page to the > buddy. > > We'll focus on having a type set on the first page of a larger > allocation only. > > With this change, we can reliably identify typed folios even though > they m

Re: [PATCH RFC 07/29] mm/migrate: rename isolate_movable_page() to isolate_movable_ops_page()

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 14:39, Matthew Wilcox wrote: > On Wed, Jun 18, 2025 at 02:14:15PM -0400, Zi Yan wrote: >> On 18 Jun 2025, at 13:39, David Hildenbrand wrote: >> >>> ... and start moving back to per-page things that will absolutely not be >>> folio things in th

Re: [PATCH RFC 08/29] mm/migrate: rename putback_movable_folio() to putback_movable_ops_page()

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 15:18, Matthew Wilcox wrote: > On Wed, Jun 18, 2025 at 03:10:10PM -0400, Zi Yan wrote: >> On 18 Jun 2025, at 13:39, David Hildenbrand wrote: >>> + /* >>> +* TODO: these pages will not be folios in the future. All >>> +* folio

Re: [PATCH RFC 05/29] mm/balloon_compaction: make PageOffline sticky

2025-06-18 Thread Zi Yan
ageOffline is sticky until the page is freed to the buddy. */ > } > > /* > -- > 2.49.0 Acked-by: Zi Yan Best Regards, Yan, Zi

Re: [PATCH RFC 04/29] mm/page_alloc: allow for making page types sticky until freed

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 13:39, David Hildenbrand wrote: > Let's allow for not clearing a page type before freeing a page to the > buddy. > > We'll focus on having a type set on the first page of a larger > allocation only. > > With this change, we can reliably identify typed folios even though > they m

Re: [PATCH RFC 04/29] mm/page_alloc: allow for making page types sticky until freed

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 14:04, Zi Yan wrote: > On 18 Jun 2025, at 13:39, David Hildenbrand wrote: > >> Let's allow for not clearing a page type before freeing a page to the >> buddy. >> >> We'll focus on having a type set on the first page of a larger >> a

Re: [PATCH RFC 01/29] mm/balloon_compaction: we cannot have isolated pages in the balloon list

2025-06-18 Thread Zi Yan
s drop this unnecessary check. > > Signed-off-by: David Hildenbrand > --- > mm/balloon_compaction.c | 6 -- > 1 file changed, 6 deletions(-) > Acked-by: Zi Yan Best Regards, Yan, Zi

Re: [PATCH RFC 06/29] mm/zsmalloc: make PageZsmalloc() sticky

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 13:39, David Hildenbrand wrote: > Let the buddy handle clearing the type. Same comment as Patch 5. > > Signed-off-by: David Hildenbrand > --- > mm/zpdesc.h | 5 - > mm/zsmalloc.c | 3 +-- > 2 files changed, 1 insertion(+), 7 deletions(-) >

Re: [PATCH RFC 04/29] mm/page_alloc: allow for making page types sticky until freed

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 14:06, Matthew Wilcox wrote: > On Wed, Jun 18, 2025 at 02:04:18PM -0400, Zi Yan wrote: >>> Let's allow for not clearing a page type before freeing a page to the >>> buddy. >>> >>> We'll focus on having a type set on the first p

Re: [PATCH RFC 07/29] mm/migrate: rename isolate_movable_page() to isolate_movable_ops_page()

2025-06-18 Thread Zi Yan
On 18 Jun 2025, at 13:39, David Hildenbrand wrote: > ... and start moving back to per-page things that will absolutely not be > folio things in the future. Add documentation and a comment that the > remaining folio stuff (lock, refcount) will have to be reworked as well. > > While at it, convert t

Re: [PATCH RFC 08/29] mm/migrate: rename putback_movable_folio() to putback_movable_ops_page()

2025-06-18 Thread Zi Yan
lio); > - folio_put(folio); > + putback_movable_ops_page(&folio->page); > } else { > node_stat_mod_folio(folio, NR_ISOLATED_ANON + > folio_is_file_lru(folio), > -folio_nr_pages(folio)); > -- > 2.49.0 Acked-by: Zi Yan Best Regards, Yan, Zi

Re: [PATCH RFC 10/29] mm/migrate: remove folio_test_movable() and folio_movable_ops()

2025-06-20 Thread Zi Yan
file changed, 14 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 11/29] mm/migrate: move movable_ops page handling out of move_to_new_folio()

2025-06-20 Thread Zi Yan
> deals with actual folios. (we only support migration of > individual movable_ops pages) > > Signed-off-by: David Hildenbrand > --- > mm/migrate.c | 61 > 1 file changed, 28 insertions(+), 33 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 09/29] mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()

2025-06-20 Thread Zi Yan
ed-off-by: David Hildenbrand > --- > mm/migrate.c | 82 > 1 file changed, 45 insertions(+), 37 deletions(-) > LGTM. Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 14/29] mm/migrate: remove __ClearPageMovable()

2025-06-20 Thread Zi Yan
the driver should call __ClearPageMovable(@src) and return MIGRATEPAGE_SUCCESS. " Otherwise, Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 15/29] mm/migration: remove PageMovable()

2025-06-20 Thread Zi Yan
| 18 ++ > 3 files changed, 10 insertions(+), 25 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 17/29] mm/page_isolation: drop __folio_test_movable() check for large folios

2025-06-20 Thread Zi Yan
On 18 Jun 2025, at 13:40, David Hildenbrand wrote: > Currently, we only support migration of individual non-folio pages, so > we can not run into that. > > Signed-off-by: David Hildenbrand > --- > mm/page_isolation.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH RFC 16/29] mm: rename __PageMovable() to page_has_movable_ops()

2025-06-20 Thread Zi Yan
On 18 Jun 2025, at 13:39, David Hildenbrand wrote: > Let's make it clearer that we are talking about movable_ops pages. > > Signed-off-by: David Hildenbrand > --- > include/linux/migrate.h| 2 +- > include/linux/page-flags.h | 2 +- > mm/compaction.c| 7 ++- > mm/memory-fa

Re: [PATCH RFC 18/29] mm: remove __folio_test_movable()

2025-06-20 Thread Zi Yan
f-by: David Hildenbrand > --- > include/linux/page-flags.h | 6 -- > mm/migrate.c | 43 -- > mm/vmscan.c| 6 -- > 3 files changed, 17 insertions(+), 38 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 19/29] mm: stop storing migration_ops in page->mapping

2025-06-20 Thread Zi Yan
c.c | 8 +++- > 8 files changed, 35 insertions(+), 25 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 23/29] mm/page-alloc: remove PageMappingFlags()

2025-06-23 Thread Zi Yan
age-flags.h | 5 - > mm/page_alloc.c| 7 +++ > 2 files changed, 3 insertions(+), 9 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 26/29] mm: rename PAGE_MAPPING_* to FOLIO_MAPPING_*

2025-06-23 Thread Zi Yan
> mm/util.c | 6 +++--- > 10 files changed, 30 insertions(+), 31 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 25/29] mm: simplify folio_expected_ref_count()

2025-06-23 Thread Zi Yan
t's simply refuse typed pages (which includes slab) except hugetlb, > and WARN. > > Signed-off-by: David Hildenbrand > --- > include/linux/mm.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 22/29] mm/page-flags: rename PAGE_MAPPING_MOVABLE to PAGE_MAPPING_ANON_KSM

2025-06-23 Thread Zi Yan
1 file changed, 6 insertions(+), 6 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 24/29] mm/page-flags: remove folio_mapping_flags()

2025-06-23 Thread Zi Yan
On 18 Jun 2025, at 13:40, David Hildenbrand wrote: > It's unused and the page counterpart is gone, so let's remove it. > > Signed-off-by: David Hildenbrand > --- > include/linux/page-flags.h | 5 - > 1 file changed, 5 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 27/29] docs/mm: convert from "Non-LRU page migration" to "movable_ops page migration"

2025-06-23 Thread Zi Yan
not reusing the PG_movable_ops and PG_movable_ops_isolated page flags > +for other purposes > + > +For example, balloon drivers can make use of this framework through the > +balloon-compaction framework residing in the core kernel. > > Monitoring Migration > = Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 20/29] mm: convert "movable" flag in page->mapping to a page flag

2025-06-23 Thread Zi Yan
pdesc(unsigned long pfn) > > static inline void __zpdesc_set_movable(struct zpdesc *zpdesc) > { > - __SetPageMovable(zpdesc_page(zpdesc)); > + SetPageMovableOps(zpdesc_page(zpdesc)); > } > > static inline void __zpdesc_set_zsmalloc(struct zpdesc *zpdesc) > -- > 2.49.0 Otherwise, LGTM. Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 21/29] mm: rename PG_isolated to PG_movable_ops_isolated

2025-06-23 Thread Zi Yan
h | 16 +++- > mm/compaction.c| 2 +- > mm/migrate.c | 14 +++--- > 3 files changed, 19 insertions(+), 13 deletions(-) > Reviewed-by: Zi Yan -- Best Regards, Yan, Zi

Re: [PATCH RFC 04/29] mm/page_alloc: allow for making page types sticky until freed

2025-06-23 Thread Zi Yan
On 23 Jun 2025, at 11:26, David Hildenbrand wrote: > On 18.06.25 20:08, Zi Yan wrote: >> On 18 Jun 2025, at 14:04, Zi Yan wrote: >> >>> On 18 Jun 2025, at 13:39, David Hildenbrand wrote: >>> >>>> Let's allow for not clearing a page type before

Re: [PATCH RFC 07/29] mm/migrate: rename isolate_movable_page() to isolate_movable_ops_page()

2025-06-23 Thread Zi Yan
On 23 Jun 2025, at 11:33, David Hildenbrand wrote: > On 18.06.25 20:48, Zi Yan wrote: >> On 18 Jun 2025, at 14:39, Matthew Wilcox wrote: >> >>> On Wed, Jun 18, 2025 at 02:14:15PM -0400, Zi Yan wrote: >>>> On 18 Jun 2025, at 13:39, David Hildenbrand wrote: >

Re: [PATCH RFC 05/29] mm/balloon_compaction: make PageOffline sticky

2025-06-23 Thread Zi Yan
On 23 Jun 2025, at 11:28, David Hildenbrand wrote: > On 18.06.25 20:50, Zi Yan wrote: >> On 18 Jun 2025, at 13:39, David Hildenbrand wrote: >> >>> Let the buddy handle clearing the type. >> >> The below might be more precise? Since page type is cleared &

Re: [PATCH RFC 16/29] mm: rename __PageMovable() to page_has_movable_ops()

2025-06-23 Thread Zi Yan
On 23 Jun 2025, at 11:47, David Hildenbrand wrote: > On 20.06.25 22:37, Zi Yan wrote: >> On 18 Jun 2025, at 13:39, David Hildenbrand wrote: >> >>> Let's make it clearer that we are talking about movable_ops pages. >>> >>> Signed-off-by: David Hil

Re: [PATCH v1 05/29] mm/balloon_compaction: make PageOffline sticky until the page is freed

2025-06-30 Thread Zi Yan
On 30 Jun 2025, at 12:01, Lorenzo Stoakes wrote: > On Mon, Jun 30, 2025 at 02:59:46PM +0200, David Hildenbrand wrote: >> Let the page freeing code handle clearing the page type. > > Why is this advantageous? We want to keep the page marked offline for longer? > >> >>

Re: [PATCH v1 08/29] mm/migrate: rename putback_movable_folio() to putback_movable_ops_page()

2025-07-01 Thread Zi Yan
brand > --- > mm/migrate.c | 37 - > 1 file changed, 24 insertions(+), 13 deletions(-) > Reviewed-by: Zi Yan Best Regards, Yan, Zi