[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YkMEyH9QB8MyzW37@casper.infradead.org>
Date: Tue, 29 Mar 2022 14:08:24 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Chen Wandun <chenwandun@...wei.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org
Subject: Re: [PATCH 2/2] mm: fix contiguous memmap assumptions about
alloc/free pages
On Tue, Mar 29, 2022 at 09:09:28PM +0800, Chen Wandun wrote:
> +#define page_nth(head, tail) (page_to_pfn(tail) - page_to_pfn(head))
Could we avoid reintroducing page_nth()? It is a terrible name.
> @@ -1213,7 +1213,7 @@ static int free_tail_pages_check(struct page *head_page, struct page *page)
> ret = 0;
> goto out;
> }
> - switch (page - head_page) {
> + switch (page_nth(head_page, page)) {
> case 1:
> /* the first tail page: ->mapping may be compound_mapcount() */
> if (unlikely(compound_mapcount(page))) {
This is the only place you use it. I'd suggest free_tail_pages_check()
should take 'i' as its second parameter instead of 'page + i', then
there's no need to convert back to i.
Powered by blists - more mailing lists