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

From: Wei Yang
Date: Mon Jan 20 2020 - 07:36:25 EST


On Mon, Jan 20, 2020 at 12:13:38PM +0530, Anshuman Khandual wrote:
>
>
>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.
>

In v1, they are in two separate patches. While David Suggest to merge it.

I am not sure whether my understanding is correct.

>>
>> 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.

Hmm... naming is really difficult. Do you have any suggestion?

--
Wei Yang
Help you, Help me