* [PATCH 0/2] mmzone.h: fix kernel-doc and simplify is_highmem_idx
@ 2021-04-23 20:38 Mike Rapoport
2021-04-23 20:38 ` [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api Mike Rapoport
2021-04-23 20:38 ` [PATCH 2/2] mm/mmzone.h: simplify is_highmem_idx() Mike Rapoport
0 siblings, 2 replies; 6+ messages in thread
From: Mike Rapoport @ 2021-04-23 20:38 UTC (permalink / raw)
To: Andrew Morton
Cc: Jonathan Corbet, Mike Rapoport, Mike Rapoport, linux-doc,
linux-kernel, linux-mm
From: Mike Rapoport <rppt@linux.ibm.com>
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.
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 | 2 ++
include/linux/mmzone.h | 56 ++++++++++++++-----------------
2 files changed, 27 insertions(+), 31 deletions(-)
--
2.29.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api
2021-04-23 20:38 [PATCH 0/2] mmzone.h: fix kernel-doc and simplify is_highmem_idx Mike Rapoport
@ 2021-04-23 20:38 ` Mike Rapoport
2021-04-24 0:08 ` Matthew Wilcox
2021-04-26 5:06 ` Anshuman Khandual
2021-04-23 20:38 ` [PATCH 2/2] mm/mmzone.h: simplify is_highmem_idx() Mike Rapoport
1 sibling, 2 replies; 6+ messages in thread
From: Mike Rapoport @ 2021-04-23 20:38 UTC (permalink / raw)
To: Andrew Morton
Cc: Jonathan Corbet, Mike Rapoport, Mike Rapoport, linux-doc,
linux-kernel, linux-mm
From: Mike Rapoport <rppt@linux.ibm.com>
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
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
Documentation/core-api/mm-api.rst | 2 ++
include/linux/mmzone.h | 43 +++++++++++++++++--------------
2 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst
index 201b5423303b..3079af5a2404 100644
--- a/Documentation/core-api/mm-api.rst
+++ b/Documentation/core-api/mm-api.rst
@@ -92,3 +92,5 @@ More Memory Management Functions
:export:
.. kernel-doc:: mm/page_alloc.c
+
+.. kernel-doc:: include/linux/mmzone.h
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 47946cec7584..3b2205741048 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -993,7 +993,8 @@ static inline int is_highmem_idx(enum zone_type idx)
* is_highmem - helper function to quickly check if a struct zone is a
* highmem zone or not. This is an attempt to keep references
* to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum.
- * @zone - pointer to struct zone variable
+ * @zone: pointer to struct zone variable
+ * Return: 1 for a highmem zone, 0 otherwise
*/
static inline int is_highmem(struct zone *zone)
{
@@ -1044,7 +1045,7 @@ extern struct zone *next_zone(struct zone *zone);
/**
* for_each_online_pgdat - helper macro to iterate over all online nodes
- * @pgdat - pointer to a pg_data_t variable
+ * @pgdat: pointer to a pg_data_t variable
*/
#define for_each_online_pgdat(pgdat) \
for (pgdat = first_online_pgdat(); \
@@ -1052,7 +1053,7 @@ extern struct zone *next_zone(struct zone *zone);
pgdat = next_online_pgdat(pgdat))
/**
* for_each_zone - helper macro to iterate over all memory zones
- * @zone - pointer to struct zone variable
+ * @zone: pointer to struct zone variable
*
* The user only needs to declare the zone variable, for_each_zone
* fills it in.
@@ -1091,15 +1092,18 @@ struct zoneref *__next_zones_zonelist(struct zoneref *z,
/**
* next_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask using a cursor within a zonelist as a starting point
- * @z - The cursor used as a starting point for the search
- * @highest_zoneidx - The zone index of the highest zone to return
- * @nodes - An optional nodemask to filter the zonelist with
+ * @z: The cursor used as a starting point for the search
+ * @highest_zoneidx: The zone index of the highest zone to return
+ * @nodes: An optional nodemask to filter the zonelist with
*
* This function returns the next zone at or below a given zone index that is
* within the allowed nodemask using a cursor as the starting point for the
* search. The zoneref returned is a cursor that represents the current zone
* being examined. It should be advanced by one before calling
* next_zones_zonelist again.
+ *
+ * Return: the next zone at or below highest_zoneidx within the allowed
+ * nodemask using a cursor within a zonelist as a starting point
*/
static __always_inline struct zoneref *next_zones_zonelist(struct zoneref *z,
enum zone_type highest_zoneidx,
@@ -1112,10 +1116,9 @@ static __always_inline struct zoneref *next_zones_zonelist(struct zoneref *z,
/**
* first_zones_zonelist - Returns the first zone at or below highest_zoneidx within the allowed nodemask in a zonelist
- * @zonelist - The zonelist to search for a suitable zone
- * @highest_zoneidx - The zone index of the highest zone to return
- * @nodes - An optional nodemask to filter the zonelist with
- * @return - Zoneref pointer for the first suitable zone found (see below)
+ * @zonelist: The zonelist to search for a suitable zone
+ * @highest_zoneidx: The zone index of the highest zone to return
+ * @nodes: An optional nodemask to filter the zonelist with
*
* This function returns the first zone at or below a given zone index that is
* within the allowed nodemask. The zoneref returned is a cursor that can be
@@ -1125,6 +1128,8 @@ static __always_inline struct zoneref *next_zones_zonelist(struct zoneref *z,
* When no eligible zone is found, zoneref->zone is NULL (zoneref itself is
* never NULL). This may happen either genuinely, or due to concurrent nodemask
* update due to cpuset modification.
+ *
+ * Return: Zoneref pointer for the first suitable zone found
*/
static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
enum zone_type highest_zoneidx,
@@ -1136,11 +1141,11 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
/**
* for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask
- * @zone - The current zone in the iterator
- * @z - The current pointer within zonelist->_zonerefs being iterated
- * @zlist - The zonelist being iterated
- * @highidx - The zone index of the highest zone to return
- * @nodemask - Nodemask allowed by the allocator
+ * @zone: The current zone in the iterator
+ * @z: The current pointer within zonelist->_zonerefs being iterated
+ * @zlist: The zonelist being iterated
+ * @highidx: The zone index of the highest zone to return
+ * @nodemask: Nodemask allowed by the allocator
*
* This iterator iterates though all zones at or below a given zone index and
* within a given nodemask
@@ -1160,10 +1165,10 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
/**
* for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
- * @zone - The current zone in the iterator
- * @z - The current pointer within zonelist->zones being iterated
- * @zlist - The zonelist being iterated
- * @highidx - The zone index of the highest zone to return
+ * @zone: The current zone in the iterator
+ * @z: The current pointer within zonelist->zones being iterated
+ * @zlist: The zonelist being iterated
+ * @highidx: The zone index of the highest zone to return
*
* This iterator iterates though all zones at or below a given zone index.
*/
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] mm/mmzone.h: simplify is_highmem_idx()
2021-04-23 20:38 [PATCH 0/2] mmzone.h: fix kernel-doc and simplify is_highmem_idx Mike Rapoport
2021-04-23 20:38 ` [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api Mike Rapoport
@ 2021-04-23 20:38 ` Mike Rapoport
2021-04-26 6:19 ` Anshuman Khandual
1 sibling, 1 reply; 6+ messages in thread
From: Mike Rapoport @ 2021-04-23 20:38 UTC (permalink / raw)
To: Andrew Morton
Cc: Jonathan Corbet, Mike Rapoport, Mike Rapoport, linux-doc,
linux-kernel, linux-mm
From: Mike Rapoport <rppt@linux.ibm.com>
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_HIGMEM 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.
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
include/linux/mmzone.h | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 3b2205741048..6a1ac643b65e 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -968,22 +968,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
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api
2021-04-23 20:38 ` [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api Mike Rapoport
@ 2021-04-24 0:08 ` Matthew Wilcox
2021-04-26 5:06 ` Anshuman Khandual
1 sibling, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2021-04-24 0:08 UTC (permalink / raw)
To: Mike Rapoport
Cc: Andrew Morton, Jonathan Corbet, Mike Rapoport, linux-doc,
linux-kernel, linux-mm
On Fri, Apr 23, 2021 at 11:38:10PM +0300, Mike Rapoport wrote:
> +++ b/Documentation/core-api/mm-api.rst
> @@ -92,3 +92,5 @@ More Memory Management Functions
> :export:
>
> .. kernel-doc:: mm/page_alloc.c
> +
> +.. kernel-doc:: include/linux/mmzone.h
You didn't do this against linux-next ... I added a few other files this
cycle:
.. kernel-doc:: mm/page_alloc.c
.. kernel-doc:: mm/mempolicy.c
.. kernel-doc:: include/linux/mm_types.h
:internal:
.. kernel-doc:: include/linux/mm.h
:internal:
The content looks good.
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api
2021-04-23 20:38 ` [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api Mike Rapoport
2021-04-24 0:08 ` Matthew Wilcox
@ 2021-04-26 5:06 ` Anshuman Khandual
1 sibling, 0 replies; 6+ messages in thread
From: Anshuman Khandual @ 2021-04-26 5:06 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton
Cc: Jonathan Corbet, Mike Rapoport, linux-doc, linux-kernel, linux-mm
On 4/24/21 2:08 AM, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> 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
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> Documentation/core-api/mm-api.rst | 2 ++
> include/linux/mmzone.h | 43 +++++++++++++++++--------------
> 2 files changed, 26 insertions(+), 19 deletions(-)
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mm/mmzone.h: simplify is_highmem_idx()
2021-04-23 20:38 ` [PATCH 2/2] mm/mmzone.h: simplify is_highmem_idx() Mike Rapoport
@ 2021-04-26 6:19 ` Anshuman Khandual
0 siblings, 0 replies; 6+ messages in thread
From: Anshuman Khandual @ 2021-04-26 6:19 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton
Cc: Jonathan Corbet, Mike Rapoport, linux-doc, linux-kernel, linux-mm
On 4/24/21 2:08 AM, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> 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_HIGMEM by definition when CONFIG_HIGHMEM=y.
Right with CONFIG_HIGHMEM is enabled, ZONE_MOVABLE = ZONE_HIGHMEM + 1 holds
always true from the very definition in enum zone_type { }.
>
> 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
Right. A small nit. s/HIGMEM/HIGHMEM
>
> to test if zone index points to a highmem zone.
If the CONFIG_HIGHMEM is enabled but ZONE_HIGHMEM is not populated, then
movable_node would point to a zone below ZONE_HIGHMEM and is_highmem_idx()
would also return false.
>
> Remove zone_movable_is_highmem() that is not used anywhere except
> is_highmem_idx() and use the test above in is_highmem_idx() instead.
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> include/linux/mmzone.h | 13 +------------
> 1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 3b2205741048..6a1ac643b65e 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -968,22 +968,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
>
LGTM.
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-26 6:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 20:38 [PATCH 0/2] mmzone.h: fix kernel-doc and simplify is_highmem_idx Mike Rapoport
2021-04-23 20:38 ` [PATCH 1/2] mm/mmzone.h: fix existing kernel-doc comments and link them to core-api Mike Rapoport
2021-04-24 0:08 ` Matthew Wilcox
2021-04-26 5:06 ` Anshuman Khandual
2021-04-23 20:38 ` [PATCH 2/2] mm/mmzone.h: simplify is_highmem_idx() Mike Rapoport
2021-04-26 6:19 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).