2022-09-09 10:14:42

by Miaohe Lin

[permalink] [raw]
Subject: [PATCH 00/16] A few cleanup patches for mm

Hi everyone,
This series contains a few cleanup patches to remove the obsolete
comments and functions, use helper macro to improve readability and
so on. More details can be found in the respective changelogs.
Thanks!

Miaohe Lin (16):
mm/page_alloc: ensure kswapd doesn't accidentally go to sleep
mm/page_alloc: make zone_pcp_update() static
mm: remove obsolete macro NR_PCP_ORDER_MASK
mm/page_alloc: remove obsolete comment in zone_statistics()
mm/page_alloc: add __init annotations to
init_mem_debugging_and_hardening()
mm/page_alloc: fix freeing static percpu memory
mm: remove obsolete pgdat_is_empty()
mm/page_alloc: add missing is_migrate_isolate() check in
set_page_guard()
mm/page_alloc: use local variable zone_idx directly
mm, memory_hotplug: remove obsolete generic_free_nodedata()
mm/page_alloc: make boot_nodestats static
mm/page_alloc: use helper macro SZ_1{K,M}
mm/page_alloc: init local variable buddy_pfn
mm/page_alloc: use costly_order in WARN_ON_ONCE_GFP()
mm/page_alloc: remove obsolete gfpflags_normal_context()
mm/page_alloc: fix obsolete comment in deferred_pfn_valid()

include/linux/gfp.h | 23 -------------
include/linux/memory_hotplug.h | 8 -----
include/linux/mm.h | 2 +-
include/linux/mmzone.h | 6 ----
mm/internal.h | 3 --
mm/page_alloc.c | 60 ++++++++++++++++------------------
6 files changed, 30 insertions(+), 72 deletions(-)

--
2.23.0


2022-09-09 10:17:28

by Miaohe Lin

[permalink] [raw]
Subject: [PATCH 15/16] mm/page_alloc: remove obsolete gfpflags_normal_context()

Since commit dacb5d8875cc ("tcp: fix page frag corruption on page
fault"), there's no caller of gfpflags_normal_context(). Remove it
as this helper is strictly tied to the sk page frag usage and there
won't be other user in the future.

Signed-off-by: Miaohe Lin <[email protected]>
---
include/linux/gfp.h | 23 -----------------------
1 file changed, 23 deletions(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index ea6cb9399152..ef4aea3b356e 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -36,29 +36,6 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
}

-/**
- * gfpflags_normal_context - is gfp_flags a normal sleepable context?
- * @gfp_flags: gfp_flags to test
- *
- * Test whether @gfp_flags indicates that the allocation is from the
- * %current context and allowed to sleep.
- *
- * An allocation being allowed to block doesn't mean it owns the %current
- * context. When direct reclaim path tries to allocate memory, the
- * allocation context is nested inside whatever %current was doing at the
- * time of the original allocation. The nested allocation may be allowed
- * to block but modifying anything %current owns can corrupt the outer
- * context's expectations.
- *
- * %true result from this function indicates that the allocation context
- * can sleep and use anything that's associated with %current.
- */
-static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
-{
- return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
- __GFP_DIRECT_RECLAIM;
-}
-
#ifdef CONFIG_HIGHMEM
#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
#else
--
2.23.0

2022-09-09 11:47:44

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH 15/16] mm/page_alloc: remove obsolete gfpflags_normal_context()

On 09.09.22 11:24, Miaohe Lin wrote:
> Since commit dacb5d8875cc ("tcp: fix page frag corruption on page
> fault"), there's no caller of gfpflags_normal_context(). Remove it
> as this helper is strictly tied to the sk page frag usage and there
> won't be other user in the future.
>
> Signed-off-by: Miaohe Lin <[email protected]>
> ---
> include/linux/gfp.h | 23 -----------------------
> 1 file changed, 23 deletions(-)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index ea6cb9399152..ef4aea3b356e 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -36,29 +36,6 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
> return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
> }
>
> -/**
> - * gfpflags_normal_context - is gfp_flags a normal sleepable context?
> - * @gfp_flags: gfp_flags to test
> - *
> - * Test whether @gfp_flags indicates that the allocation is from the
> - * %current context and allowed to sleep.
> - *
> - * An allocation being allowed to block doesn't mean it owns the %current
> - * context. When direct reclaim path tries to allocate memory, the
> - * allocation context is nested inside whatever %current was doing at the
> - * time of the original allocation. The nested allocation may be allowed
> - * to block but modifying anything %current owns can corrupt the outer
> - * context's expectations.
> - *
> - * %true result from this function indicates that the allocation context
> - * can sleep and use anything that's associated with %current.
> - */
> -static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
> -{
> - return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
> - __GFP_DIRECT_RECLAIM;
> -}
> -
> #ifdef CONFIG_HIGHMEM
> #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
> #else

Reviewed-by: David Hildenbrand <[email protected]>

--
Thanks,

David / dhildenb

2022-09-13 11:52:24

by Anshuman Khandual

[permalink] [raw]
Subject: Re: [PATCH 15/16] mm/page_alloc: remove obsolete gfpflags_normal_context()



