Re: [Patch v2 4/4] mm/page_alloc.c: extract commom part to check page

From: Anshuman Khandual
Date: Mon Jan 20 2020 - 01:42:25 EST




On 01/20/2020 08:34 AM, Wei Yang wrote:
> During free and new page, we did some check on the status of page
> struct. There is some common part, just extract them.

Makes sense.

>
> Besides this, this patch also rename two functions to keep the name
> convention, since free_pages_check_bad/free_pages_check are counterparts
> of check_new_page_bad/check_new_page.

This probably should be in a different patch.

>
> Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
> ---
> mm/page_alloc.c | 49 ++++++++++++++++++++++++-------------------------
> 1 file changed, 24 insertions(+), 25 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index a7b793c739fc..7f23cc836f90 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1025,36 +1025,44 @@ static inline bool page_expected_state(struct page *page,
> return true;
> }
>
> -static void free_pages_check_bad(struct page *page)
> +static inline int __check_page(struct page *page, int nr,
> + const char **bad_reason)

free and new page checks are in and out of the buddy allocator, hence
this common factored function should have a more relevant name.