Re: [PATCH 13/13] maps#2: Add /proc/kpagemap interface

From: Matt Mackall
Date: Thu Apr 19 2007 - 16:15:35 EST


On Thu, Apr 19, 2007 at 12:06:38PM -0700, Dave Hansen wrote:
> On Fri, 2007-04-06 at 17:03 -0500, Matt Mackall wrote:
> >
> > +static ssize_t kpagemap_read(struct file *file, char __user *buf,
> > + size_t count, loff_t *ppos)
> > +{
> ...
> > + for (; i < 2 * chunk / KPMSIZE; i += 2, pfn++) {
> > + ppage = pfn_to_page(pfn);
> > + if (!ppage) {
> > + page[i] = 0;
> > + page[i + 1] = 0;
> > + } else {
> > + page[i] = ppage->flags;
> > + page[i + 1] = atomic_read(&ppage->_count);
> > + }
> > + }
>
> I think this needs a pfn_valid() check for sparse/discontig systems. I
> think we'll oops if we have holes because we don't check pfn_valid()
> inside of pfn_to_page().

Are there cases where pfn_valid is true but pfn_to_page doesn't work?
In other words, do I still only need two cases?

--
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/