linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, songmuchun@bytedance.com,
	mike.kravetz@oracle.com
Subject: Re: [PATCH] mm/hugetlb: get rid of page_hstate()
Date: Wed, 19 Jul 2023 19:11:56 +0100	[thread overview]
Message-ID: <ZLgnbMet0jgxbak/@casper.infradead.org> (raw)
In-Reply-To: <20230719175944.292929-1-sidhartha.kumar@oracle.com>

On Wed, Jul 19, 2023 at 10:59:44AM -0700, Sidhartha Kumar wrote:
> -			skip_pages = compound_nr(head) - (page - head);
> +			skip_pages = folio_nr_pages(folio) - (page - &folio->page);

It turns out that you can't do (page - head) under all configs.  It
works on all common ones, but the safe way to do what you want here is:

			skip_pages = folio_nr_pages(folio) -
					folio_page_idx(folio, page);


      reply	other threads:[~2023-07-19 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 17:59 [PATCH] mm/hugetlb: get rid of page_hstate() Sidhartha Kumar
2023-07-19 18:11 ` Matthew Wilcox [this message]

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=ZLgnbMet0jgxbak/@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=sidhartha.kumar@oracle.com \
    --cc=songmuchun@bytedance.com \
    /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;
as well as URLs for NNTP newsgroup(s).