public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Page aging broken in 2.6
@ 2003-12-26  7:28 Benjamin Herrenschmidt
  2003-12-26  7:40 ` Andrew Morton
  2003-12-26 17:59 ` Linus Torvalds
  0 siblings, 2 replies; 31+ messages in thread
From: Benjamin Herrenschmidt @ 2003-12-26  7:28 UTC (permalink / raw)
  To: Linux Kernel list; +Cc: Rik van Riel, Andrew Morton

HI !

I don't know if x86 is affected (I suspect not) but ppc and ppc64
definitely are.

in mm/rmap.c, in page_referenced(), we do that twice:

                if (ptep_test_and_clear_young(pte))
                        referenced++;

And we never flush the TLB entry. 

I don't know if x86 (or other archs really using page tables) will
actually set the referenced bit again in the PTE if it's already set
in the TLB, if not, then x86 needs a flush too.

ppc and ppc64 need a flush to evict the entry from the hash table or
we'll never set the _PAGE_ACCESSED bit anymore.

On the other hand, I'd like to propose a semantic change here, by
changing ptep_test_and_clear_dirty() as well so that the flush is done
by the arch function and not explicitely by the generic code in both
cases. (I'm not sure if it's worth adding an mm parameter to the call
or if the arch will figure it out, we don't have it at hand in
page_referenced()).

That way, arch that don't need the flush (if any) can avoid it, and
in the case of ptep_test_and_clear_dirty, I may have a better way of
implementing it without a flush in mind.

Comments ?

Ben.



^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: Page aging broken in 2.6
@ 2003-12-26 10:45 Manfred Spraul
  0 siblings, 0 replies; 31+ messages in thread
From: Manfred Spraul @ 2003-12-26 10:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-kernel

Ben wrote:

>I can imagine that an architecture with TLBs will usually evict
>the entry from the TLB sooner or later and the accessed bit will end
>up beeing set again. On PPC, that isn't the case, the entry can well
>stay a loooong time in the hash and if not evicted, _PAGE_ACCESSED
>will never be set again.
>
One risk for i386 are the huge tlbs that AMD uses (512 entries?) - hot 
pages might stay in the TLB forever.

>Or does it snoop accesses
>to the PTE to "catch" somebody clearing the bits ?
>
No. AMD K8 cpu partially snoop PDE/PTE accesses and ignore tlb flush 
instructions if they are certain that the tlb is valid, but I'm not 
aware that anyone snoops the complete tlb cache.

--
    Manfred


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2003-12-28 17:16 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-26  7:28 Page aging broken in 2.6 Benjamin Herrenschmidt
2003-12-26  7:40 ` Andrew Morton
2003-12-26  9:21   ` Arjan van de Ven
2003-12-26  9:58     ` Benjamin Herrenschmidt
2003-12-26 19:44     ` Davide Libenzi
2003-12-26  9:33   ` Russell King
2003-12-26 10:07     ` Benjamin Herrenschmidt
2003-12-26 17:59 ` Linus Torvalds
2003-12-26 23:55   ` Benjamin Herrenschmidt
2003-12-27  0:35     ` Linus Torvalds
2003-12-27  0:44       ` Benjamin Herrenschmidt
2003-12-27  0:53         ` Linus Torvalds
2003-12-27  0:59           ` Linus Torvalds
2003-12-27  1:03           ` Benjamin Herrenschmidt
2003-12-27  2:37             ` Andrea Arcangeli
2003-12-27  5:02               ` Benjamin Herrenschmidt
2003-12-27 10:16               ` William Lee Irwin III
2003-12-27  2:47           ` Rik van Riel
2003-12-27  3:00             ` Andrew Morton
2003-12-27  3:31               ` Rik van Riel
2003-12-27  3:54               ` Linus Torvalds
2003-12-27 16:34                 ` Martin J. Bligh
2003-12-27 23:07               ` Roger Luethi
2003-12-27 23:55                 ` William Lee Irwin III
2003-12-28 11:23                   ` Roger Luethi
2003-12-28 16:35                     ` William Lee Irwin III
2003-12-28 17:15                       ` Roger Luethi
2003-12-28  0:04                 ` Andrew Morton
2003-12-28 11:58                   ` Roger Luethi
2003-12-27  1:41       ` Andrea Arcangeli
  -- strict thread matches above, loose matches on Subject: below --
2003-12-26 10:45 Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox