Re: [PATCH 2.5.63] Teach page_mapped about the anon flag

From: Andrew Morton (akpm@digeo.com)
Date: Mon Mar 03 2003 - 16:12:10 EST


Dave McCracken <dmccr@us.ibm.com> wrote:
>
>
> --On Thursday, February 27, 2003 14:24:50 -0800 Andrew Morton
> <akpm@digeo.com> wrote:
>
> > I'm just looking at page_mapped(). It is now implicitly assuming that the
> > architecture's representation of a zero-count atomic_t is all-bits-zero.
> >
> > This is not true on sparc32 if some other CPU is in the middle of an
> > atomic_foo() against that counter. Maybe the assumption is false on other
> > architectures too.
> >
> > So page_mapped() really should be performing an atomic_read() if that is
> > appropriate to the particular page. I guess this involves testing
> > page->mapping. Which is stable only when the page is locked or
> > mapping->page_lock is held.
> >
> > It appears that all page_mapped() callers are inside lock_page() at
> > present, so a quick audit and addition of a comment would be appropriate
> > there please.
>
> I'm not at all confident that page_mapped() is adequately protected.

It is. All callers which need to be 100% accurate are under
pte_chain_lock().

> Here's a patch that explicitly handles the atomic_t case.

OK.. But it increases dependency on PageAnon. Wasn't the plan to remove
that at some time?

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



This archive was generated by hypermail 2b29 : Fri Mar 07 2003 - 22:00:22 EST