Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Matthew Wilcox <willy@debian.org>
Cc: parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] Bug in flush_dcache_page?
Date: Wed, 31 Oct 2001 18:08:40 +0000	[thread overview]
Message-ID: <20011031180840.C5120@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20011031173905.B5120@parcelfarce.linux.theplanet.co.uk>; from willy@debian.org on Wed, Oct 31, 2001 at 05:39:05PM +0000

On Wed, Oct 31, 2001 at 05:39:05PM +0000, Matthew Wilcox wrote:
> static inline void flush_dcache_page(struct page *page)
> {
> 	if (!page->mapping || (page->mapping && !page->mapping->i_mmap &&
> 			!page->mapping->i_mmap_shared)) {
> 		set_bit(PG_dcache_dirty, &page->flags);
> 	} else {
> 		struct vm_area_struct *vma;
> 		for (vma = page->mapping->i_mmap; vma; vma = vma->vm_next) {
> 			flush_user_page(vma->vm_mm, vma->vm_start + page->index);
> 		}
> 		if (page->mapping->i_mmap_shared) {
> 			vma = page->mapping->i_mmap_shared;
> 			flush_user_page(vma->vm_mm, vma->vm_start + page->index);
> 		}
> 		flush_kernel_dcache_page(page_address(page));
> 	}
> }

Aha.  A couple of things from talking to various VM/VFS people...
1. page->mapping is guaranteed to exist for pages in the page cache --
   this is how they're located.
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.

flush_dcache_page is only called on pages in the page cache, so we can
assume that page->mapping exists, and we don't need to flush any user
mappings of this page.

	if (!page->mapping->i_mmap & !page->mapping->i_mmap_shared) {
		set_bit(PG_dcache_dirty, &page->flags);
	} else {
		struct vm_area_struct *vma = page->mapping->i_mmap_shared;
		if (vma) {
			flush_user_page(vma->vm_mm, vma->vm_start + page->index);
		}
		flush_kernel_dcache_page(page_address(page));
	}

-- 
Revolutions do not require corporate support.

  reply	other threads:[~2001-10-31 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-31 17:39 [parisc-linux] Bug in flush_dcache_page? Matthew Wilcox
2001-10-31 18:08 ` Matthew Wilcox [this message]
2001-11-01  1:56   ` Carlos O'Donell Jr.
2001-11-01  3:03     ` Matthew Wilcox

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=20011031180840.C5120@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=parisc-linux@parisc-linux.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