1. 14 12月, 2006 1 次提交
    • E
      [PATCH] SLAB: use a multiply instead of a divide in obj_to_index() · 6a2d7a95
      Eric Dumazet 提交于
      When some objects are allocated by one CPU but freed by another CPU we can
      consume lot of cycles doing divides in obj_to_index().
      
      (Typical load on a dual processor machine where network interrupts are
      handled by one particular CPU (allocating skbufs), and the other CPU is
      running the application (consuming and freeing skbufs))
      
      Here on one production server (dual-core AMD Opteron 285), I noticed this
      divide took 1.20 % of CPU_CLK_UNHALTED events in kernel.  But Opteron are
      quite modern cpus and the divide is much more expensive on oldest
      architectures :
      
      On a 200 MHz sparcv9 machine, the division takes 64 cycles instead of 1
      cycle for a multiply.
      
      Doing some math, we can use a reciprocal multiplication instead of a divide.
      
      If we want to compute V = (A / B)  (A and B being u32 quantities)
      we can instead use :
      
      V = ((u64)A * RECIPROCAL(B)) >> 32 ;
      
      where RECIPROCAL(B) is precalculated to ((1LL << 32) + (B - 1)) / B
      
      Note :
      
      I wrote pure C code for clarity. gcc output for i386 is not optimal but
      acceptable :
      
      mull   0x14(%ebx)
      mov    %edx,%eax // part of the >> 32
      xor     %edx,%edx // useless
      mov    %eax,(%esp) // could be avoided
      mov    %edx,0x4(%esp) // useless
      mov    (%esp),%ebx
      
      [akpm@osdl.org: small cleanups]
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Cc: Christoph Lameter <clameter@sgi.com>
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6a2d7a95
  2. 13 12月, 2006 1 次提交
  3. 11 12月, 2006 2 次提交
  4. 09 12月, 2006 15 次提交
    • D
      [PATCH] fault-injection: optimize and simplify should_fail() · f1729c28
      Don Mullis 提交于
      Trivial optimization and simplification of should_fail().
      
      Do cheaper disqualification tests first (performance gain not quantified).
      Simplify logic; eliminate goto.
      Signed-off-by: NDon Mullis <dwm@meer.net>
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f1729c28
    • D
      [PATCH] fault-injection: Clamp debugfs stacktrace-depth to MAX_STACK_TRACE_DEPTH · a124c28e
      Don Mullis 提交于
      Clamp /debug/fail*/stacktrace-depth to MAX_STACK_TRACE_DEPTH.  Ensures that a
      read of /debug/fail*/stacktrace-depth always returns a truthful answer.
      Signed-off-by: NDon Mullis <dwm@meer.net>
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a124c28e
    • D
      [PATCH] fault-injection: Use bool-true-false throughout · 08b3df2d
      Don Mullis 提交于
      Use bool-true-false throughout.
      Signed-off-by: NDon Mullis <dwm@meer.net>
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      08b3df2d
    • A
      [PATCH] fault-injection: stacktrace filtering kconfig fix · 83ba2546
      Andrew Morton 提交于
      `select' doesn't work very well.  With alpha `make allmodconfig' we end up
      with CONFIG_STACKTRACE enabled, so we end up with undefined save_stacktrace()
      at link time.
      
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Cc: Don Mullis <dwm@meer.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      83ba2546
    • A
      [PATCH] fault-injection Kconfig cleanup · 1ab8509a
      Andrew Morton 提交于
      - Fix some spelling and grammatical errors
      
      - Make the Kconfig menu more conventional.  First you select
        fault-injection, then under that you select particular clients of it.
      
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Cc: Don Mullis <dwm@meer.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      1ab8509a
    • A
      [PATCH] fault injection: stacktrace filtering · 329409ae
      Akinobu Mita 提交于
      This patch provides stacktrace filtering feature.
      
      The stacktrace filter allows failing only for the caller you are
      interested in.
      
      For example someone may want to inject kmalloc() failures into
      only e100 module. they want to inject not only direct kmalloc() call,
      but also indirect allocation, too.
      
      - e100_poll --> netif_receive_skb --> packet_rcv_spkt --> skb_clone
        --> kmem_cache_alloc
      
      This patch enables to detect function calls like this by stacktrace
      and inject failures. The script Documentaion/fault-injection/failmodule.sh
      helps it.
      
      The range of text section of loaded e100 is expected to be
      [/sys/module/e100/sections/.text, /sys/module/e100/sections/.exit.text)
      
      So failmodule.sh stores these values into /debug/failslab/address-start
      and /debug/failslab/address-end. The maximum stacktrace depth is specified
      by /debug/failslab/stacktrace-depth.
      
      Please see the example that demonstrates how to inject slab allocation
      failures only for a specific module
      in Documentation/fault-injection/fault-injection.txt
      
      [dwm@meer.net: reject failure if any caller lies within specified range]
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NDon Mullis <dwm@meer.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      329409ae
    • A
      [PATCH] fault injection: process filtering for fault-injection capabilities · f4f154fd
      Akinobu Mita 提交于
      This patch provides process filtering feature.
      The process filter allows failing only permitted processes
      by /proc/<pid>/make-it-fail
      
      Please see the example that demostrates how to inject slab allocation
      failures into module init/cleanup code
      in Documentation/fault-injection/fault-injection.txt
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f4f154fd
    • A
      [PATCH] fault-injection capability for disk IO · c17bb495
      Akinobu Mita 提交于
      This patch provides fault-injection capability for disk IO.
      
      Boot option:
      
      fail_make_request=<probability>,<interval>,<space>,<times>
      
      	<interval> -- specifies the interval of failures.
      
      	<probability> -- specifies how often it should fail in percent.
      
      	<space> -- specifies the size of free space where disk IO can be issued
      		   safely in bytes.
      
      	<times> -- specifies how many times failures may happen at most.
      
      Debugfs:
      
      /debug/fail_make_request/interval
      /debug/fail_make_request/probability
      /debug/fail_make_request/specifies
      /debug/fail_make_request/times
      
      Example:
      
      	fail_make_request=10,100,0,-1
      	echo 1 > /sys/blocks/hda/hda1/make-it-fail
      
      generic_make_request() on /dev/hda1 fails once per 10 times.
      
      Cc: Jens Axboe <axboe@suse.de>
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c17bb495
    • A
      [PATCH] fault-injection capability for alloc_pages() · 933e312e
      Akinobu Mita 提交于
      This patch provides fault-injection capability for alloc_pages()
      
      Boot option:
      
      fail_page_alloc=<interval>,<probability>,<space>,<times>
      
      	<interval> -- specifies the interval of failures.
      
      	<probability> -- specifies how often it should fail in percent.
      
      	<space> -- specifies the size of free space where memory can be
      		   allocated safely in pages.
      
      	<times> -- specifies how many times failures may happen at most.
      
      Debugfs:
      
      /debug/fail_page_alloc/interval
      /debug/fail_page_alloc/probability
      /debug/fail_page_alloc/specifies
      /debug/fail_page_alloc/times
      /debug/fail_page_alloc/ignore-gfp-highmem
      /debug/fail_page_alloc/ignore-gfp-wait
      
      Example:
      
      	fail_page_alloc=10,100,0,-1
      
      The page allocation (alloc_pages(), ...) fails once per 10 times.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      933e312e
    • A
      [PATCH] fault-injection capability for kmalloc · 8a8b6502
      Akinobu Mita 提交于
      This patch provides fault-injection capability for kmalloc.
      
      Boot option:
      
      failslab=<interval>,<probability>,<space>,<times>
      
      	<interval> -- specifies the interval of failures.
      
      	<probability> -- specifies how often it should fail in percent.
      
      	<space> -- specifies the size of free space where memory can be
      		   allocated safely in bytes.
      
      	<times> -- specifies how many times failures may happen at most.
      
      Debugfs:
      
      /debug/failslab/interval
      /debug/failslab/probability
      /debug/failslab/specifies
      /debug/failslab/times
      /debug/failslab/ignore-gfp-highmem
      /debug/failslab/ignore-gfp-wait
      
      Example:
      
      	failslab=10,100,0,-1
      
      slab allocation (kmalloc(), kmem_cache_alloc(),..) fails once per 10 times.
      
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      8a8b6502
    • A
      [PATCH] fault-injection capabilities infrastructure · 6ff1cb35
      Akinobu Mita 提交于
      This patch provides base functions implement to fault-injection
      capabilities.
      
      - The function should_fail() is taken from failmalloc-1.0
        (http://www.nongnu.org/failmalloc/)
      
      [akpm@osdl.org: cleanups, comments, add __init]
      Cc: <okuji@enbug.org>
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NDon Mullis <dwm@meer.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6ff1cb35
    • A
      [PATCH] crc32: replace bitreverse by bitrev32 · 906d66df
      Akinobu Mita 提交于
      This patch replaces bitreverse() by bitrev32.  The only users of bitreverse()
      are crc32 itself and via-velocity.
      
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Matt Domsch <Matt_Domsch@dell.com>
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      906d66df
    • A
      [PATCH] bit reverse library · a5cfc1ec
      Akinobu Mita 提交于
      This patch provides two bit reverse functions and bit reverse table.
      
      - reverse the order of bits in a u32 value
      
      	u8 bitrev8(u8 x);
      
      - reverse the order of bits in a u32 value
      
      	u32 bitrev32(u32 x);
      
      - byte reverse table
      
      	const u8 byte_rev_table[256];
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a5cfc1ec
    • J
      [PATCH] Generic BUG for i386 · 91768d6c
      Jeremy Fitzhardinge 提交于
      This makes i386 use the generic BUG machinery.  There are no functional
      changes from the old i386 implementation.
      
      The main advantage in using the generic BUG machinery for i386 is that the
      inlined overhead of BUG is just the ud2a instruction; the file+line(+function)
      information are no longer inlined into the instruction stream.  This reduces
      cache pollution, and makes disassembly work properly.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Hugh Dickens <hugh@veritas.com>
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      91768d6c
    • J
      [PATCH] Generic BUG implementation · 7664c5a1
      Jeremy Fitzhardinge 提交于
      This patch adds common handling for kernel BUGs, for use by architectures as
      they wish.  The code is derived from arch/powerpc.
      
      The advantages of having common BUG handling are:
       - consistent BUG reporting across architectures
       - shared implementation of out-of-line file/line data
       - implement CONFIG_DEBUG_BUGVERBOSE consistently
      
      This means that in inline impact of BUG is just the illegal instruction
      itself, which is an improvement for i386 and x86-64.
      
      A BUG is represented in the instruction stream as an illegal instruction,
      which has file/line information associated with it.  This extra information is
      stored in the __bug_table section in the ELF file.
      
      When the kernel gets an illegal instruction, it first confirms it might
      possibly be from a BUG (ie, in kernel mode, the right illegal instruction).
      It then calls report_bug().  This searches __bug_table for a matching
      instruction pointer, and if found, prints the corresponding file/line
      information.  If report_bug() determines that it wasn't a BUG which caused the
      trap, it returns BUG_TRAP_TYPE_NONE.
      
      Some architectures (powerpc) implement WARN using the same mechanism; if the
      illegal instruction was the result of a WARN, then report_bug(Q) returns
      CONFIG_DEBUG_BUGVERBOSE; otherwise it returns BUG_TRAP_TYPE_BUG.
      
      lib/bug.c keeps a list of loaded modules which can be searched for __bug_table
      entries.  The architecture must call
      module_bug_finalize()/module_bug_cleanup() from its corresponding
      module_finalize/cleanup functions.
      
      Unsetting CONFIG_DEBUG_BUGVERBOSE will reduce the kernel size by some amount.
      At the very least, filename and line information will not be recorded for each
      but, but architectures may decide to store no extra information per BUG at
      all.
      
      Unfortunately, gcc doesn't have a general way to mark an asm() as noreturn, so
      architectures will generally have to include an infinite loop (or similar) in
      the BUG code, so that gcc knows execution won't continue beyond that point.
      gcc does have a __builtin_trap() operator which may be useful to achieve the
      same effect, unfortunately it cannot be used to actually implement the BUG
      itself, because there's no way to get the instruction's address for use in
      generating the __bug_table entry.
      
      [randy.dunlap@oracle.com: Handle BUG=n, GENERIC_BUG=n to prevent build errors]
      [bunk@stusta.de: include/linux/bug.h must always #include <linux/module.h]
      Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Hugh Dickens <hugh@veritas.com>
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      7664c5a1
  5. 08 12月, 2006 9 次提交
  6. 07 12月, 2006 1 次提交
  7. 04 12月, 2006 2 次提交
  8. 02 12月, 2006 1 次提交
  9. 30 11月, 2006 1 次提交
  10. 29 10月, 2006 1 次提交
  11. 28 10月, 2006 1 次提交
  12. 21 10月, 2006 1 次提交
    • A
      [PATCH] highest_possible_node_id() linkage fix · 6220ec78
      Andrew Morton 提交于
      Qooting Adrian:
      
      - net/sunrpc/svc.c uses highest_possible_node_id()
      
      - include/linux/nodemask.h says highest_possible_node_id() is
        out-of-line #if MAX_NUMNODES > 1
      
      - the out-of-line highest_possible_node_id() is in lib/cpumask.c
      
      - lib/Makefile: lib-$(CONFIG_SMP) += cpumask.o
        CONFIG_ARCH_DISCONTIGMEM_ENABLE=y, CONFIG_SMP=n, CONFIG_SUNRPC=y
      
      -> highest_possible_node_id() is used in net/sunrpc/svc.c
         CONFIG_NODES_SHIFT defined and > 0
      
      -> include/linux/numa.h: MAX_NUMNODES > 1
      
      -> compile error
      
      The bug is not present on architectures where ARCH_DISCONTIGMEM_ENABLE
      depends on NUMA (but m32r isn't the only affected architecture).
      
      So move the function into page_alloc.c
      
      Cc: Adrian Bunk <bunk@stusta.de>
      Cc: Paul Jackson <pj@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6220ec78
  13. 17 10月, 2006 2 次提交
  14. 13 10月, 2006 1 次提交
  15. 12 10月, 2006 1 次提交
    • R
      [PATCH] bitmap: parse input from kernel and user buffers · 01a3ee2b
      Reinette Chatre 提交于
      lib/bitmap.c:bitmap_parse() is a library function that received as input a
      user buffer.  This seemed to have originated from the way the write_proc
      function of the /proc filesystem operates.
      
      This has been reworked to not use kmalloc and eliminates a lot of
      get_user() overhead by performing one access_ok before using __get_user().
      
      We need to test if we are in kernel or user space (is_user) and access the
      buffer differently.  We cannot use __get_user() to access kernel addresses
      in all cases, for example in architectures with separate address space for
      kernel and user.
      
      This function will be useful for other uses as well; for example, taking
      input for /sysfs instead of /proc, so it was changed to accept kernel
      buffers.  We have this use for the Linux UWB project, as part as the
      upcoming bandwidth allocator code.
      
      Only a few routines used this function and they were changed too.
      Signed-off-by: NReinette Chatre <reinette.chatre@linux.intel.com>
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Cc: Paul Jackson <pj@sgi.com>
      Cc: Joe Korty <joe.korty@ccur.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      01a3ee2b