1. 17 10月, 2007 1 次提交
  2. 18 7月, 2007 4 次提交
  3. 04 10月, 2006 1 次提交
  4. 01 10月, 2006 1 次提交
    • A
      [PATCH] kmemdup: introduce · 1a2f67b4
      Alexey Dobriyan 提交于
      One of idiomatic ways to duplicate a region of memory is
      
      	dst = kmalloc(len, GFP_KERNEL);
      	if (!dst)
      		return -ENOMEM;
      	memcpy(dst, src, len);
      
      which is neat code except a programmer needs to write size twice.  Which
      sometimes leads to mistakes.  If len passed to kmalloc is smaller that len
      passed to memcpy, it's straight overwrite-beyond-end.  If len passed to
      memcpy is smaller than len passed to kmalloc, it's either a) legit
      behaviour ;-), or b) cloned buffer will contain garbage in second half.
      
      Slight trolling of commit lists shows several duplications bugs
      done exactly because of diverged lenghts:
      
      	Linux:
      		[CRYPTO]: Fix memcpy/memset args.
      		[PATCH] memcpy/memset fixes
      	OpenBSD:
      		kerberosV/src/lib/asn1: der_copy.c:1.4
      
      If programmer is given only one place to play with lengths, I believe, such
      mistakes could be avoided.
      
      With kmemdup, the snippet above will be rewritten as:
      
      	dst = kmemdup(src, len, GFP_KERNEL);
      	if (!dst)
      		return -ENOMEM;
      
      This also leads to smaller code (kzalloc effect). Quick grep shows
      200+ places where kmemdup() can be used.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      1a2f67b4
  5. 26 3月, 2006 2 次提交
    • P
      [PATCH] slab: optimize constant-size kzalloc calls · 40c07ae8
      Pekka Enberg 提交于
      As suggested by Eric Dumazet, optimize kzalloc() calls that pass a
      compile-time constant size.  Please note that the patch increases kernel
      text slightly (~200 bytes for defconfig on x86).
      Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      40c07ae8
    • A
      [PATCH] slab: implement /proc/slab_allocators · 871751e2
      Al Viro 提交于
      Implement /proc/slab_allocators.   It produces output like:
      
      idr_layer_cache: 80 idr_pre_get+0x33/0x4e
      buffer_head: 2555 alloc_buffer_head+0x20/0x75
      mm_struct: 9 mm_alloc+0x1e/0x42
      mm_struct: 20 dup_mm+0x36/0x370
      vm_area_struct: 384 dup_mm+0x18f/0x370
      vm_area_struct: 151 do_mmap_pgoff+0x2e0/0x7c3
      vm_area_struct: 1 split_vma+0x5a/0x10e
      vm_area_struct: 11 do_brk+0x206/0x2e2
      vm_area_struct: 2 copy_vma+0xda/0x142
      vm_area_struct: 9 setup_arg_pages+0x99/0x214
      fs_cache: 8 copy_fs_struct+0x21/0x133
      fs_cache: 29 copy_process+0xf38/0x10e3
      files_cache: 30 alloc_files+0x1b/0xcf
      signal_cache: 81 copy_process+0xbaa/0x10e3
      sighand_cache: 77 copy_process+0xe65/0x10e3
      sighand_cache: 1 de_thread+0x4d/0x5f8
      anon_vma: 241 anon_vma_prepare+0xd9/0xf3
      size-2048: 1 add_sect_attrs+0x5f/0x145
      size-2048: 2 journal_init_revoke+0x99/0x302
      size-2048: 2 journal_init_revoke+0x137/0x302
      size-2048: 2 journal_init_inode+0xf9/0x1c4
      
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: Alexander Nyberg <alexn@telia.com>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Christoph Lameter <clameter@engr.sgi.com>
      Cc: Ravikiran Thirumalai <kiran@scalex86.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      DESC
      slab-leaks3-locking-fix
      EDESC
      From: Andrew Morton <akpm@osdl.org>
      
      Update for slab-remove-cachep-spinlock.patch
      
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: Alexander Nyberg <alexn@telia.com>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Christoph Lameter <clameter@engr.sgi.com>
      Cc: Ravikiran Thirumalai <kiran@scalex86.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      871751e2
  6. 24 3月, 2006 1 次提交
  7. 09 1月, 2006 1 次提交