linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Chen Wandun <chenwandun@huawei.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH 2/2] mm: fix contiguous memmap assumptions about alloc/free pages
Date: Tue, 29 Mar 2022 14:08:24 +0100	[thread overview]
Message-ID: <YkMEyH9QB8MyzW37@casper.infradead.org> (raw)
In-Reply-To: <20220329130928.266323-3-chenwandun@huawei.com>

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.


  reply	other threads:[~2022-03-29 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 13:09 [PATCH 0/2] fix several contiguous memmap assumptions Chen Wandun
2022-03-29 13:09 ` [PATCH 1/2] mm: fix contiguous memmap assumptions about split page Chen Wandun
2022-03-29 13:09 ` [PATCH 2/2] mm: fix contiguous memmap assumptions about alloc/free pages Chen Wandun
2022-03-29 13:08   ` Matthew Wilcox [this message]
2022-03-29 13:27     ` Chen Wandun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YkMEyH9QB8MyzW37@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=chenwandun@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox