linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] mm: remove arch_make_page_accessible()
@ 2024-07-29 18:38 David Hildenbrand
  2024-07-29 18:38 ` [PATCH v1 1/3] mm: simplify arch_make_folio_accessible() David Hildenbrand
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Hildenbrand @ 2024-07-29 18:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, linux-s390, kvm, David Hildenbrand, Andrew Morton,
	Matthew Wilcox, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank,
	Claudio Imbrenda

Now that s390x implements arch_make_folio_accessible(), let's convert
remaining users to use arch_make_folio_accessible() instead so we can
remove arch_make_page_accessible().

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>

David Hildenbrand (3):
  mm: simplify arch_make_folio_accessible()
  mm/gup: convert to arch_make_folio_accessible()
  s390/uv: drop arch_make_page_accessible()

 arch/s390/include/asm/page.h |  2 --
 arch/s390/kernel/uv.c        |  5 -----
 include/linux/mm.h           | 18 +-----------------
 mm/gup.c                     |  8 +++++---
 4 files changed, 6 insertions(+), 27 deletions(-)


base-commit: 3bb434b9ff9bfeacf7f4aef6ae036146ae3c40cc
-- 
2.45.2



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

* [PATCH v1 1/3] mm: simplify arch_make_folio_accessible()
  2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
@ 2024-07-29 18:38 ` David Hildenbrand
  2024-07-29 18:38 ` [PATCH v1 2/3] mm/gup: convert to arch_make_folio_accessible() David Hildenbrand
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2024-07-29 18:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, linux-s390, kvm, David Hildenbrand, Andrew Morton,
	Matthew Wilcox, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank,
	Claudio Imbrenda

Now that s390x implements HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE, let's turn
generic arch_make_folio_accessible() into a NOP: there are no other
targets that implement HAVE_ARCH_MAKE_PAGE_ACCESSIBLE but not
HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 include/linux/mm.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 381750f41767a..bab689ec77f94 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2215,16 +2215,7 @@ static inline int arch_make_page_accessible(struct page *page)
 #ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE
 static inline int arch_make_folio_accessible(struct folio *folio)
 {
-	int ret;
-	long i, nr = folio_nr_pages(folio);
-
-	for (i = 0; i < nr; i++) {
-		ret = arch_make_page_accessible(folio_page(folio, i));
-		if (ret)
-			break;
-	}
-
-	return ret;
+	return 0;
 }
 #endif
 
-- 
2.45.2



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

* [PATCH v1 2/3] mm/gup: convert to arch_make_folio_accessible()
  2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
  2024-07-29 18:38 ` [PATCH v1 1/3] mm: simplify arch_make_folio_accessible() David Hildenbrand
@ 2024-07-29 18:38 ` David Hildenbrand
  2024-07-29 18:38 ` [PATCH v1 3/3] s390/uv: drop arch_make_page_accessible() David Hildenbrand
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2024-07-29 18:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, linux-s390, kvm, David Hildenbrand, Andrew Morton,
	Matthew Wilcox, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank,
	Claudio Imbrenda

Let's use arch_make_folio_accessible() instead so we can get rid of
arch_make_page_accessible().

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 mm/gup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 120740cf5a348..3e8484c893aa8 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -819,6 +819,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
 		struct dev_pagemap **pgmap)
 {
 	struct mm_struct *mm = vma->vm_mm;
+	struct folio *folio;
 	struct page *page;
 	spinlock_t *ptl;
 	pte_t *ptep, pte;
@@ -876,6 +877,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
 			goto out;
 		}
 	}
+	folio = page_folio(page);
 
 	if (!pte_write(pte) && gup_must_unshare(vma, flags, page)) {
 		page = ERR_PTR(-EMLINK);
@@ -886,7 +888,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
 		       !PageAnonExclusive(page), page);
 
 	/* try_grab_folio() does nothing unless FOLL_GET or FOLL_PIN is set. */
