[PATCH v1 36/36] mm: remove nth_page()

David Hildenbrand posted 36 patches 1 month ago
There is a newer version of this series
[PATCH v1 36/36] mm: remove nth_page()
Posted by David Hildenbrand 1 month ago
Now that all users are gone, let's remove it.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 include/linux/mm.h                   | 2 --
 tools/testing/scatterlist/linux/mm.h | 1 -
 2 files changed, 3 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2ca1eb2db63ec..b26ca8b2162d9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -210,9 +210,7 @@ extern unsigned long sysctl_admin_reserve_kbytes;
 
 #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
 bool page_range_contiguous(const struct page *page, unsigned long nr_pages);
-#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
 #else
-#define nth_page(page,n) ((page) + (n))
 static inline bool page_range_contiguous(const struct page *page,
 		unsigned long nr_pages)
 {
diff --git a/tools/testing/scatterlist/linux/mm.h b/tools/testing/scatterlist/linux/mm.h
index 5bd9e6e806254..121ae78d6e885 100644
--- a/tools/testing/scatterlist/linux/mm.h
+++ b/tools/testing/scatterlist/linux/mm.h
@@ -51,7 +51,6 @@ static inline unsigned long page_to_phys(struct page *page)
 
 #define page_to_pfn(page) ((unsigned long)(page) / PAGE_SIZE)
 #define pfn_to_page(pfn) (void *)((pfn) * PAGE_SIZE)
-#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
 
 #define __min(t1, t2, min1, min2, x, y) ({              \
 	t1 min1 = (x);                                  \
-- 
2.50.1
Re: [PATCH v1 36/36] mm: remove nth_page()
Posted by Lorenzo Stoakes 1 month ago
On Thu, Aug 28, 2025 at 12:01:40AM +0200, David Hildenbrand wrote:
> Now that all users are gone, let's remove it.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>

HAPPY DAYYS!!!!

Happy to have reached this bit, great work! :)

LGTM, so:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  include/linux/mm.h                   | 2 --
>  tools/testing/scatterlist/linux/mm.h | 1 -
>  2 files changed, 3 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 2ca1eb2db63ec..b26ca8b2162d9 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -210,9 +210,7 @@ extern unsigned long sysctl_admin_reserve_kbytes;
>
>  #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
>  bool page_range_contiguous(const struct page *page, unsigned long nr_pages);
> -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
>  #else
> -#define nth_page(page,n) ((page) + (n))
>  static inline bool page_range_contiguous(const struct page *page,
>  		unsigned long nr_pages)
>  {
> diff --git a/tools/testing/scatterlist/linux/mm.h b/tools/testing/scatterlist/linux/mm.h
> index 5bd9e6e806254..121ae78d6e885 100644
> --- a/tools/testing/scatterlist/linux/mm.h
> +++ b/tools/testing/scatterlist/linux/mm.h
> @@ -51,7 +51,6 @@ static inline unsigned long page_to_phys(struct page *page)
>
>  #define page_to_pfn(page) ((unsigned long)(page) / PAGE_SIZE)
>  #define pfn_to_page(pfn) (void *)((pfn) * PAGE_SIZE)
> -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
>
>  #define __min(t1, t2, min1, min2, x, y) ({              \
>  	t1 min1 = (x);                                  \
> --
> 2.50.1
>
Re: [PATCH v1 36/36] mm: remove nth_page()
Posted by David Hildenbrand 1 month ago
On 28.08.25 20:25, Lorenzo Stoakes wrote:
> On Thu, Aug 28, 2025 at 12:01:40AM +0200, David Hildenbrand wrote:
>> Now that all users are gone, let's remove it.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
> 
> HAPPY DAYYS!!!!
> 
> Happy to have reached this bit, great work! :)

I was just as happy when I made it to the end of this series :)

Thanks for all the review!!

-- 
Cheers

David / dhildenb