08 Sep, 2005

4 commits

  • The problem is that klists claim to provide semantics for safe traversal of
    lists which are being modified. The failure case is when traversal of a
    list causes element removal (a fairly common case). The issue is that
    although the list node is refcounted, if it is embedded in an object (which
    is universally the case), then the object will be freed regardless of the
    klist refcount leading to slab corruption because the klist iterator refers
    to the prior element to get the next.

    The solution is to make the klist take and release references to the
    embedding object meaning that the embedding object won't be released until
    the list relinquishes the reference to it.

    (akpm: fast-track this because it's needed for the 2.6.13 scsi merge)

    Signed-off-by: James Bottomley
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Bottomley
     
  • Simple patch to radix_tree_tag_get() to return different values for non
    present node and tag unset.

    The function is not used by any in-kernel callers (yet), but this
    information is definitely useful.

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

    Marcelo Tosatti
     
  • - There is frequent use of indirections in the radix code. This patch
    removes those indirections, makes the code more readable and allows
    the compilers to generate better code.

    - Removing indirections allows the removal of several casts.

    - Removing indirections allows the reduction of the radix_tree_path
    size from 3 to 2 words.

    - Use pathp-> consistently.

    - Remove unnecessary tmp variable in radix_tree_insert

    - Separate the upper layer processing from the lowest layer in __lookup()
    in order to make it easier to understand what is going on and allow
    compilers to generate better code for the loop.

    Signed-off-by: Christoph Lameter
    Cc: Nick Piggin
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • This patch adds a new kernel debug feature: CONFIG_DETECT_SOFTLOCKUP.

    When enabled then per-CPU watchdog threads are started, which try to run
    once per second. If they get delayed for more than 10 seconds then a
    callback from the timer interrupt detects this condition and prints out a
    warning message and a stack dump (once per lockup incident). The feature
    is otherwise non-intrusive, it doesnt try to unlock the box in any way, it
    only gets the debug info out, automatically, and on all CPUs affected by
    the lockup.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Nishanth Aravamudan
    Signed-Off-By: Matthias Urlichs
    Signed-off-by: Richard Purdie
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

06 Sep, 2005

1 commit


05 Sep, 2005

1 commit

  • This patch moves the common code in x86 and x86-64's semaphore.c into a
    single file in lib/semaphore-sleepers.c. The arch specific asm stubs are
    left in the arch tree (in semaphore.c for i386 and in the asm for x86-64).
    There should be no changes in code/functionality with this patch.

    Signed-off-by: Benjamin LaHaise
    Cc: Andi Kleen
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benjamin LaHaise
     

30 Aug, 2005

6 commits


27 Aug, 2005

1 commit

  • There is an off by one problem with idr_get_new_above.

    The comment and function name suggest that it will return an id >
    starting_id, but it actually returned an id >= starting_id, and kernel
    callers other than inotify treated it as such.

    The patch below fixes the comment, and fixes inotifys usage. The
    function name still doesn't match the behaviour, but it never did.

    Signed-off-by: John McCutchan
    Signed-off-by: Linus Torvalds

    John McCutchan
     

24 Aug, 2005

1 commit


18 Aug, 2005

1 commit

  • It turns out that empty distance code tables are not an error, and that
    a compressed block with only literals can validly have an empty table
    and should not be flagged as a data error.

    Some old versions of gzip had problems with this case, but it does not
    affect the zlib code in the kernel.

    Analysis and explanations thanks to Sergey Vlasov

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 Aug, 2005

1 commit


06 Aug, 2005

1 commit

  • These bugs have been fixed in the standard zlib for a while.

    See for example

    a) http://sources.redhat.com/ml/bug-gnu-utils/1999-06/msg00183.html
    b) http://bugs.gentoo.org/show_bug.cgi?id=94584

    Signed-off-by: Tim Yamin
    Signed-off-by: Tavis Ormandy
    Signed-off-by: Linus Torvalds

    Tim Yamin
     

