Re: [RFC][PATCH] Cross Memory Attach

From: Christopher Yeoh
Date: Wed Sep 15 2010 - 22:18:13 EST


On Wed, 15 Sep 2010 12:07:11 -0400
Valdis.Kletnieks@xxxxxx wrote:
>
> Interesting, and nice benchmark results. I have a question though:
>
> > + /* Get the pages we're interested in */
> > + pages_pinned = get_user_pages(task, task->mm, pa,
> > + nr_pages_to_copy,
> > + copy_to, 0, process_pages,
> > NULL); +
> > + if (pages_pinned != nr_pages_to_copy)
> > + goto end;
>
> ...
>
> > +end:
> > + for (i = 0; i < pages_pinned; i++) {
> > + if (copy_to)
> > + set_page_dirty_lock(process_pages[i]);
> > + put_page(process_pages[i]);
> > + }
>
> It looks to me like if get_user_pages() fails to pin *all* the pages,
> we treat the target pages as dirty even though we never actually
> touched them?
>
> Maybe it should be 'if (copy_to && *bytes_copied)'?

Yes that can happen, though the *bytes_copied check doesn't completely
fix it as copy_from_user could fail resulting in some pages being
touched, but not all of them. I'll add some code to only call
set_page_dirty_lock on pages that really have been touched...

Regards,

Chris
--
cyeoh@xxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/