All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Cc: jeremy@goop.org, xen-devel@lists.xensource.com,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] block: replace kmalloc and then memcpy with kmemdup
Date: Mon, 11 Mar 2013 10:54:35 -0400	[thread overview]
Message-ID: <20130311145435.GB26394@phenom.dumpdata.com> (raw)
In-Reply-To: <1363001016-8439-1-git-send-email-mihneadb@gmail.com>

On Mon, Mar 11, 2013 at 01:23:36PM +0200, Mihnea Dobrescu-Balaur wrote:

Are there performance improvements to doing it this way?

> Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
> ---
>  drivers/block/xen-blkfront.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index c3dae2e..9620644 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info)
>  	int j;
>  
>  	/* Stage 1: Make a safe copy of the shadow state. */
> -	copy = kmalloc(sizeof(info->shadow),
> +	copy = kmemdup(info->shadow, sizeof(info->shadow),
>  		       GFP_NOIO | __GFP_REPEAT | __GFP_HIGH);
>  	if (!copy)
>  		return -ENOMEM;
> -	memcpy(copy, info->shadow, sizeof(info->shadow));
>  
>  	/* Stage 2: Set up free list. */
>  	memset(&info->shadow, 0, sizeof(info->shadow));
> -- 
> 1.7.10.4
> 

WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Cc: xen-devel@lists.xensource.com, jeremy@goop.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: replace kmalloc and then memcpy with kmemdup
Date: Mon, 11 Mar 2013 10:54:35 -0400	[thread overview]
Message-ID: <20130311145435.GB26394@phenom.dumpdata.com> (raw)
In-Reply-To: <1363001016-8439-1-git-send-email-mihneadb@gmail.com>

On Mon, Mar 11, 2013 at 01:23:36PM +0200, Mihnea Dobrescu-Balaur wrote:

Are there performance improvements to doing it this way?

> Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
> ---
>  drivers/block/xen-blkfront.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index c3dae2e..9620644 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -1203,11 +1203,10 @@ static int blkif_recover(struct blkfront_info *info)
>  	int j;
>  
>  	/* Stage 1: Make a safe copy of the shadow state. */
> -	copy = kmalloc(sizeof(info->shadow),
> +	copy = kmemdup(info->shadow, sizeof(info->shadow),
>  		       GFP_NOIO | __GFP_REPEAT | __GFP_HIGH);
>  	if (!copy)
>  		return -ENOMEM;
> -	memcpy(copy, info->shadow, sizeof(info->shadow));
>  
>  	/* Stage 2: Set up free list. */
>  	memset(&info->shadow, 0, sizeof(info->shadow));
> -- 
> 1.7.10.4
> 

  reply	other threads:[~2013-03-11 14:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 11:23 [PATCH] block: replace kmalloc and then memcpy with kmemdup Mihnea Dobrescu-Balaur
2013-03-11 14:54 ` Konrad Rzeszutek Wilk [this message]
2013-03-11 14:54   ` Konrad Rzeszutek Wilk
2013-03-11 15:17   ` Daniel Baluta
2013-03-11 15:17     ` Daniel Baluta
  -- strict thread matches above, loose matches on Subject: below --
2013-03-11 11:23 Mihnea Dobrescu-Balaur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130311145435.GB26394@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihneadb@gmail.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.