public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: zyf.zeroos@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: BUG: about flush TLB during unmapping a page in memory subsystem
Date: Thu, 19 Oct 2006 20:02:11 -0700 (PDT)	[thread overview]
Message-ID: <20061019.200211.88476455.davem@davemloft.net> (raw)
In-Reply-To: <4df04b840610191947r2b48c2ddo45f0cd94d94a614b@mail.gmail.com>

From: "yunfeng zhang" <zyf.zeroos@gmail.com>
Date: Fri, 20 Oct 2006 10:47:49 +0800

> In rmap.c::try_to_unmap_one of 2.6.16.29, there are some code snippets
> 
> .....
> /* Nuke the page table entry. */
> flush_cache_page(vma, address, page_to_pfn(page));
> pteval = ptep_clear_flush(vma, address, pte);
> // >>> The above line is expanded as below
> // >>> pte_t __pte;
> // >>> __pte = ptep_get_and_clear((__vma)->vm_mm, __address, __ptep);
> // >>> flush_tlb_page(__vma, __address);
> // >>> __pte;
> 
> /* Move the dirty bit to the physical page now the pte is gone. */
> if (pte_dirty(pteval))
>         set_page_dirty(page);
> .....
> 
> 
> It seems that they only can work on UP system.
> 
> On SMP, let's suppose the pte was clean, after A CPU executed
> ptep_get_and_clear,
> B CPU makes the pte dirty, which will make a fatal error to A CPU since it gets
> a stale pte, isn't right?

B can't make it dirty because it's been cleared to zero
and flush_tlb_page() has removed the TLB cached copy of
the PTE.  B can therefore only see the new cleared PTE.

  reply	other threads:[~2006-10-20  3:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20  2:47 BUG: about flush TLB during unmapping a page in memory subsystem yunfeng zhang
2006-10-20  3:02 ` David Miller [this message]
2006-10-20  5:10   ` yunfeng zhang
2006-10-20  5:54     ` Benjamin Herrenschmidt

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=20061019.200211.88476455.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zyf.zeroos@gmail.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