Skip to contentSkip to conversation

mmzone.h: fix kernel-doc and simplify is_highmem_idx

PATCH Applied Mike Rapoport 1 participant 3 messages Apr 26, 2021

Subsystems (5)
lore
Share & tools
lore

Mike Rapoport

author reviewer
#0 lore raw

v2 cover mmzone.h: fix kernel-doc and simplify is_highmem_idx

From: Mike Rapoport <[email protected]>

Hi,

There are several kernel-doc comments in include/linux/mmzone.h, but they have some formatting issues and they are not linked to the rest of the documentation.

The first patch here fixes the formatting and adds the kernel-doc comments to the core-api/mm-api.rst.

The second patch simplifies a bit detection if a zone is a highmem zone. It does not generally depends on the first one, but they have a textual conflict.

v2:
* rebase on v5.12-rc8-mmots-2021-04-21-23-08
* add Reviewed-by tags, thanks Anshuman and Matthew

v1: Link: /home/mike/tmp/mm-docs/mmzone/v2/v2-0000-cover-letter.patch

Mike Rapoport (2):
mm/mmzone.h: fix existing kernel-doc comments and link them to core-api mm/mmzone.h: simplify is_highmem_idx()

 Documentation/core-api/mm-api.rst |  1 +
 include/linux/mmzone.h            | 56 ++++++++++++++-----------------
 2 files changed, 26 insertions(+), 31 deletions(-)

base-commit: 5770176c2a0eaa998c58cfc7a9a5fe5b9291dd2a

Signature · 1 line
2.29.2
author reviewer
#1 lore raw

PATCH v2 1/2 mm/mmzone.h: fix existing kernel-doc comments and link them to core-api

From: Mike Rapoport <[email protected]>

There are a couple of kernel-doc comments in include/linux/mmzone.h but they have minor formatting issues that would cause kernel-doc warnings.

Fix the formatting of those comments, add missing Return: descriptions and link include/linux/mmzone.h to Documentation/core-api/mm-api.rst

---
 Documentation/core-api/mm-api.rst |  1 +
 include/linux/mmzone.h            | 43 +++++++++++++++++--------------
 2 files changed, 25 insertions(+), 19 deletions(-)
Documentation/core-api/mm-api.rst +1 -0
index 34f46df91a8b..a42f9baddfbf 100644
@@ -97,3 +97,4 @@ More Memory Management Functions
    :internal:
 .. kernel-doc:: include/linux/mm.h
    :internal:
+.. kernel-doc:: include/linux/mmzone.h
include/linux/mmzone.h +24 -19

97 lines not on this page · raw message

Signature · 1 line
2.29.2
author reviewer
#2 lore raw

PATCH v2 2/2 mm/mmzone.h: simplify is_highmem_idx()

In reply to Mike Rapoport

From: Mike Rapoport <[email protected]>

There is a lot of historical ifdefery in is_highmem_idx() and its helper zone_movable_is_highmem() that was required because of two different paths for nodes and zones initialization that were selected at compile time.

Until commit 3f08a302f533 ("mm: remove CONFIG_HAVE_MEMBLOCK_NODE_MAP option") the movable_zone variable was only available for configurations that had CONFIG_HAVE_MEMBLOCK_NODE_MAP enabled so the test in zone_movable_is_highmem() used that variable only for such configurations. For other configurations the test checked if the index of ZONE_MOVABLE was greater by 1 than the index of ZONE_HIGMEM and then movable zone was considered a highmem zone. Needless to say, ZONE_MOVABLE - 1 equals ZONE_HIGHMEM by definition when CONFIG_HIGHMEM=y.

Commit 3f08a302f533 ("mm: remove CONFIG_HAVE_MEMBLOCK_NODE_MAP option") made movable_zone variable always available. Since this variable is set to ZONE_HIGHMEM if CONFIG_HIGHMEM is enabled and highmem zone is populated, it is enough to check whether

	zone_idx == ZONE_MOVABLE && movable_zone == ZONE_HIGMEM

to test if zone index points to a highmem zone.

Remove zone_movable_is_highmem() that is not used anywhere except is_highmem_idx() and use the test above in is_highmem_idx() instead.

---
 include/linux/mmzone.h | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
include/linux/mmzone.h +1 -12
index 0d53eba1c383..c2bfefd34b59 100644
@@ -982,22 +982,11 @@ static inline void zone_set_nid(struct zone *zone, int nid) {}
 
 extern int movable_zone;
 
-#ifdef CONFIG_HIGHMEM
-static inline int zone_movable_is_highmem(void)
-{
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-	return movable_zone == ZONE_HIGHMEM;
-#else
-	return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
-#endif
-}
-#endif
-
 static inline int is_highmem_idx(enum zone_type idx)
 {
 #ifdef CONFIG_HIGHMEM
 	return (idx == ZONE_HIGHMEM ||
-		(idx == ZONE_MOVABLE && zone_movable_is_highmem()));
+		(idx == ZONE_MOVABLE && movable_zone == ZONE_HIGHMEM));
 #else
 	return 0;
 #endif
Signature · 1 line
2.29.2