From: Matthew Wilcox <willy@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] Rename page_offset() to page_pos()
Date: Sat, 11 Apr 2020 16:22:05 -0700 [thread overview]
Message-ID: <20200411232205.GJ21484@bombadil.infradead.org> (raw)
In-Reply-To: <CAHk-=whFfcUEMq5C9Xy=c=sJrT-+3uOE2bAwEQo9MUdbhP2X3Q@mail.gmail.com>
On Sat, Apr 11, 2020 at 03:09:35PM -0700, Linus Torvalds wrote:
> On Sat, Apr 11, 2020 at 3:06 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > But we _have_ an offset_in_page() and it doesn't take a struct page
> > argument.
>
> .. it doesn't take a struct page argument because a struct page always
> has one compile-time fixed size.
>
> The only reason you seem to want to get the new interface is because
> you want to change that fact.
>
> So yes, you'd have to change the _existing_ offset_in_page() to take
> that extra "which page" argument.
>
> That's not confusing.
Unfortunately there isn't always a struct page around. For example:
int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
struct list_head *uf, bool downgrade)
{
unsigned long end;
struct vm_area_struct *vma, *prev, *last;
if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE-start)
return -EINVAL;
where we don't care _which_ page, we just want to know the offset relative
to the architecturally defined page size. In this specific case, it
should probably be changed to is_page_aligned(start).
There are trickier ones like on powerpc:
unsigned long vmalloc_to_phys(void *va)
{
unsigned long pfn = vmalloc_to_pfn(va);
BUG_ON(!pfn);
return __pa(pfn_to_kaddr(pfn)) + offset_in_page(va);
}
where there actually _is_ a struct page, but it will need to be found.
Maybe we can pass in NULL to indicate to use the base page size. Or
rename all current callers to offset_in_base_page() before adding a
struct page pointer to offset_in_page(). Tedious, but doable.
prev parent reply other threads:[~2020-04-11 23:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-11 20:32 Matthew Wilcox
2020-04-11 20:57 ` Linus Torvalds
2020-04-11 21:48 ` Matthew Wilcox
2020-04-11 22:02 ` Linus Torvalds
2020-04-11 22:06 ` Matthew Wilcox
2020-04-11 22:09 ` Linus Torvalds
2020-04-11 23:22 ` 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=20200411232205.GJ21484@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@linux-foundation.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