From: Dave Hansen <haveblue@us.ibm.com>
To: Matt Mackall <mpm@selenic.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: /proc/$pid/pagemap troubles
Date: Wed, 01 Aug 2007 09:06:30 -0700 [thread overview]
Message-ID: <1185984390.18414.241.camel@localhost> (raw)
In-Reply-To: <20070801001404.GY11115@waste.org>
On Tue, 2007-07-31 at 19:14 -0500, Matt Mackall wrote:
> On Tue, Jul 31, 2007 at 03:43:10PM -0700, Dave Hansen wrote:
> > + evpfn = min((src + count) / sizeof(unsigned long),
> > + ((~0UL) >> PAGE_SHIFT) + 1);
> >
> > Should that hunk of code be any different for 32-bit processes on a
> > 64-bit kernel? Do we want to use TASK_SIZE_OF() or restrict these to
> > actual virtual address space (which is only 48 bits on x86_64).
>
> No. A page for a 32-bit task can line anywhere in the >32-bit physical
> address space.
An evpfn is an ending _virtual_ pfn right? A virtual pfn is a vaddr >>
PAGE_SHIFT, right? We're not calculating anything having to do with
physical addresses. Having 64-bit physical addresses would be a reason
to use 64-bits as the entry size, but not to round down this "evpfn".
"src" in this case is "*ppos", which is the offset into the file.
Divide that by the entry size (sizeof(unsigned long)) and you get the
number of pages offset into the vaddr space that the user is attempting
to read. There might be a bug here with it forgetting to offset the
header size, but oh well.
In any case, what _is_ the ((~0UL) >> PAGE_SHIFT) operation there for?
Is it to make sure that a user reading at the end of the virtual address
space doesn't ask to read 10 pages starting at 0xfffffff0?
> Most of those go away with the get_user_pages approach.
Are you working on this actively? If not, I'd be happy to take whatever
you have and fix it up. Care to post it, even in a slightly unpolished
state?
-- Dave
next prev parent reply other threads:[~2007-08-01 16:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-31 20:36 /proc/$pid/pagemap troubles Dave Hansen
2007-07-31 21:37 ` Matt Mackall
2007-07-31 22:43 ` Dave Hansen
2007-08-01 0:14 ` Matt Mackall
2007-08-01 16:06 ` Dave Hansen [this message]
2007-07-31 22:58 ` Andreas Schwab
2007-07-31 23:06 ` Dave Hansen
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=1185984390.18414.241.camel@localhost \
--to=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.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