-	ret = try_grab_folio(page_folio(page), 1, flags);
+	ret = try_grab_folio(folio, 1, flags);
 	if (unlikely(ret)) {
 		page = ERR_PTR(ret);
 		goto out;
@@ -898,7 +900,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,
 	 * Documentation/core-api/pin_user_pages.rst for details.
 	 */
 	if (flags & FOLL_PIN) {
-		ret = arch_make_page_accessible(page);
+		ret = arch_make_folio_accessible(folio);
 		if (ret) {
 			unpin_user_page(page);
 			page = ERR_PTR(ret);
@@ -2919,7 +2921,7 @@ static int gup_fast_pte_range(pmd_t pmd, pmd_t *pmdp, unsigned long addr,
 		 * details.
 		 */
 		if (flags & FOLL_PIN) {
-			ret = arch_make_page_accessible(page);
+			ret = arch_make_folio_accessible(folio);
 			if (ret) {
 				gup_put_folio(folio, 1, flags);
 				goto pte_unmap;
-- 
2.45.2



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

* [PATCH v1 3/3] s390/uv: drop arch_make_page_accessible()
  2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
  2024-07-29 18:38 ` [PATCH v1 1/3] mm: simplify arch_make_folio_accessible() David Hildenbrand
  2024-07-29 18:38 ` [PATCH v1 2/3] mm/gup: convert to arch_make_folio_accessible() David Hildenbrand
@ 2024-07-29 18:38 ` David Hildenbrand
  2024-07-29 19:27 ` [PATCH v1 0/3] mm: remove arch_make_page_accessible() Matthew Wilcox
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2024-07-29 18:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, linux-s390, kvm, David Hildenbrand, Andrew Morton,
	Matthew Wilcox, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank,
	Claudio Imbrenda

All code was converted to using arch_make_folio_accessible(), let's drop
arch_make_page_accessible().

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/s390/include/asm/page.h | 2 --
 arch/s390/kernel/uv.c        | 5 -----
 include/linux/mm.h           | 7 -------
 3 files changed, 14 deletions(-)

diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 06416b3f94f59..515db8241eb6b 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -176,8 +176,6 @@ static inline int devmem_is_allowed(unsigned long pfn)
 
 int arch_make_folio_accessible(struct folio *folio);
 #define HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE
-int arch_make_page_accessible(struct page *page);
-#define HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
 
 struct vm_layout {
 	unsigned long kaslr_offset;
diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index 36db065c7cf75..35ed2aea88918 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -548,11 +548,6 @@ int arch_make_folio_accessible(struct folio *folio)
 }
 EXPORT_SYMBOL_GPL(arch_make_folio_accessible);
 
-int arch_make_page_accessible(struct page *page)
-{
-	return arch_make_folio_accessible(page_folio(page));
-}
-EXPORT_SYMBOL_GPL(arch_make_page_accessible);
 static ssize_t uv_query_facilities(struct kobject *kobj,
 				   struct kobj_attribute *attr, char *buf)
 {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bab689ec77f94..07b478952bb02 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2205,13 +2205,6 @@ static inline bool folio_likely_mapped_shared(struct folio *folio)
 	return atomic_read(&folio->_mapcount) > 0;
 }
 
-#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
-static inline int arch_make_page_accessible(struct page *page)
-{
-	return 0;
-}
-#endif
-
 #ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE
 static inline int arch_make_folio_accessible(struct folio *folio)
 {
-- 
2.45.2



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

* Re: [PATCH v1 0/3] mm: remove arch_make_page_accessible()
  2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
                   ` (2 preceding siblings ...)
  2024-07-29 18:38 ` [PATCH v1 3/3] s390/uv: drop arch_make_page_accessible() David Hildenbrand
@ 2024-07-29 19:27 ` Matthew Wilcox
  2024-07-30 10:39 ` Claudio Imbrenda
  2024-07-30 18:55 ` Vishal Moola
  5 siblings, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2024-07-29 19:27 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, linux-s390, kvm, Andrew Morton,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank,
	Claudio Imbrenda

On Mon, Jul 29, 2024 at 08:38:41PM +0200, David Hildenbrand wrote:
> Now that s390x implements arch_make_folio_accessible(), let's convert
> remaining users to use arch_make_folio_accessible() instead so we can
> remove arch_make_page_accessible().

For the series:

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>


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

* Re: [PATCH v1 0/3] mm: remove arch_make_page_accessible()
  2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
                   ` (3 preceding siblings ...)
  2024-07-29 19:27 ` [PATCH v1 0/3] mm: remove arch_make_page_accessible() Matthew Wilcox
@ 2024-07-30 10:39 ` Claudio Imbrenda
  2024-07-30 18:55 ` Vishal Moola
  5 siblings, 0 replies; 7+ messages in thread
From: Claudio Imbrenda @ 2024-07-30 10:39 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, linux-s390, kvm, Andrew Morton,
	Matthew Wilcox, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank

Thank you for taking care of this!


Whole series:

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>


On Mon, 29 Jul 2024 20:38:41 +0200
David Hildenbrand <david@redhat.com> wrote:

> Now that s390x implements arch_make_folio_accessible(), let's convert
> remaining users to use arch_make_folio_accessible() instead so we can
> remove arch_make_page_accessible().
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Alexander Gordeev <agordeev@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
> Cc: Sven Schnelle <svens@linux.ibm.com>
> Cc: Janosch Frank <frankja@linux.ibm.com>
> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
> 
> David Hildenbrand (3):
>   mm: simplify arch_make_folio_accessible()
>   mm/gup: convert to arch_make_folio_accessible()
>   s390/uv: drop arch_make_page_accessible()
> 
>  arch/s390/include/asm/page.h |  2 --
>  arch/s390/kernel/uv.c        |  5 -----
>  include/linux/mm.h           | 18 +-----------------
>  mm/gup.c                     |  8 +++++---
>  4 files changed, 6 insertions(+), 27 deletions(-)
> 
> 
> base-commit: 3bb434b9ff9bfeacf7f4aef6ae036146ae3c40cc



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

* Re: [PATCH v1 0/3] mm: remove arch_make_page_accessible()
  2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
                   ` (4 preceding siblings ...)
  2024-07-30 10:39 ` Claudio Imbrenda
@ 2024-07-30 18:55 ` Vishal Moola
  5 siblings, 0 replies; 7+ messages in thread
From: Vishal Moola @ 2024-07-30 18:55 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, linux-s390, kvm, Andrew Morton,
	Matthew Wilcox, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Janosch Frank,
	Claudio Imbrenda

On Mon, Jul 29, 2024 at 08:38:41PM +0200, David Hildenbrand wrote:
> Now that s390x implements arch_make_folio_accessible(), let's convert
> remaining users to use arch_make_folio_accessible() instead so we can
> remove arch_make_page_accessible().

For the whole series:

Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>


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

end of thread, other threads:[~2024-07-30 18:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-29 18:38 [PATCH v1 0/3] mm: remove arch_make_page_accessible() David Hildenbrand
2024-07-29 18:38 ` [PATCH v1 1/3] mm: simplify arch_make_folio_accessible() David Hildenbrand
2024-07-29 18:38 ` [PATCH v1 2/3] mm/gup: convert to arch_make_folio_accessible() David Hildenbrand
2024-07-29 18:38 ` [PATCH v1 3/3] s390/uv: drop arch_make_page_accessible() David Hildenbrand
2024-07-29 19:27 ` [PATCH v1 0/3] mm: remove arch_make_page_accessible() Matthew Wilcox
2024-07-30 10:39 ` Claudio Imbrenda
2024-07-30 18:55 ` Vishal Moola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox