Re: [RFC][PATCH] Cross Memory Attach

From: Linus Torvalds
Date: Wed Sep 15 2010 - 11:15:33 EST


On Wed, Sep 15, 2010 at 8:11 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Btw, please just do this as
>
>   if (copy_to)
>      ret = copy_from_user(..);
>   else
>      ret = copy_to_user(..);
>   kunmap(process_pages[i]);
>   if (ret)
>      goto out;

In fact, you might consider passing in a "copy_out" function pointer
rather than that "copy_to" boolean, and rather than that conditional,
just do a

ret = copy_out(..);

thing. On sane/good architectures, branch target prediction will make
it all work out to the same work in the end, and it certainly looks
simpler and cleaner.

Linus
--
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/