I will dump all the written pages of the application and run a garbage collection algorithm over the dumped contents.<br><br>
Thanks<br>
Dhyan<br><br><div class="gmail_quote">On Thu, Aug 2, 2012 at 2:58 PM, bill4carson <span dir="ltr"><<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
On 2012年08月02日 17:03, Dhyan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Bill,<br>
<br>
What i found from experimenting on arm Linux kernel is ,after every<br>
access if i clear the _PG_ACCESS bit of the pte (using<br>
/proc/<pid>/clear_refs),the next write also will come to kernel<br>
(handle_pte_fault).But I dont know whether my clearing action causing<br>
any bad impact on any other system.<br>
<br>
</blockquote>
<br></div>
592 static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,<br>
593 unsigned long end, struct mm_walk *walk)<br>
594 {<br>
595 struct vm_area_struct *vma = walk->private;<br>
596 pte_t *pte, ptent;<br>
597 spinlock_t *ptl;<br>
598 struct page *page;<br>
599<br>
600 split_huge_page_pmd(walk->mm, pmd);<br>
601 if (pmd_trans_unstable(pmd))<br>
602 return 0;<br>
603<br>
604 pte = pte_offset_map_lock(vma->vm_<u></u>mm, pmd, addr, &ptl);<br>
605 for (; addr != end; pte++, addr += PAGE_SIZE) {<br>
606 ptent = *pte;<br>
607 if (!pte_present(ptent))<br>
608 continue;<br>
609<br>
610 page = vm_normal_page(vma, addr, ptent);<br>
611 if (!page)<br>
612 continue;<br>
613<br>
614 /* Clear accessed and referenced bits. */<br>
615 ptep_test_and_clear_young(vma, addr, pte);<br>
^^^^^^^^^^^^<br>
For arm, it clear all the corresponding pte entries.<br>
that's why you got second page fault.<br>
<br>
Again, I don't understand your original purpose<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
--<br>
Thanks<br>
Dhyan<br>
<br>
On Thu, Aug 2, 2012 at 2:12 PM, bill4carson <<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><u></u>> wrote:<br>
<br>
<br>
<br>
On 2012年08月01日 12:53, Dhyan wrote:<br>
<br>
Dear Bill,<br>
<br>
Thank you for spending your valuable time for understanding and<br>
answering my queries !!!<br>
<br>
I was trying to apply some garbage collection algorithm on this<br>
dumped<br>
pages,thats why i want only the written pages.<br>
<br>
Sorry to ask,but is there any other good way to find the written<br>
pages<br>
of a user process?<br>
<br>
<br>
Only the first wirte trigger page fault, which setup the page table by<br>
grabbing a physical page to backup virtual address page. After this,<br>
all write into that page goes like wind without any kernel interference<br>
anymore.<br>
<br>
<br>
But my hunch tell me what you want is to track every user space write<br>
operation.<br>
<br>
<br>
<br>
--<br>
Thanks<br>
Dhyan<br>
<br>
On Wed, Aug 1, 2012 at 7:38 AM, bill4carson<br>
<<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a> <mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><br></div><div><div class="h5">
<mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a> <mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><u></u>>__><br>
wrote:<br>
<br>
<br>
<br>
On 2012年07月31日 17:20, Dhyan wrote:<br>
<br>
Thank You Bill !!!<br>
<br>
I dont know my approach is correct or not,But the<br>
actual purpose<br>
was to<br>
dump only written pages of a user process using a kernel<br>
module.I have<br>
a kernel thread which will dump user process memory in<br>
specific<br>
interval.So i thought of updating this flag<br>
(L_PTE_DEBUG) from<br>
handle_pte_fault and clear from my clear thread so that<br>
i can<br>
dump only<br>
the written pages after my last dump.<br>
<br>
<br>
Yes, you can do that, only if your accounting memory<br>
doesn't get swapped<br>
out.<br>
<br>
If I understand correctly, when writing a page, you mark<br>
corresponding<br>
linux pte entry with L_PTE_DEBUG. Then your kernel module<br>
periodically<br>
loops all linux pte table, find pte entry marked with<br>
L_PTE_DEBUG.....<br>
<br>
I don't think it's wise to do so, you have 768 1st level<br>
pgd entries<br>
for user space, followed by 256 pte entries with each pgd<br>
entry.<br>
it's much slower to find out the right one.<br>
<br>
moreover, you probably need to remap those L_PTE_DEBUG<br>
physical pages<br>
into your own current process address space. IMHO, I don't<br>
follow<br>
such idea could be feasible.<br>
<br>
<br>
<br>
if you have some suggestions could you please share<br>
wth me?<br>
<br>
<br>
I understand how you plan to do this, could I ask why you<br>
need to dump<br>
the written pages?<br>
<br>
<br>
--<br>
Thanks<br>
Dhyan<br>
<br>
On Tue, Jul 31, 2012 at 12:43 PM, bill4carson<br>
<<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a> <mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><br>
<mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a> <mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><u></u>><br>
<mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a> <mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><br></div></div>
<mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a> <mailto:<a href="mailto:bill4carson@gmail.com" target="_blank">bill4carson@gmail.com</a>><u></u>>__>__><div class="im">
<br>
<br>
wrote:<br>
<br>
<br>
<br>
On 2012年07月30日 17:39, Dhyan wrote:<br>
<br>
Dear All,<br>
<br>
From linux(2.6.35) arm page table<br>
architecture i can<br>
see we<br>
have one<br>
hardware page table and there is<br>
corresponding Linux<br>
page table<br>
Entry<br>
(L_PTE_*).The "Linux" PTE definitions are as<br>
like below<br>
from<br></div>
arch/arm/include/asm/pgtable._<u></u>_____h.<div><div class="h5"><br>
<br>
<br>
<br>
|#define L_PTE_PRESENT (1<< 0)<br>
#define L_PTE_FILE (1<< 1)<br>
#define L_PTE_YOUNG (1<< 1)<br>
#define L_PTE_BUFFERABLE(1<< 2)<br>
#define L_PTE_CACHEABLE (1<< 3)<br>
#define L_PTE_USER (1<< 4)<br>
#define L_PTE_WRITE (1<< 5)<br>
#define L_PTE_EXEC (1<< 6)<br>
#define L_PTE_DIRTY (1<< 7)<br>
#define L_PTE_COHERENT (1<< 9)<br>
#define L_PTE_SHARED (1<< 10)<br>
|<br>
<br>
So is it possible to add one more #|define<br>
L_PTE_DEBUG<br>
(1 <<<br>
11)| for my<br>
<br>
debugging purpose (basically to trap all the<br>
write to<br>
that page<br>
and set<br>
this bit when write happens and clear it off<br>
in another<br>
thread<br>
)? Or<br>
is there any limitation like we can use only<br>
L_PTE till<br>
10th bit ?<br>
<br>
<br>
No such limitation on bit 11, so you can use define<br>
L_PTE_DEBUG (1<br>
<< 11)<br>
However I don't follow why you want to do so?<br>
<br>
<br>
So could you please help<br>
<br>
--<br>
<br>
Thanks & Regards<br>
<br>
Dhayn<br>
<br>
<br>
<br>
<br></div></div>
______________________________<u></u>_______________________<br>
Kernelnewbies mailing list<br>
Kernelnewbies@kernelnewbies.__<u></u>____org<br>
<mailto:<a href="mailto:Kernelnewbies@" target="_blank">Kernelnewbies@</a><br>
<mailto:<a href="mailto:Kernelnewbies@" target="_blank">Kernelnewbies@</a>>__<a href="http://kernel__newbies.org" target="_blank">kerne<u></u>l__newbies.org</a><br>
<<a href="http://kernelnewbies.org" target="_blank">http://kernelnewbies.org</a>><br>
<mailto:<a href="mailto:Kernelnewbies@" target="_blank">Kernelnewbies@</a>__<a href="http://kernelnewbies.org" target="_blank">kernel<u></u>newbies.org</a><br>
<mailto:<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@<u></u>kernelnewbies.org</a>>>><br>
<a href="http://lists.kernelnewbies." target="_blank">http://lists.kernelnewbies.</a>___<u></u>___org/mailman/listinfo/______<u></u>kernelnewbies<div class="im"><br>
<br>
<<a href="http://lists.kernelnewbies." target="_blank">http://lists.kernelnewbies.</a>__<u></u>__org/mailman/listinfo/____<u></u>kernelnewbies<br>
<<a href="http://lists.kernelnewbies." target="_blank">http://lists.kernelnewbies.</a>__<u></u>org/mailman/listinfo/__<u></u>kernelnewbies<br>
<<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.<u></u>org/mailman/listinfo/<u></u>kernelnewbies</a>>>><br>
<br>
<br>
<br>
--<br>
Love each day!<br>
<br>
--bill<br>
<br>
<br>
<br>
--<br>
Love each day!<br>
<br>
--bill<br>
<br>
<br>
<br>
--<br>
Love each day!<br>
<br>
--bill<br>
<br>
<br>
</div></blockquote><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Love each day!<br>
<br>
--bill<br>
</div></div></blockquote></div><br>