18 Jul, 2007

40 commits

  • Pointed out by Michal Schmidt .

    The bug was introduced in 2.6.22 by me.

    cleanup_workqueue_thread() does flush_cpu_workqueue(cwq) in a loop until
    ->worklist becomes empty. This is live-lockable, a re-niced caller can get
    CPU after wake_up() and insert a new barrier before the lower-priority
    cwq->thread has a chance to clear ->current_work.

    Change cleanup_workqueue_thread() to do flush_cpu_workqueue(cwq) only once.
    We can rely on the fact that run_workqueue() won't return until it flushes
    all works. So it is safe to call kthread_stop() after that, the "should
    stop" request won't be noticed until run_workqueue() returns.

    Signed-off-by: Oleg Nesterov
    Cc: Michal Schmidt
    Cc: Srivatsa Vaddagiri
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Based on usage and testing over the past couple of years, kprobes on
    i386, ia64, powerpc and x86_64 is no longer EXPERIMENTAL.

    This is a follow-up to Robert P.J. Day's patch making "Instrumentation
    support" non-EXPERIMENTAL:

    http://marc.info/?l=linux-kernel&m=118396955423812&w=2

    Arch maintainers for sparc64, avr32 and s390 need to take a similar call.

    Signed-off-by: Ananth N Mavinakayanahalli
    Cc: Andi Kleen
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Cc: "Luck, Tony"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ananth N Mavinakayanahalli
     
  • Make arguments of timespec_equal() const struct timespec.

    Signed-off-by: Jan Engelhardt
    Cc: Thomas Gleixner
    Cc: john stultz
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Engelhardt
     
  • KSYM_NAME_LEN is peculiar in that it does not include the space for the
    trailing '\0', forcing all users to use KSYM_NAME_LEN + 1 when allocating
    buffer. This is nonsense and error-prone. Moreover, when the caller
    forgets that it's very likely to subtly bite back by corrupting the stack
    because the last position of the buffer is always cleared to zero.

    This patch increments KSYM_NAME_LEN by one and updates code accordingly.

    * off-by-one bug in asm-powerpc/kprobes.h::kprobe_lookup_name() macro
    is fixed.

    * Where MODULE_NAME_LEN and KSYM_NAME_LEN were used together,
    MODULE_NAME_LEN was treated as if it didn't include space for the
    trailing '\0'. Fix it.

    Signed-off-by: Tejun Heo
    Acked-by: Paulo Marques
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     
  • This is a driver for the SB1250 DUART, a dual serial port implementation
    included in the Broadcom family of SOCs descending from the SiByte SB1250
    MIPS64 chip multiprocessor. It is a new implementation replacing the
    old-fashioned driver currently present in the linux-mips.org tree. It
    supports all the usual features one would expect from a(n asynchronous)
    serial driver, including modem line control (as far as hardware supports it
    -- there is edge detection logic missing from the DCD and RI lines and the
    driver does not implement polling of these lines at the moment), the serial
    console, BREAK transmission and reception, including the magic SysRq. The
    receive FIFO threshold is not maintained though.

    The driver was tested with a SWARM board which uses a BCM1250 SOC (which is
    dual MIPS64 CMP) and has both ports of the single DUART implemented wired
    externally. Both were tested. Testing included using the ports as
    terminal lines at 1200bps (which is the ports minimum), 115200bps and a
    couple of random speeds inbetween. The modem lines were verified to
    operate correctly. No testing was performed with a use as a network
    interface, like with SLIP or PPP.

    Signed-off-by: Maciej W. Rozycki
    Acked-by: Ralf Baechle
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maciej W. Rozycki
     
  • The CHILD_MAX macro in limits.h should not be there. It claims to be the
    limit on processes a user can own, but its value is wrong for that.
    There is no constant value, but a variable resource limit (RLIMIT_NPROC).
    Nothing in the kernel uses CHILD_MAX.

    The proper thing to do according to POSIX is not to define CHILD_MAX at all.
    The sysconf (_SC_CHILD_MAX) implementation works by calling getrlimit.

    Signed-off-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland McGrath
     
  • The OPEN_MAX macro in limits.h should not be there. It claims to be the
    limit on file descriptors in a process, but its value is wrong for that.
    There is no constant value, but a variable resource limit (RLIMIT_NOFILE).
    Nothing in the kernel uses OPEN_MAX except things that are wrong to do so.
    I've submitted other patches to remove those uses.

    The proper thing to do according to POSIX is not to define OPEN_MAX at all.
    The sysconf (_SC_OPEN_MAX) implementation works by calling getrlimit.

    Signed-off-by: Roland McGrath
    Cc: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland McGrath
     
  • The OPEN_MAX constant is an arbitrary number with no useful relation to
    anything. Nothing should be using it. SCM_MAX_FD is just an arbitrary
    constant and it should be clear that its value is chosen in net/scm.h
    and not actually derived from anything else meaningful in the system.

    Signed-off-by: Roland McGrath
    Cc: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland McGrath
     
  • Put WARN_ON and fixed all callers of unregister_blkdev(). Now we can make
    unregister_blkdev return void.

    Cc: Jens Axboe
    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     
  • No need to warn unregister_blkdev() failure by caller. (The previous patch
    makes unregister_blkdev() print error message in error case)

    Acked-by: Grant Likely
    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     
  • No need to warn unregister_blkdev() failure by the callers. (The previous
    patch makes unregister_blkdev() print error message in error case)

    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     
  • When unregister_blkdev() has failed, something wrong happened. This patch
    adds WARN_ON to notify of such badness.

    Cc: Jens Axboe
    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     
  • Add a proper prototype for proc_nr_files() in include/linux/fs.h

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Identical implementations of PTRACE_POKEDATA go into generic_ptrace_pokedata()
    function.

    AFAICS, fix bug on xtensa where successful PTRACE_POKEDATA will nevertheless
    return EPERM.

    Signed-off-by: Alexey Dobriyan
    Cc: Christoph Hellwig
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Identical implementations of PTRACE_PEEKDATA go into generic_ptrace_peekdata()
    function.

    Signed-off-by: Alexey Dobriyan
    Cc: Christoph Hellwig
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • If the kernel OOPSed or BUGed then it probably should be considered as
    tainted. Thus, all subsequent OOPSes and SysRq dumps will report the
    tainted kernel. This saves a lot of time explaining oddities in the
    calltraces.

    Signed-off-by: Pavel Emelianov
    Acked-by: Randy Dunlap
    Cc:
    Signed-off-by: Andrew Morton
    [ Added parisc patch from Matthew Wilson -Linus ]
    Signed-off-by: Linus Torvalds

    Pavel Emelianov
     
  • Tested on Xilinx Virtex ppc405, Katmai 440SPe, and Microblaze

    Signed-off-by: Grant Likely
    Acked-by: Stefan Roese
    Cc: Jens Axboe
    Cc: John William
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Grant Likely
     
  • Rolling forward PCMCIA driver, it was discovered that the indentation in
    existing one, as well as in BSP side are very odd. This patch is just result
    of Lindent run ontop of culprit files.

    Signed-off-by: Vitaly Bordug
    Cc: Arnd Bergmann
    Cc: Olof Johansson
    Cc: Dominik Brodowski
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Cc: Kumar Gala
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vitaly Bordug
     
  • The bounce buffer logic is included on systems that do not need it. If a
    system does not have zones like ZONE_DMA and ZONE_HIGHMEM that can lead to
    the use of bounce buffers then there is no need to reserve memory pools etc
    etc. This is true f.e. for SGI Altix.

    Also nicifies the Makefile and gets rid of the tricky "and" there.

    Signed-off-by: Christoph Lameter
    Acked-by: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Currently, the freezer treats all tasks as freezable, except for the kernel
    threads that explicitly set the PF_NOFREEZE flag for themselves. This
    approach is problematic, since it requires every kernel thread to either
    set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
    care for the freezing of tasks at all.

    It seems better to only require the kernel threads that want to or need to
    be frozen to use some freezer-related code and to remove any
    freezer-related code from the other (nonfreezable) kernel threads, which is
    done in this patch.

    The patch causes all kernel threads to be nonfreezable by default (ie. to
    have PF_NOFREEZE set by default) and introduces the set_freezable()
    function that should be called by the freezable kernel threads in order to
    unset PF_NOFREEZE. It also makes all of the currently freezable kernel
    threads call set_freezable(), so it shouldn't cause any (intentional)
    change of behaviour to appear. Additionally, it updates documentation to
    describe the freezing of tasks more accurately.

    [akpm@linux-foundation.org: build fixes]
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Nigel Cunningham
    Cc: Pavel Machek
    Cc: Oleg Nesterov
    Cc: Gautham R Shenoy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • It is a bug to set a page dirty if it is not uptodate unless it has
    buffers. If the page has buffers, then the page may be dirty (some buffers
    dirty) but not uptodate (some buffers not uptodate). The exception to this
    rule is if the set_page_dirty caller is racing with truncate or invalidate.

    A buffer can not be set dirty if it is not uptodate.

    If either of these situations occurs, it indicates there could be some data
    loss problem. Some of these warnings could be a harmless one where the
    page or buffer is set uptodate immediately after it is dirtied, however we
    should fix those up, and enforce this ordering.

    Bring the order of operations for truncate into line with those of
    invalidate. This will prevent a page from being able to go !uptodate while
    we're holding the tree_lock, which is probably a good thing anyway.

    Signed-off-by: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     
  • Signed-off-by: Robert P. J. Day
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     
  • Detect slab objects being passed to the page oriented functions of the VM.

    It is not sufficient to simply return NULL because the functions calling
    page_mapping may depend on other items of the page_struct also to be setup
    properly. Moreover slab object may not be properly aligned. The page
    oriented functions of the VM expect to operate on page aligned, page sized
    objects. Operations on object straddling page boundaries may only affect the
    objects partially which may lead to surprising results.

    It is better to detect eventually remaining uses and eliminate them.

    Signed-off-by: Christoph Lameter
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • There are some reports that 2.6.22 has SLUB as the default. Not
    true!

    This will make SLUB the default for 2.6.23.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • We currently cannot disable CONFIG_SLUB_DEBUG for CONFIG_NUMA. Now that
    embedded systems start to use NUMA we may need this.

    Put an #ifdef around places where NUMA only code uses fields only valid
    for CONFIG_SLUB_DEBUG.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Sysfs can do a gazillion things when called. Make sure that we do not call
    any sysfs functions while holding the slub_lock.

    Just protect the essentials:

    1. The list of all slab caches
    2. The kmalloc_dma array
    3. The ref counters of the slabs.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • The objects per slab increase with the current patches in mm since we allow up
    to order 3 allocs by default. More patches in mm actually allow to use 2M or
    higher sized slabs. For slab validation we need per object bitmaps in order
    to check a slab. We end up with up to 64k objects per slab resulting in a
    potential requirement of 8K stack space. That does not look good.

    Allocate the bit arrays via kmalloc.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • kmalloc_node() and kmem_cache_alloc_node() were not available in a zeroing
    variant in the past. But with __GFP_ZERO it is possible now to do zeroing
    while allocating.

    Use __GFP_ZERO to remove the explicit clearing of memory via memset whereever
    we can.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • It becomes now easy to support the zeroing allocs with generic inline
    functions in slab.h. Provide inline definitions to allow the continued use of
    kzalloc, kmem_cache_zalloc etc but remove other definitions of zeroing
    functions from the slab allocators and util.c.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • We can get to the length of the object through the kmem_cache_structure. The
    additional parameter does no good and causes the compiler to generate bad
    code.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Do proper spacing and we only need to do this in steps of 8.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Signed-off-by: Adrian Bunk
    Cc: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • There is no need to caculate the dma slab size ourselves. We can simply
    lookup the size of the corresponding non dma slab.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • kmalloc_index is a long series of comparisons. The attempt to replace
    kmalloc_index with something more efficient like ilog2 failed due to compiler
    issues with constant folding on gcc 3.3 / powerpc.

    kmalloc_index()'es long list of comparisons works fine for constant folding
    since all the comparisons are optimized away. However, SLUB also uses
    kmalloc_index to determine the slab to use for the __kmalloc_xxx functions.
    This leads to a large set of comparisons in get_slab().

    The patch here allows to get rid of that list of comparisons in get_slab():

    1. If the requested size is larger than 192 then we can simply use
    fls to determine the slab index since all larger slabs are
    of the power of two type.

    2. If the requested size is smaller then we cannot use fls since there
    are non power of two caches to be considered. However, the sizes are
    in a managable range. So we divide the size by 8. Then we have only
    24 possibilities left and then we simply look up the kmalloc index
    in a table.

    Code size of slub.o decreases by more than 200 bytes through this patch.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • We modify the kmalloc_cache_dma[] array without proper locking. Do the proper
    locking and undo the dma cache creation if another processor has already
    created it.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • The rarely used dma functionality in get_slab() makes the function too
    complex. The compiler begins to spill variables from the working set onto the
    stack. The created function is only used in extremely rare cases so make sure
    that the compiler does not decide on its own to merge it back into get_slab().

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Add #ifdefs around data structures only needed if debugging is compiled into
    SLUB.

    Add inlines to small functions to reduce code size.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • A kernel convention for many allocators is that if __GFP_ZERO is passed to an
    allocator then the allocated memory should be zeroed.

    This is currently not supported by the slab allocators. The inconsistency
    makes it difficult to implement in derived allocators such as in the uncached
    allocator and the pool allocators.

    In addition the support zeroed allocations in the slab allocators does not
    have a consistent API. There are no zeroing allocator functions for NUMA node
    placement (kmalloc_node, kmem_cache_alloc_node). The zeroing allocations are
    only provided for default allocs (kzalloc, kmem_cache_zalloc_node).
    __GFP_ZERO will make zeroing universally available and does not require any
    addititional functions.

    So add the necessary logic to all slab allocators to support __GFP_ZERO.

    The code is added to the hot path. The gfp flags are on the stack and so the
    cacheline is readily available for checking if we want a zeroed object.

    Zeroing while allocating is now a frequent operation and we seem to be
    gradually approaching a 1-1 parity between zeroing and not zeroing allocs.
    The current tree has 3476 uses of kmalloc vs 2731 uses of kzalloc.

    Signed-off-by: Christoph Lameter
    Acked-by: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Define ZERO_OR_NULL_PTR macro to be able to remove the checks from the
    allocators. Move ZERO_SIZE_PTR related stuff into slab.h.

    Make ZERO_SIZE_PTR work for all slab allocators and get rid of the
    WARN_ON_ONCE(size == 0) that is still remaining in SLAB.

    Make slub return NULL like the other allocators if a too large memory segment
    is requested via __kmalloc.

    Signed-off-by: Christoph Lameter
    Acked-by: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • The size of a kmalloc object is readily available via ksize(). ksize is
    provided by all allocators and thus we can implement krealloc in a generic
    way.

    Implement krealloc in mm/util.c and drop slab specific implementations of
    krealloc.

    Signed-off-by: Christoph Lameter
    Acked-by: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter