All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>
Cc: "Felix Kuehling" <Felix.Kuehling@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Lyude Paul" <lyude@redhat.com>, "Jason Gunthorpe" <jgg@ziepe.ca>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Logan Gunthorpe" <logang@deltatee.com>,
	"Ralph Campbell" <rcampbell@nvidia.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	nvdimm@lists.linux.dev, linux-mm@kvack.org
Subject: [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c
Date: Mon,  7 Feb 2022 07:32:45 +0100	[thread overview]
Message-ID: <20220207063249.1833066-5-hch@lst.de> (raw)
In-Reply-To: <20220207063249.1833066-1-hch@lst.de>

free_devmap_managed_page has nothing to do with the code in swap.c,
move it to live with the rest of the code for devmap handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/mm.h |  1 -
 mm/memremap.c      | 21 +++++++++++++++++++++
 mm/swap.c          | 23 -----------------------
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7b46174989b086..91dd0bc786a9ec 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1092,7 +1092,6 @@ static inline bool is_zone_movable_page(const struct page *page)
 }
 
 #ifdef CONFIG_DEV_PAGEMAP_OPS
-void free_devmap_managed_page(struct page *page);
 DECLARE_STATIC_KEY_FALSE(devmap_managed_key);
 
 static inline bool page_is_devmap_managed(struct page *page)
diff --git a/mm/memremap.c b/mm/memremap.c
index 5f04a0709e436e..55d23e9f5c04ec 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -501,4 +501,25 @@ void free_devmap_managed_page(struct page *page)
 	page->mapping = NULL;
 	page->pgmap->ops->page_free(page);
 }
+
+void put_devmap_managed_page(struct page *page)
+{
+	int count;
+
+	if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
+		return;
+
+	count = page_ref_dec_return(page);
+
+	/*
+	 * devmap page refcounts are 1-based, rather than 0-based: if
+	 * refcount is 1, then the page is free and the refcount is
+	 * stable because nobody holds a reference on the page.
+	 */
+	if (count == 1)
+		free_devmap_managed_page(page);
+	else if (!count)
+		__put_page(page);
+}
+EXPORT_SYMBOL(put_devmap_managed_page);
 #endif /* CONFIG_DEV_PAGEMAP_OPS */
diff --git a/mm/swap.c b/mm/swap.c
index bcf3ac288b56d5..08058f74cae23e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -1153,26 +1153,3 @@ void __init swap_setup(void)
 	 * _really_ don't want to cluster much more
 	 */
 }
-
-#ifdef CONFIG_DEV_PAGEMAP_OPS
-void put_devmap_managed_page(struct page *page)
-{
-	int count;
-
-	if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
-		return;
-
-	count = page_ref_dec_return(page);
-
-	/*
-	 * devmap page refcounts are 1-based, rather than 0-based: if
-	 * refcount is 1, then the page is free and the refcount is
-	 * stable because nobody holds a reference on the page.
-	 */
-	if (count == 1)
-		free_devmap_managed_page(page);
-	else if (!count)
-		__put_page(page);
-}
-EXPORT_SYMBOL(put_devmap_managed_page);
-#endif
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>
Cc: nvdimm@lists.linux.dev, "Ralph Campbell" <rcampbell@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
	nouveau@lists.freedesktop.org,
	"Felix Kuehling" <Felix.Kuehling@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Logan Gunthorpe" <logang@deltatee.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [Nouveau] [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c
Date: Mon,  7 Feb 2022 07:32:45 +0100	[thread overview]
Message-ID: <20220207063249.1833066-5-hch@lst.de> (raw)
In-Reply-To: <20220207063249.1833066-1-hch@lst.de>

free_devmap_managed_page has nothing to do with the code in swap.c,
move it to live with the rest of the code for devmap handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/mm.h |  1 -
 mm/memremap.c      | 21 +++++++++++++++++++++
 mm/swap.c          | 23 -----------------------
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7b46174989b086..91dd0bc786a9ec 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1092,7 +1092,6 @@ static inline bool is_zone_movable_page(const struct page *page)
 }
 
 #ifdef CONFIG_DEV_PAGEMAP_OPS
-void free_devmap_managed_page(struct page *page);
 DECLARE_STATIC_KEY_FALSE(devmap_managed_key);
 
 static inline bool page_is_devmap_managed(struct page *page)
diff --git a/mm/memremap.c b/mm/memremap.c
index 5f04a0709e436e..55d23e9f5c04ec 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -501,4 +501,25 @@ void free_devmap_managed_page(struct page *page)
 	page->mapping = NULL;
 	page->pgmap->ops->page_free(page);
 }
+
+void put_devmap_managed_page(struct page *page)
+{
+	int count;
+
+	if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
+		return;
+
+	count = page_ref_dec_return(page);
+
+	/*
+	 * devmap page refcounts are 1-based, rather than 0-based: if
+	 * refcount is 1, then the page is free and the refcount is
+	 * stable because nobody holds a reference on the page.
+	 */
+	if (count == 1)
+		free_devmap_managed_page(page);
+	else if (!count)
+		__put_page(page);
+}
+EXPORT_SYMBOL(put_devmap_managed_page);
 #endif /* CONFIG_DEV_PAGEMAP_OPS */
diff --git a/mm/swap.c b/mm/swap.c
index bcf3ac288b56d5..08058f74cae23e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -1153,26 +1153,3 @@ void __init swap_setup(void)
 	 * _really_ don't want to cluster much more
 	 */
 }
-
-#ifdef CONFIG_DEV_PAGEMAP_OPS
-void put_devmap_managed_page(struct page *page)
-{
-	int count;
-
-	if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
-		return;
-
-	count = page_ref_dec_return(page);
-
-	/*
-	 * devmap page refcounts are 1-based, rather than 0-based: if
-	 * refcount is 1, then the page is free and the refcount is
-	 * stable because nobody holds a reference on the page.
-	 */
-	if (count == 1)
-		free_devmap_managed_page(page);
-	else if (!count)
-		__put_page(page);
-}
-EXPORT_SYMBOL(put_devmap_managed_page);
-#endif
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>
Cc: nvdimm@lists.linux.dev, "Ralph Campbell" <rcampbell@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	dri-devel@lists.freedesktop.org,
	"Karol Herbst" <kherbst@redhat.com>,
	linux-mm@kvack.org, nouveau@lists.freedesktop.org,
	"Felix Kuehling" <Felix.Kuehling@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Logan Gunthorpe" <logang@deltatee.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c
Date: Mon,  7 Feb 2022 07:32:45 +0100	[thread overview]
Message-ID: <20220207063249.1833066-5-hch@lst.de> (raw)
In-Reply-To: <20220207063249.1833066-1-hch@lst.de>

free_devmap_managed_page has nothing to do with the code in swap.c,
move it to live with the rest of the code for devmap handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/mm.h |  1 -
 mm/memremap.c      | 21 +++++++++++++++++++++
 mm/swap.c          | 23 -----------------------
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7b46174989b086..91dd0bc786a9ec 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1092,7 +1092,6 @@ static inline bool is_zone_movable_page(const struct page *page)
 }
 
 #ifdef CONFIG_DEV_PAGEMAP_OPS
-void free_devmap_managed_page(struct page *page);
 DECLARE_STATIC_KEY_FALSE(devmap_managed_key);
 
 static inline bool page_is_devmap_managed(struct page *page)
diff --git a/mm/memremap.c b/mm/memremap.c
index 5f04a0709e436e..55d23e9f5c04ec 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -501,4 +501,25 @@ void free_devmap_managed_page(struct page *page)
 	page->mapping = NULL;
 	page->pgmap->ops->page_free(page);
 }
+
+void put_devmap_managed_page(struct page *page)
+{
+	int count;
+
+	if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
+		return;
+
+	count = page_ref_dec_return(page);
+
+	/*
+	 * devmap page refcounts are 1-based, rather than 0-based: if
+	 * refcount is 1, then the page is free and the refcount is
+	 * stable because nobody holds a reference on the page.
+	 */
+	if (count == 1)
+		free_devmap_managed_page(page);
+	else if (!count)
+		__put_page(page);
+}
+EXPORT_SYMBOL(put_devmap_managed_page);
 #endif /* CONFIG_DEV_PAGEMAP_OPS */
diff --git a/mm/swap.c b/mm/swap.c
index bcf3ac288b56d5..08058f74cae23e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -1153,26 +1153,3 @@ void __init swap_setup(void)
 	 * _really_ don't want to cluster much more
 	 */
 }
