[parisc-linux] Bug in flush_dcache_page?

Matthew Wilcox willy@debian.org
Thu, 1 Nov 2001 03:03:18 +0000

On Wed, Oct 31, 2001 at 08:56:06PM -0500, Carlos O'Donell Jr. wrote:
> > 2. If a page is simultaneously mapped in both user and kernel space, and
> >    user space touches it, either it leaves the page cache or it was mapped
> >    shared.
> Why would a user touch cause the page to leave the cache? 
> (Maybe I'm not reading enough into it...)
> The shared case I can see.

I meant `dirty' rather than `touch'.  If the page is mapped shared, writes
to it are visible to all users.  If it's mapped private, a write does
a copy-on-write.  The page leaves the page cache at this point because its
contents are no longer valuable to anyone except the process.

> > 	if (!page->mapping->i_mmap & !page->mapping->i_mmap_shared) {
> > 		set_bit(PG_dcache_dirty, &page->flags);
> > 	} else {
> Any particular reason for the bitwise and?

It's not a sequence point.  So it doesn't have to be test, branch, test,
branch; it can be test, test, branch.  I'm not sure how the compiler does
on this, to be honest.  It's a microoptimisation that's almost certainly
not worth making.

Revolutions do not require corporate support.