]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/highmem: make nr_free_highpages() return "unsigned long"
authorDavid Hildenbrand <david@redhat.com>
Fri, 7 Jun 2024 08:37:11 +0000 (10:37 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:06 +0000 (19:30 -0700)
It looks rather weird that totalhigh_pages() returns an "unsigned long"
but nr_free_highpages() returns an "unsigned int".

Let's return an "unsigned long" from nr_free_highpages() to be consistent.

While at it, use a plain "0" instead of a "0UL" in the !CONFIG_HIGHMEM
totalhigh_pages() implementation, to make these look alike as well.

Link: https://lkml.kernel.org/r/20240607083711.62833-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/highmem-internal.h
include/linux/highmem.h
mm/highmem.c

index 65f865fbbac046a423c9c644b1a648145ddb5a9b..dd100e849f5e0a1c1e7b4cef5255848aa50daa3b 100644 (file)
@@ -131,10 +131,10 @@ static inline void __kunmap_atomic(const void *addr)
                preempt_enable();
 }
 
-unsigned int __nr_free_highpages(void);
+unsigned long __nr_free_highpages(void);
 unsigned long __totalhigh_pages(void);
 
-static inline unsigned int nr_free_highpages(void)
+static inline unsigned long nr_free_highpages(void)
 {
        return __nr_free_highpages();
 }
@@ -234,8 +234,8 @@ static inline void __kunmap_atomic(const void *addr)
                preempt_enable();
 }
 
-static inline unsigned int nr_free_highpages(void) { return 0; }
-static inline unsigned long totalhigh_pages(void) { return 0UL; }
+static inline unsigned long nr_free_highpages(void) { return 0; }
+static inline unsigned long totalhigh_pages(void) { return 0; }
 
 static inline bool is_kmap_addr(const void *x)
 {
index 00341b56d2910d6801ca65ffccb6830b507056bf..fa6891e063165c4767b321a4cd2e112ed0bd3c50 100644 (file)
@@ -179,7 +179,7 @@ static inline void *kmap_local_folio(struct folio *folio, size_t offset);
 static inline void *kmap_atomic(struct page *page);
 
 /* Highmem related interfaces for management code */
-static inline unsigned int nr_free_highpages(void);
+static inline unsigned long nr_free_highpages(void);
 static inline unsigned long totalhigh_pages(void);
 
 #ifndef ARCH_HAS_FLUSH_ANON_PAGE
index b14771fb05ed1f85b49f6f7365cefe2042cf1e22..ef3189b36cadbb047ec35fcfd473c4707aefda07 100644 (file)
@@ -111,10 +111,10 @@ static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color)
 }
 #endif
 
-unsigned int __nr_free_highpages(void)
+unsigned long __nr_free_highpages(void)
 {
+       unsigned long pages = 0;
        struct zone *zone;
-       unsigned int pages = 0;
 
        for_each_populated_zone(zone) {
                if (is_highmem(zone))