All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [RFC][PATCH] kmemdup_from_user(): introduce
Date: Fri, 06 Mar 2009 17:01:48 +0800	[thread overview]
Message-ID: <49B0E67C.2090404@cn.fujitsu.com> (raw)
In-Reply-To: <20090306003900.a031a914.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Fri, 06 Mar 2009 16:27:53 +0800 Li Zefan <lizf@cn.fujitsu.com> wrote:
> 
>>> Let's not add wrapper for every two lines that happen to be used
>>> together.
>>>
>> Why not if we have good reasons? And I don't think we can call this
>> "happen to" if there are 250+ of them?
> 
> The change is a good one.  If a reviewer (me) sees it then you know the
> code's all right and the review effort becomes less - all you need to check
> is that the call site is using IS_ERR/PTR_ERR and isn't testing for
> NULL.  Less code, less chance for bugs.
> 
> Plus it makes kernel text smaller.
> 
> Yes, the name is a bit cumbersome.
> 

How about memdup_user()? like kstrndup() vs strndup_user().

Here is the statistics when using 5 kmemdup_from_user() in btrfs:

$ diffstat
 ioctl.c |   49 ++++++++++++-------------------------------------
 super.c |   13 ++++---------
 2 files changed, 16 insertions(+), 46 deletions(-)

the kernel size on i386:

   text    data     bss     dec     hex filename
 288339    1924     508  290771   46fd3 fs/btrfs/btrfs.o.orig
   text    data     bss     dec     hex filename
 288255    1924     508  290687   46f7f fs/btrfs/btrfs.o

so saves 84 bytes.

the kernel size on IA64:

   text    data     bss     dec     hex filename
 898752    3736     109  902597   dc5c5 fs/btrfs/btrfs.o.orig
   text    data     bss     dec     hex filename
 898176    3712     109  901997   dc36d fs/btrfs/btrfs.o

so saves 576 bytes.

WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [RFC][PATCH] kmemdup_from_user(): introduce
Date: Fri, 06 Mar 2009 17:01:48 +0800	[thread overview]
Message-ID: <49B0E67C.2090404@cn.fujitsu.com> (raw)
In-Reply-To: <20090306003900.a031a914.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Fri, 06 Mar 2009 16:27:53 +0800 Li Zefan <lizf@cn.fujitsu.com> wrote:
> 
>>> Let's not add wrapper for every two lines that happen to be used
>>> together.
>>>
>> Why not if we have good reasons? And I don't think we can call this
>> "happen to" if there are 250+ of them?
> 
> The change is a good one.  If a reviewer (me) sees it then you know the
> code's all right and the review effort becomes less - all you need to check
> is that the call site is using IS_ERR/PTR_ERR and isn't testing for
> NULL.  Less code, less chance for bugs.
> 
> Plus it makes kernel text smaller.
> 
> Yes, the name is a bit cumbersome.
> 

How about memdup_user()? like kstrndup() vs strndup_user().

Here is the statistics when using 5 kmemdup_from_user() in btrfs:

$ diffstat
 ioctl.c |   49 ++++++++++++-------------------------------------
 super.c |   13 ++++---------
 2 files changed, 16 insertions(+), 46 deletions(-)

the kernel size on i386:

   text    data     bss     dec     hex filename
 288339    1924     508  290771   46fd3 fs/btrfs/btrfs.o.orig
   text    data     bss     dec     hex filename
 288255    1924     508  290687   46f7f fs/btrfs/btrfs.o

so saves 84 bytes.

the kernel size on IA64:

   text    data     bss     dec     hex filename
 898752    3736     109  902597   dc5c5 fs/btrfs/btrfs.o.orig
   text    data     bss     dec     hex filename
 898176    3712     109  901997   dc36d fs/btrfs/btrfs.o

so saves 576 bytes.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2009-03-06  9:02 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06  7:04 [RFC][PATCH] kmemdup_from_user(): introduce Li Zefan
2009-03-06  7:04 ` Li Zefan
2009-03-06  7:23 ` Américo Wang
2009-03-06  7:23   ` Américo Wang
2009-03-06  7:37   ` KOSAKI Motohiro
2009-03-06  7:37     ` KOSAKI Motohiro
2009-03-06  8:03     ` KOSAKI Motohiro
2009-03-06  8:03       ` KOSAKI Motohiro
2009-03-06  7:39   ` Li Zefan
2009-03-06  7:39     ` Li Zefan
2009-03-06  8:20 ` Alexey Dobriyan
2009-03-06  8:20   ` Alexey Dobriyan
2009-03-06  8:27   ` Li Zefan
2009-03-06  8:27     ` Li Zefan
2009-03-06  8:39     ` Andrew Morton
2009-03-06  8:39       ` Andrew Morton
2009-03-06  8:57       ` Alexey Dobriyan
2009-03-06  8:57         ` Alexey Dobriyan
2009-03-06  9:09         ` KOSAKI Motohiro
2009-03-06  9:09           ` KOSAKI Motohiro
2009-03-06  9:01       ` Li Zefan [this message]
2009-03-06  9:01         ` Li Zefan
2009-03-06  9:15         ` Andrew Morton
2009-03-06  9:15           ` Andrew Morton
2009-03-06  9:49           ` [PATCH -v2] memdup_user(): introduce Li Zefan
2009-03-06  9:49             ` Li Zefan
2009-03-06 23:03             ` Andrew Morton
2009-03-06 23:03               ` Andrew Morton
2009-03-07 16:48               ` Arjan van de Ven
2009-03-07 16:48                 ` Arjan van de Ven
2009-03-07 16:54                 ` Roland Dreier
2009-03-07 16:54                   ` Roland Dreier
2009-03-07 18:27                 ` Andrew Morton
2009-03-07 18:27                   ` Andrew Morton
2009-03-09  2:22                 ` Li Zefan
2009-03-09  2:22                   ` Li Zefan
2009-03-09  3:00                   ` Andrew Morton
2009-03-09  3:00                     ` Andrew Morton
2009-03-09  3:30                     ` Li Zefan
2009-03-09  3:30                       ` Li Zefan
2009-03-09  3:45                       ` Andrew Morton
2009-03-09  3:45                         ` Andrew Morton
2009-03-06  9:03     ` [RFC][PATCH] kmemdup_from_user(): introduce Alexey Dobriyan
2009-03-06  9:03       ` Alexey Dobriyan
2009-03-06  9:02       ` Li Zefan
2009-03-06  9:02         ` Li Zefan

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=49B0E67C.2090404@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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.