30 Jul, 2005

1 commit

  • CONFIG_DEBUG_FS=y and CONFIG_SYSFS=n results in the following compile
    error:

    ...
    LD vmlinux
    fs/built-in.o: In function `debugfs_init':
    inode.c:(.init.text+0x31be): undefined reference to `kernel_subsys'
    make: *** [vmlinux] Error 1

    Signed-off-by: Adrian Bunk
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

28 Jul, 2005

1 commit


08 Jul, 2005

1 commit

  • Add a new section called ".data.read_mostly" for data items that are read
    frequently and rarely written to like cpumaps etc.

    If these maps are placed in the .data section then these frequenly read
    items may end up in cachelines with data is is frequently updated. In that
    case all processors in an SMP system must needlessly reload the cachelines
    again and again containing elements of those frequently used variables.

    The ability to share these cachelines will allow each cpu in an SMP system
    to keep local copies of those shared cachelines thereby optimizing
    performance.

    Signed-off-by: Alok N Kataria
    Signed-off-by: Shobhit Dayal
    Signed-off-by: Christoph Lameter
    Signed-off-by: Shai Fultheim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

26 Jun, 2005

2 commits


25 Jun, 2005

1 commit


24 Jun, 2005

4 commits

  • It exports symbols.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • A finite state machine consists of n states (struct ts_fsm_token)
    representing the pattern as a finite automation. The data is read
    sequentially on a octet basis. Every state token specifies the number
    of recurrences and the type of value accepted which can be either a
    specific character or ctype based set of characters. The available
    type of recurrences include 1, (0|1), [0 n], and [1 n].

    The algorithm differs between strict/non-strict mode specyfing
    whether the pattern has to start at the first octect. Strict mode
    is enabled by default and can be disabled by inserting
    TS_FSM_HEAD_IGNORE as the first token in the chain.

    The runtime performance of the algorithm should be around O(n),
    however while in strict mode the average runtime can be better.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • Implements a linear-time string-matching algorithm due to Knuth,
    Morris, and Pratt [1]. Their algorithm avoids the explicit
    computation of the transition function DELTA altogether. Its
    matching time is O(n), for n being length(text), using just an
    auxiliary function PI[1..m], for m being length(pattern),
    precomputed from the pattern in time O(m). The array PI allows
    the transition function DELTA to be computed efficiently
    "on the fly" as needed. Roughly speaking, for any state
    "q" = 0,1,...,m and any character "a" in SIGMA, the value
    PI["q"] contains the information that is independent of "a" and
    is needed to compute DELTA("q", "a") [2]. Since the array PI
    has only m entries, whereas DELTA has O(m|SIGMA|) entries, we
    save a factor of |SIGMA| in the preprocessing time by computing
    PI rather than DELTA.

    [1] Cormen, Leiserson, Rivest, Stein
    Introdcution to Algorithms, 2nd Edition, MIT Press
    [2] See finite automation theory

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • The textsearch infrastructure provides text searching
    facitilies for both linear and non-linear data.
    Individual search algorithms are implemented in modules
    and chosen by the user.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     

22 Jun, 2005

3 commits

  • This patch contains the ia64 uncached page allocator and the generic
    allocator (genalloc). The uncached allocator was formerly part of the SN2
    mspec driver but there are several other users of it so it has been split
    off from the driver.

    The generic allocator can be used by device driver to manage special memory
    etc. The generic allocator is based on the allocator from the sym53c8xx_2
    driver.

    Various users on ia64 needs uncached memory. The SGI SN architecture requires
    it for inter-partition communication between partitions within a large NUMA
    cluster. The specific user for this is the XPC code. Another application is
    large MPI style applications which use it for synchronization, on SN this can
    be done using special 'fetchop' operations but it also benefits non SN
    hardware which may use regular uncached memory for this purpose. Performance
    of doing this through uncached vs cached memory is pretty substantial. This
    is handled by the mspec driver which I will push out in a seperate patch.

    Rather than creating a specific allocator for just uncached memory I came up
    with genalloc which is a generic purpose allocator that can be used by device
    drivers and other subsystems as they please. For instance to handle onboard
    device memory. It was derived from the sym53c7xx_2 driver's allocator which
    is also an example of a potential user (I am refraining from modifying sym2
    right now as it seems to have been under fairly heavy development recently).

    On ia64 memory has various properties within a granule, ie. it isn't safe to
    access memory as uncached within the same granule as currently has memory
    accessed in cached mode. The regular system therefore doesn't utilize memory
    in the lower granules which is mixed in with device PAL code etc. The
    uncached driver walks the EFI memmap and pulls out the spill uncached pages
    and sticks them into the uncached pool. Only after these chunks have been
    utilized, will it start converting regular cached memory into uncached memory.
    Hence the reason for the EFI related code additions.

    Signed-off-by: Jes Sorensen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jes Sorensen
     
  • This patch implements a number of smp_processor_id() cleanup ideas that
    Arjan van de Ven and I came up with.

    The previous __smp_processor_id/_smp_processor_id/smp_processor_id API
    spaghetti was hard to follow both on the implementational and on the
    usage side.

    Some of the complexity arose from picking wrong names, some of the
    complexity comes from the fact that not all architectures defined
    __smp_processor_id.

    In the new code, there are two externally visible symbols:

    - smp_processor_id(): debug variant.

    - raw_smp_processor_id(): nondebug variant. Replaces all existing
    uses of _smp_processor_id() and __smp_processor_id(). Defined
    by every SMP architecture in include/asm-*/smp.h.

    There is one new internal symbol, dependent on DEBUG_PREEMPT:

    - debug_smp_processor_id(): internal debug variant, mapped to
    smp_processor_id().

    Also, i moved debug_smp_processor_id() from lib/kernel_lock.c into a new
    lib/smp_processor_id.c file. All related comments got updated and/or
    clarified.

    I have build/boot tested the following 8 .config combinations on x86:

    {SMP,UP} x {PREEMPT,!PREEMPT} x {DEBUG_PREEMPT,!DEBUG_PREEMPT}

    I have also build/boot tested x64 on UP/PREEMPT/DEBUG_PREEMPT. (Other
    architectures are untested, but should work just fine.)

    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     
  • This patch fixes overrun of array pa:
    92 struct idr_layer *pa[MAX_LEVEL];

    in

    98 l = idp->layers;
    99 pa[l--] = NULL;

    by passing idp->layers, set in
    202 idp->layers = layers;
    to function sub_alloc in
    203 v = sub_alloc(idp, ptr, &id);

    Signed-off-by: Zaur Kambarov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zaur Kambarov
     

21 Jun, 2005

