From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754468Ab0IOPPb (ORCPT ); Wed, 15 Sep 2010 11:15:31 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:53283 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754440Ab0IOPP3 convert rfc822-to-8bit (ORCPT ); Wed, 15 Sep 2010 11:15:29 -0400 MIME-Version: 1.0 In-Reply-To: References: <20100915104855.41de3ebf@lilo> From: Linus Torvalds Date: Wed, 15 Sep 2010 08:14:49 -0700 Message-ID: Subject: Re: [RFC][PATCH] Cross Memory Attach To: Christopher Yeoh Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2010 at 8:11 AM, Linus Torvalds 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