All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch
@ 2023-01-24 21:53 Andrew Morton
  2023-01-24 21:56 ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2023-01-24 21:53 UTC (permalink / raw)
  To: mm-commits, willy, vishal.moola, akpm


The patch titled
     Subject: mm: add folio_estimated_mapcount()
has been added to the -mm mm-unstable branch.  Its filename is
     mm-add-folio_estimated_mapcount.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-add-folio_estimated_mapcount.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: mm: add folio_estimated_mapcount()
Date: Mon, 23 Jan 2023 17:22:05 -0800

Patch series "Convert various mempolicy.c functions", v2.

This patch series converts migrate_page_add() and queue_pages_required()
to migrate_folio_add() and queue_page_required().  It also converts the
callers of the functions to use folios as well, and introduces a helper
function to estimate a folio's mapcount.


This patch (of 6):

folio_estimated_mapcount() takes in a folio and calls page_mapcount() on
the first page of that folio.

This is necessary for folio conversions where we only care about either the
entire_mapcount of a large folio, or the mapcount of a not large folio.

This is in contrast to folio_mapcount() which calculates the total
number of the times a folio and its subpages are mapped.

Link: https://lkml.kernel.org/r/20230124012210.13963-1-vishal.moola@gmail.com
Link: https://lkml.kernel.org/r/20230124012210.13963-2-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/mm.h |    5 +++++
 1 file changed, 5 insertions(+)

--- a/include/linux/mm.h~mm-add-folio_estimated_mapcount
+++ a/include/linux/mm.h
@@ -913,6 +913,11 @@ static inline int page_mapcount(struct p
 	return mapcount;
 }
 