-
-#ifdef CONFIG_DEV_PAGEMAP_OPS
-void put_devmap_managed_page(struct page *page)
-{
-	int count;
-
-	if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
-		return;
-
-	count = page_ref_dec_return(page);
-
-	/*
-	 * devmap page refcounts are 1-based, rather than 0-based: if
-	 * refcount is 1, then the page is free and the refcount is
-	 * stable because nobody holds a reference on the page.
-	 */
-	if (count == 1)
-		free_devmap_managed_page(page);
-	else if (!count)
-		__put_page(page);
-}
-EXPORT_SYMBOL(put_devmap_managed_page);
-#endif
-- 
2.30.2


  parent reply	other threads:[~2022-02-07  6:33 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07  6:32 start sorting out the ZONE_DEVICE refcount mess Christoph Hellwig
2022-02-07  6:32 ` Christoph Hellwig
2022-02-07  6:32 ` [Nouveau] " Christoph Hellwig
2022-02-07  6:32 ` [PATCH 1/8] mm: remove a pointless CONFIG_ZONE_DEVICE check in memremap_pages Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 18:08   ` Dan Williams
2022-02-07 18:08     ` Dan Williams
2022-02-07 18:08     ` [Nouveau] " Dan Williams
2022-02-07 19:22   ` Jason Gunthorpe
2022-02-07 19:22     ` Jason Gunthorpe
2022-02-07 19:22     ` [Nouveau] " Jason Gunthorpe
2022-02-08  7:17   ` Chaitanya Kulkarni
2022-02-08  7:17     ` [Nouveau] " Chaitanya Kulkarni
2022-02-08  7:17     ` Chaitanya Kulkarni
2022-02-08  8:06   ` Muchun Song
2022-02-08  8:06     ` [Nouveau] " Muchun Song
2022-02-08  8:06     ` Muchun Song
2022-02-07  6:32 ` [PATCH 2/8] mm: remove the __KERNEL__ guard from <linux/mm.h> Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 18:08   ` Dan Williams
2022-02-07 18:08     ` Dan Williams
2022-02-07 18:08     ` [Nouveau] " Dan Williams
2022-02-07 19:26   ` Jason Gunthorpe
2022-02-07 19:26     ` [Nouveau] " Jason Gunthorpe
2022-02-07 19:26     ` Jason Gunthorpe
2022-02-08  7:21   ` Chaitanya Kulkarni
2022-02-08  7:21     ` [Nouveau] " Chaitanya Kulkarni
2022-02-08  7:21     ` Chaitanya Kulkarni
2022-02-08  8:07   ` Muchun Song
2022-02-08  8:07     ` [Nouveau] " Muchun Song
2022-02-08  8:07     ` Muchun Song
2022-02-07  6:32 ` [PATCH 3/8] mm: remove pointless includes from <linux/hmm.h> Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 14:01   ` Jason Gunthorpe
2022-02-07 14:01     ` Jason Gunthorpe
2022-02-07 14:01     ` [Nouveau] " Jason Gunthorpe
2022-02-08  7:27   ` Chaitanya Kulkarni
2022-02-08  7:27     ` [Nouveau] " Chaitanya Kulkarni
2022-02-08  7:27     ` Chaitanya Kulkarni
2022-02-07  6:32 ` Christoph Hellwig [this message]
2022-02-07  6:32   ` [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 19:06   ` Dan Williams
2022-02-07 19:06     ` Dan Williams
2022-02-07 19:06     ` [Nouveau] " Dan Williams
2022-02-07 19:27   ` Jason Gunthorpe
2022-02-07 19:27     ` Jason Gunthorpe
2022-02-07 19:27     ` [Nouveau] " Jason Gunthorpe
2022-02-08  7:34   ` Chaitanya Kulkarni
2022-02-08  7:34     ` [Nouveau] " Chaitanya Kulkarni
2022-02-08  7:34     ` Chaitanya Kulkarni
2022-02-08  8:09   ` Muchun Song
2022-02-08  8:09     ` [Nouveau] " Muchun Song
2022-02-08  8:09     ` Muchun Song
2022-02-07  6:32 ` [PATCH 5/8] mm: simplify freeing of devmap managed pages Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 19:34   ` Jason Gunthorpe
2022-02-07 19:34     ` Jason Gunthorpe
2022-02-07 19:34     ` [Nouveau] " Jason Gunthorpe
2022-02-07 23:42   ` Dan Williams
2022-02-07 23:42     ` Dan Williams
2022-02-07 23:42     ` [Nouveau] " Dan Williams
2022-02-08  7:50   ` Chaitanya Kulkarni
2022-02-08  7:50     ` [Nouveau] " Chaitanya Kulkarni
2022-02-08  7:50     ` Chaitanya Kulkarni
2022-02-07  6:32 ` [PATCH 6/8] mm: don't include <linux/memremap.h> in <linux/mm.h> Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 17:38   ` Logan Gunthorpe
2022-02-07 17:38     ` Logan Gunthorpe
2022-02-07 17:38     ` [Nouveau] " Logan Gunthorpe
2022-02-07 19:35   ` Jason Gunthorpe
2022-02-07 19:35     ` Jason Gunthorpe
2022-02-07 19:35     ` [Nouveau] " Jason Gunthorpe
2022-02-07 21:19   ` Felix Kuehling
2022-02-07 21:19     ` Felix Kuehling
2022-02-07 21:19     ` [Nouveau] " Felix Kuehling
2022-02-08  6:46     ` Christoph Hellwig
2022-02-08  6:46       ` Christoph Hellwig
2022-02-08  6:46       ` [Nouveau] " Christoph Hellwig
2022-02-09 17:48     ` Christoph Hellwig
2022-02-09 17:48       ` Christoph Hellwig
2022-02-09 17:48       ` [Nouveau] " Christoph Hellwig
2022-02-10  2:10       ` Alistair Popple
2022-02-10  2:10         ` Alistair Popple
2022-02-10  2:10         ` [Nouveau] " Alistair Popple
2022-02-10  6:45         ` Christoph Hellwig
2022-02-10  6:45           ` Christoph Hellwig
2022-02-10  6:45           ` [Nouveau] " Christoph Hellwig
2022-02-10 21:00       ` Felix Kuehling
2022-02-10 21:00         ` Felix Kuehling
2022-02-10 21:00         ` [Nouveau] " Felix Kuehling
2022-02-07 23:49   ` Dan Williams
2022-02-07 23:49     ` Dan Williams
2022-02-07 23:49     ` [Nouveau] " Dan Williams
2022-02-08 23:53     ` Dan Williams
2022-02-08 23:53       ` Dan Williams
2022-02-08 23:53       ` [Nouveau] " Dan Williams
2022-02-09  6:22       ` Christoph Hellwig
2022-02-09  6:22         ` Christoph Hellwig
2022-02-09  6:22         ` [Nouveau] " Christoph Hellwig
2022-02-07  6:32 ` [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 19:21   ` Jason Gunthorpe
2022-02-07 19:21     ` Jason Gunthorpe
2022-02-07 19:21     ` [Nouveau] " Jason Gunthorpe
2022-02-08  2:25   ` Ralph Campbell
2022-02-08  2:25     ` Ralph Campbell
2022-02-08  2:25     ` [Nouveau] " Ralph Campbell
2022-02-09  3:30   ` Dan Williams
2022-02-09  3:30     ` Dan Williams
2022-02-09  3:30     ` [Nouveau] " Dan Williams
2022-02-09  6:23     ` Christoph Hellwig
2022-02-09  6:23       ` Christoph Hellwig
2022-02-09  6:23       ` [Nouveau] " Christoph Hellwig
2022-02-09 12:29       ` Jason Gunthorpe
2022-02-09 12:29         ` [Nouveau] " Jason Gunthorpe
2022-02-09 12:29         ` Jason Gunthorpe
2022-02-09 13:53         ` Christoph Hellwig
2022-02-09 13:53           ` Christoph Hellwig
2022-02-09 13:53           ` [Nouveau] " Christoph Hellwig
2022-02-09 14:14           ` Jason Gunthorpe
2022-02-09 14:14             ` Jason Gunthorpe
2022-02-09 14:14             ` [Nouveau] " Jason Gunthorpe
2022-02-07  6:32 ` [PATCH 8/8] fsdax: depend on ZONE_DEVICE || FS_DAX_LIMITED Christoph Hellwig
2022-02-07  6:32   ` Christoph Hellwig
2022-02-07  6:32   ` [Nouveau] " Christoph Hellwig
2022-02-07 19:36   ` Jason Gunthorpe
2022-02-07 19:36     ` Jason Gunthorpe
2022-02-07 19:36     ` [Nouveau] " Jason Gunthorpe
2022-02-07 23:51 ` start sorting out the ZONE_DEVICE refcount mess Logan Gunthorpe
2022-02-07 23:51   ` Logan Gunthorpe
2022-02-07 23:51   ` [Nouveau] " Logan Gunthorpe
2022-02-08  3:03 ` Miaohe Lin
2022-02-08  3:03   ` [Nouveau] " Miaohe Lin
2022-02-08  3:03   ` Miaohe Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220207063249.1833066-5-hch@lst.de \
    --to=hch@lst.de \
    --cc=Felix.Kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=apopple@nvidia.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@ziepe.ca \
    --cc=kherbst@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=logang@deltatee.com \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=rcampbell@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.