question on ptep_clear_flush_dirty() for ppc64

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Feb 10 13:54:27 EST 2006


On Thu, 2006-02-09 at 10:03 -0600, Christopher Friesen wrote:
> I notice that (at least for 2.6.10) ptep_clear_flush_dirty() for ppc64 
> simply does ptep_test_and_clear_dirty(), then calls flush_tlb_pending().
> 
> I want to call ptep_clear_flush_dirty() for a large number of pages 
> (tens of thousands) in an optimal manner--would it be legal for me to 
> call ptep_test_and_clear_dirty() for each page, then call 
> flush_tlb_pending() once at the end?  Are there any implications for SMP 
> machines?
> 
> The reason I ask is that in a small experiment I did this increased the 
> speed of a certain task by a factor of about 25%, which is significant 
> in our application.  I just wanted to make sure it was safe.

If you do that, just beware that if any "new" dirtying happens between
the update of the linux PTE and the flush_tlb_pending(), it will not be
lost... this is not a problem if you only "use" the result of the
function (the collected dirty bits) after you flush_tlb_pending() since
you will have those already marked dirty.

I don't think you need the page table lock, though I'm a bit tired at
the moment and may be missing something, and I don't think you need to
disable preemption as a context switch will call flush_tlb_pending()...

Ben.





More information about the Linuxppc64-dev mailing list