+static inline int folio_estimated_mapcount(struct folio *folio)
+{
+	return page_mapcount(folio_page(folio, 0));
+}
+
 int folio_total_mapcount(struct folio *folio);
 
 /**
_

Patches currently in -mm which might be from vishal.moola@gmail.com are

mm-khugepaged-introduce-release_pte_folio-to-replace-release_pte_page.patch
mm-khugepaged-convert-release_pte_pages-to-use-folios.patch
pagemap-add-filemap_grab_folio.patch
filemap-added-filemap_get_folios_tag.patch
filemap-convert-__filemap_fdatawait_range-to-use-filemap_get_folios_tag.patch
page-writeback-convert-write_cache_pages-to-use-filemap_get_folios_tag.patch
afs-convert-afs_writepages_region-to-use-filemap_get_folios_tag.patch
btrfs-convert-btree_write_cache_pages-to-use-filemap_get_folio_tag.patch
btrfs-convert-extent_write_cache_pages-to-use-filemap_get_folios_tag.patch
ceph-convert-ceph_writepages_start-to-use-filemap_get_folios_tag.patch
cifs-convert-wdata_alloc_and_fillpages-to-use-filemap_get_folios_tag.patch
ext4-convert-mpage_prepare_extent_to_map-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_fsync_node_pages-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_flush_inline_data-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_sync_node_pages-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_write_cache_pages-to-use-filemap_get_folios_tag.patch
f2fs-convert-last_fsync_dnode-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_sync_meta_pages-to-use-filemap_get_folios_tag.patch
gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_lookup_dirty_node_buffers-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_btree_lookup_dirty_buffers-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_copy_dirty_pages-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_clear_dirty_pages-to-use-filemap_get_folios_tag.patch
filemap-remove-find_get_pages_range_tag.patch
mm-add-folio_estimated_mapcount.patch
mm-mempolicy-convert-queue_pages_pmd-to-queue_folios_pmd.patch
mm-mempolicy-convert-queue_pages_pte_range-to-queue_folios_pte_range.patch
mm-mempolicy-convert-queue_pages_hugetlb-to-queue_folios_hugetlb.patch
mm-mempolicy-convert-queue_pages_required-to-queue_folio_required.patch
mm-mempolicy-convert-migrate_page_add-to-migrate_folio_add.patch


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

* Re: + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch
  2023-01-24 21:53 + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch Andrew Morton
@ 2023-01-24 21:56 ` Matthew Wilcox
  2023-01-24 22:15   ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2023-01-24 21:56 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, vishal.moola

On Tue, Jan 24, 2023 at 01:53:04PM -0800, Andrew Morton wrote:
> 
> The patch titled
>      Subject: mm: add folio_estimated_mapcount()
> has been added to the -mm mm-unstable branch.  Its filename is
>      mm-add-folio_estimated_mapcount.patch

Um, there was a build breakage report from one of the bots on this
patch.  Probably better to hold off on this series for now.

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

* Re: + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch
  2023-01-24 21:56 ` Matthew Wilcox
@ 2023-01-24 22:15   ` Andrew Morton
  2023-01-24 22:35     ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2023-01-24 22:15 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: mm-commits, vishal.moola

On Tue, 24 Jan 2023 21:56:14 +0000 Matthew Wilcox <willy@infradead.org> wrote:

> On Tue, Jan 24, 2023 at 01:53:04PM -0800, Andrew Morton wrote:
> > 
> > The patch titled
> >      Subject: mm: add folio_estimated_mapcount()
> > has been added to the -mm mm-unstable branch.  Its filename is
> >      mm-add-folio_estimated_mapcount.patch
> 
> Um, there was a build breakage report from one of the bots on this
> patch.  Probably better to hold off on this series for now.

It was only arch/alpha ;)  Presumably the usual header file
mess.  

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

* Re: + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch
  2023-01-24 22:15   ` Andrew Morton
@ 2023-01-24 22:35     ` Matthew Wilcox
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2023-01-24 22:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, vishal.moola

On Tue, Jan 24, 2023 at 02:15:27PM -0800, Andrew Morton wrote:
> On Tue, 24 Jan 2023 21:56:14 +0000 Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Tue, Jan 24, 2023 at 01:53:04PM -0800, Andrew Morton wrote:
> > > 
> > > The patch titled
> > >      Subject: mm: add folio_estimated_mapcount()
> > > has been added to the -mm mm-unstable branch.  Its filename is
> > >      mm-add-folio_estimated_mapcount.patch
> > 
> > Um, there was a build breakage report from one of the bots on this
> > patch.  Probably better to hold off on this series for now.
> 
> It was only arch/alpha ;)  Presumably the usual header file
> mess.  

I predict there will be more ;-)  page_pfn() / pfn_page() is dangerous
(and in this case, hidden).

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

* + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch
@ 2023-01-26  0:19 Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2023-01-26  0:19 UTC (permalink / raw)
  To: mm-commits, willy, vishal.moola, akpm


The patch titled
     Subject: mm: add folio_estimated_mapcount()
has been added to the -mm mm-unstable branch.  Its filename is
     mm-add-folio_estimated_mapcount.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-add-folio_estimated_mapcount.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: mm: add folio_estimated_mapcount()
Date: Wed, 25 Jan 2023 15:41:29 -0800

Patch series "Convert various mempolicy.c functions to use folios", v3.

This patch series converts migrate_page_add() and queue_pages_required()
to migrate_folio_add() and queue_page_required().  It also converts the
callers of the functions to use folios as well, and introduces a helper
function to estimate a folio's mapcount.


This patch (of 6):

folio_estimated_mapcount() takes in a folio and returns the precise
number of times the first subpage of the folio is mapped.

This function aims to provide an estimate for the mapcount of a subpage
within a folio. This is necessary for folio conversions where we care
about the mapcount of a subpage, but not necessarily the whole folio.

This is in contrast to folio_mapcount() which calculates the total
number of the times a folio and all its subpages are mapped.

Link: https://lkml.kernel.org/r/20230125234134.227244-1-vishal.moola@gmail.com
Link: https://lkml.kernel.org/r/20230125234134.227244-2-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---


--- a/include/linux/mm.h~mm-add-folio_estimated_mapcount
+++ a/include/linux/mm.h
@@ -1855,6 +1855,23 @@ static inline size_t folio_size(struct f
 	return PAGE_SIZE << folio_order(folio);
 }
 
+/**
+ * folio_estimated_mapcount - Estimate a folio's per-page mapcount.
+ * @folio: The folio.
+ *
+ * folio_estimated_mapcount() aims to serve as a function to efficiently
+ * estimate the number of times each page in a folio is mapped.
+ * This may not be accurate for large folios. If you want exact mapcounts,
+ * look at page_mapcount() or folio_total_mapcount().
+ *
+ * Return: The precise mapcount of the first subpage, meant to estimate
+ * the precise mapcount of any subpage.
+ */
+static inline int folio_estimated_mapcount(struct folio *folio)
+{
+	return page_mapcount(folio_page(folio, 0));
+}
+
 #ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
 static inline int arch_make_page_accessible(struct page *page)
 {
_

Patches currently in -mm which might be from vishal.moola@gmail.com are

mm-khugepaged-introduce-release_pte_folio-to-replace-release_pte_page.patch
mm-khugepaged-convert-release_pte_pages-to-use-folios.patch
pagemap-add-filemap_grab_folio.patch
filemap-added-filemap_get_folios_tag.patch
filemap-convert-__filemap_fdatawait_range-to-use-filemap_get_folios_tag.patch
page-writeback-convert-write_cache_pages-to-use-filemap_get_folios_tag.patch
afs-convert-afs_writepages_region-to-use-filemap_get_folios_tag.patch
btrfs-convert-btree_write_cache_pages-to-use-filemap_get_folio_tag.patch
btrfs-convert-extent_write_cache_pages-to-use-filemap_get_folios_tag.patch
ceph-convert-ceph_writepages_start-to-use-filemap_get_folios_tag.patch
cifs-convert-wdata_alloc_and_fillpages-to-use-filemap_get_folios_tag.patch
ext4-convert-mpage_prepare_extent_to_map-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_fsync_node_pages-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_flush_inline_data-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_sync_node_pages-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_write_cache_pages-to-use-filemap_get_folios_tag.patch
f2fs-convert-last_fsync_dnode-to-use-filemap_get_folios_tag.patch
f2fs-convert-f2fs_sync_meta_pages-to-use-filemap_get_folios_tag.patch
gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_lookup_dirty_node_buffers-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_btree_lookup_dirty_buffers-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_copy_dirty_pages-to-use-filemap_get_folios_tag.patch
nilfs2-convert-nilfs_clear_dirty_pages-to-use-filemap_get_folios_tag.patch
filemap-remove-find_get_pages_range_tag.patch
mm-add-folio_estimated_mapcount.patch
mm-mempolicy-convert-queue_pages_pmd-to-queue_folios_pmd.patch
mm-mempolicy-convert-queue_pages_pte_range-to-queue_folios_pte_range.patch
mm-mempolicy-convert-queue_pages_hugetlb-to-queue_folios_hugetlb.patch
mm-mempolicy-convert-queue_pages_required-to-queue_folio_required.patch
mm-mempolicy-convert-migrate_page_add-to-migrate_folio_add.patch


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

end of thread, other threads:[~2023-01-26  0:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 21:53 + mm-add-folio_estimated_mapcount.patch added to mm-unstable branch Andrew Morton
2023-01-24 21:56 ` Matthew Wilcox
2023-01-24 22:15   ` Andrew Morton
2023-01-24 22:35     ` Matthew Wilcox
2023-01-26  0:19 Andrew Morton

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.