5 commits

  • Signed-off-by: Patrick Mochel
    Signed-off-by: Greg Kroah-Hartman

    diff -Nru a/lib/klist.c b/lib/klist.c

    mochel@digitalimplant.org
     
  • Signed-off-by: Patrick Mochel
    Signed-off-by: Greg Kroah-Hartman

    diff -Nru a/include/linux/klist.h b/include/linux/klist.h

    mochel@digitalimplant.org
     
  • This klist interface provides a couple of structures that wrap around
    struct list_head to provide explicit list "head" (struct klist) and
    list "node" (struct klist_node) objects. For struct klist, a spinlock
    is included that protects access to the actual list itself. struct
    klist_node provides a pointer to the klist that owns it and a kref
    reference count that indicates the number of current users of that node
    in the list.

    The entire point is to provide an interface for iterating over a list
    that is safe and allows for modification of the list during the
    iteration (e.g. insertion and removal), including modification of the
    current node on the list.

    It works using a 3rd object type - struct klist_iter - that is declared
    and initialized before an iteration. klist_next() is used to acquire the
    next element in the list. It returns NULL if there are no more items.
    This klist interface provides a couple of structures that wrap around
    struct list_head to provide explicit list "head" (struct klist) and
    list "node" (struct klist_node) objects. For struct klist, a spinlock
    is included that protects access to the actual list itself. struct
    klist_node provides a pointer to the klist that owns it and a kref
    reference count that indicates the number of current users of that node
    in the list.

    The entire point is to provide an interface for iterating over a list
    that is safe and allows for modification of the list during the
    iteration (e.g. insertion and removal), including modification of the
    current node on the list.

    It works using a 3rd object type - struct klist_iter - that is declared
    and initialized before an iteration. klist_next() is used to acquire the
    next element in the list. It returns NULL if there are no more items.
    Internally, that routine takes the klist's lock, decrements the reference
    count of the previous klist_node and increments the count of the next
    klist_node. It then drops the lock and returns.

    There are primitives for adding and removing nodes to/from a klist.
    When deleting, klist_del() will simply decrement the reference count.
    Only when the count goes to 0 is the node removed from the list.
    klist_remove() will try to delete the node from the list and block
    until it is actually removed. This is useful for objects (like devices)
    that have been removed from the system and must be freed (but must wait
    until all accessors have finished).

    Internally, that routine takes the klist's lock, decrements the reference
    count of the previous klist_node and increments the count of the next
    klist_node. It then drops the lock and returns.

    There are primitives for adding and removing nodes to/from a klist.
    When deleting, klist_del() will simply decrement the reference count.
    Only when the count goes to 0 is the node removed from the list.
    klist_remove() will try to delete the node from the list and block
    until it is actually removed. This is useful for objects (like devices)
    that have been removed from the system and must be freed (but must wait
    until all accessors have finished).

    Signed-off-by: Patrick Mochel
    Signed-off-by: Greg Kroah-Hartman

    diff -Nru a/include/linux/klist.h b/include/linux/klist.h

    mochel@digitalimplant.org
     
  • kobject: make kobject's name const char * since users should not
    attempt to change it (except by calling kobject_rename).

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • kobject: kobject_hotplug should use kobject_name() instead of
    accessing kobj->name directly since for objects with
    long names it can contain garbage.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     

29 May, 2005

1 commit

  • Until now, FRAME_POINTER was set = DEBUG_INFO for UML. Change it to be the
    default way, so that it can be enabled alone (for instance to get better
    backtraces on crashes). The call-trace dumper which uses the frame pointer is
    not yet in, I'm going to introduce it in a separate patch.

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     

06 May, 2005

3 commits

  • this clarifies the documentation on the behavier of strncpy().

    Signed-off-by: Domen Puncer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    walter harms
     
  • The regression test in lib/sort.c is currently worthless because the array
    that is generated for sorting will be all zeros. This patch fixes things
    so that the array that is generated will contain unsorted integers (that
    are not all identical) as was probably intended.

    Signed-off-by Daniel Dickman
    Signed-off-by: Domen Puncer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Domen Puncer
     
  • In include/asm-x86_64/string.h there are such comments:

    /* Use C out of line version for memcmp */
    #define memcmp __builtin_memcmp
    int memcmp(const void * cs,const void * ct,size_t count);

    This would mean that if the compiler does not decide to use __builtin_memcmp,
    it emits a call to memcmp to be satisfied by the C out-of-line version in
    lib/string.c. What happens is that after preprocessing, in lib/string.i you
    may find the definition of "__builtin_strcmp".

    Actually, by accident, in the object you will find the definition of strcmp
    and such (maybe a trick intended to redirect calls to __builtin_memcmp to the
    default memcmp when the definition is not expanded); however, this particular
    case is not a documented feature as far as I can see.

    Also, the EXPORT_SYMBOL does not work, so it's duplicated in the arch.

    I simply added some #undef to lib/string.c and removed the (now duplicated)
    exports in x86-64 and UML/x86_64 subarchs (the second ones are introduced by
    another patch I just posted for -mm).

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    CC: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     

01 May, 2005

1 commit