lkml.org 
[lkml]   [2010]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 0/10] Uprobes v3
> 
> Hrmm, you could do something like the above and use write_protect_page()
> along with that lock_page() you do to sync against concurrent faults. It
> won't be the fastest code around but it should work I guess.

Okay, thanks for the code.

>
> Something like try_to_merge_one_page() in the KSM code:
>
> write_opcode(struct mm_struct *mm, unsigned long address, void *insn,
> int len)
> {
> down_read(mm->mmap_sem);

[ snipped]
>
> kunmap_atomic(vaddr_new);
> kunmap_atomic(vaddr_old);
>
> /* XXX: frob mlock state */

I think you are referring to mlock_vma_page() and munlock_vma_page that
we have in try_to_merge_one_page(). However mlock_vma_page and
munlock_vma_page are not exposed outside mm as they are declared inside
mm/internal.h. So do you suggest moving the declarations out of
mm/internal.h or have a wrapper function defined in mm/ that could be
used by both KSM and uprobes.

>
> /* flip pages, do_wp_page() will fail pte_same() and bail */
> err = replace_page(vma, new_page, old_page, orig_pte)
> if (err) goto fail_more;
>
> /* we're done, let 'em rip */
> unlock_page(old_page);
> put_page(old_page);
>
> return;
>
> fail:
> /* XXX: fixup stuff */
> }
>
> Note that this can fail for fun reasons like O_DIRECT IO, but that
> should be very rare indeed on text pages.
>


\
 
 \ /
  Last update: 2010-05-13 14:11    [W:0.173 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site