On 9/9/22 14:54, Miaohe Lin wrote:
> Since commit dacb5d8875cc ("tcp: fix page frag corruption on page
> fault"), there's no caller of gfpflags_normal_context(). Remove it
> as this helper is strictly tied to the sk page frag usage and there
> won't be other user in the future.
>
> Signed-off-by: Miaohe Lin <[email protected]>

Reviewed-by: Anshuman Khandual <[email protected]>

> ---
> include/linux/gfp.h | 23 -----------------------
> 1 file changed, 23 deletions(-)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index ea6cb9399152..ef4aea3b356e 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -36,29 +36,6 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
> return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
> }
>
> -/**
> - * gfpflags_normal_context - is gfp_flags a normal sleepable context?
> - * @gfp_flags: gfp_flags to test
> - *
> - * Test whether @gfp_flags indicates that the allocation is from the
> - * %current context and allowed to sleep.
> - *
> - * An allocation being allowed to block doesn't mean it owns the %current
> - * context. When direct reclaim path tries to allocate memory, the
> - * allocation context is nested inside whatever %current was doing at the
> - * time of the original allocation. The nested allocation may be allowed
> - * to block but modifying anything %current owns can corrupt the outer
> - * context's expectations.
> - *
> - * %true result from this function indicates that the allocation context
> - * can sleep and use anything that's associated with %current.
> - */
> -static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
> -{
> - return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
> - __GFP_DIRECT_RECLAIM;
> -}
> -
> #ifdef CONFIG_HIGHMEM
> #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
> #else

2022-09-13 12:16:23

by Anshuman Khandual

[permalink] [raw]
Subject: Re: [PATCH 15/16] mm/page_alloc: remove obsolete gfpflags_normal_context()



On 9/9/22 14:54, Miaohe Lin wrote:
> Since commit dacb5d8875cc ("tcp: fix page frag corruption on page
> fault"), there's no caller of gfpflags_normal_context(). Remove it
> as this helper is strictly tied to the sk page frag usage and there
> won't be other user in the future.
>
> Signed-off-by: Miaohe Lin <[email protected]>

Reviewed-by: Anshuman Khandual <[email protected]>

> ---
> include/linux/gfp.h | 23 -----------------------
> 1 file changed, 23 deletions(-)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index ea6cb9399152..ef4aea3b356e 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -36,29 +36,6 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
> return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
> }
>
> -/**
> - * gfpflags_normal_context - is gfp_flags a normal sleepable context?
> - * @gfp_flags: gfp_flags to test
> - *
> - * Test whether @gfp_flags indicates that the allocation is from the
> - * %current context and allowed to sleep.
> - *
> - * An allocation being allowed to block doesn't mean it owns the %current
> - * context. When direct reclaim path tries to allocate memory, the
> - * allocation context is nested inside whatever %current was doing at the
> - * time of the original allocation. The nested allocation may be allowed
> - * to block but modifying anything %current owns can corrupt the outer
> - * context's expectations.
> - *
> - * %true result from this function indicates that the allocation context
> - * can sleep and use anything that's associated with %current.
> - */
> -static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
> -{
> - return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
> - __GFP_DIRECT_RECLAIM;
> -}
> -
> #ifdef CONFIG_HIGHMEM
> #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
> #else

2022-09-15 09:02:58

by Oscar Salvador

[permalink] [raw]
Subject: Re: [PATCH 15/16] mm/page_alloc: remove obsolete gfpflags_normal_context()

On Fri, Sep 09, 2022 at 05:24:50PM +0800, Miaohe Lin wrote:
> Since commit dacb5d8875cc ("tcp: fix page frag corruption on page
> fault"), there's no caller of gfpflags_normal_context(). Remove it
> as this helper is strictly tied to the sk page frag usage and there
> won't be other user in the future.
>
> Signed-off-by: Miaohe Lin <[email protected]>

Reviewed-by: Oscar Salvador <[email protected]>

> ---
> include/linux/gfp.h | 23 -----------------------
> 1 file changed, 23 deletions(-)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index ea6cb9399152..ef4aea3b356e 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -36,29 +36,6 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
> return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
> }
>
> -/**
> - * gfpflags_normal_context - is gfp_flags a normal sleepable context?
> - * @gfp_flags: gfp_flags to test
> - *
> - * Test whether @gfp_flags indicates that the allocation is from the
> - * %current context and allowed to sleep.
> - *
> - * An allocation being allowed to block doesn't mean it owns the %current
> - * context. When direct reclaim path tries to allocate memory, the
> - * allocation context is nested inside whatever %current was doing at the
> - * time of the original allocation. The nested allocation may be allowed
> - * to block but modifying anything %current owns can corrupt the outer
> - * context's expectations.
> - *
> - * %true result from this function indicates that the allocation context
> - * can sleep and use anything that's associated with %current.
> - */
> -static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
> -{
> - return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
> - __GFP_DIRECT_RECLAIM;
> -}
> -
> #ifdef CONFIG_HIGHMEM
> #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
> #else
> --
> 2.23.0
>

--
Oscar Salvador
SUSE Labs