04 Aug, 2011

1 commit

  • The current hyper-optimized functions are overkill if you simply want to
    allocate an id for a device. Create versions which use an internal
    lock.

    In followup patches, numerous drivers are converted to use this
    interface.

    Thanks to Tejun for feedback.

    Signed-off-by: Rusty Russell
    Acked-by: Tejun Heo
    Acked-by: Jonathan Cameron
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rusty Russell
     

27 Oct, 2010

1 commit


25 Oct, 2010

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    Update broken web addresses in arch directory.
    Update broken web addresses in the kernel.
    Revert "drivers/usb: Remove unnecessary return's from void functions" for musb gadget
    Revert "Fix typo: configuation => configuration" partially
    ida: document IDA_BITMAP_LONGS calculation
    ext2: fix a typo on comment in ext2/inode.c
    drivers/scsi: Remove unnecessary casts of private_data
    drivers/s390: Remove unnecessary casts of private_data
    net/sunrpc/rpc_pipe.c: Remove unnecessary casts of private_data
    drivers/infiniband: Remove unnecessary casts of private_data
    drivers/gpu/drm: Remove unnecessary casts of private_data
    kernel/pm_qos_params.c: Remove unnecessary casts of private_data
    fs/ecryptfs: Remove unnecessary casts of private_data
    fs/seq_file.c: Remove unnecessary casts of private_data
    arm: uengine.c: remove C99 comments
    arm: scoop.c: remove C99 comments
    Fix typo configue => configure in comments
    Fix typo: configuation => configuration
    Fix typo interrest[ing|ed] => interest[ing|ed]
    Fix various typos of valid in comments
    ...

    Fix up trivial conflicts in:
    drivers/char/ipmi/ipmi_si_intf.c
    drivers/usb/gadget/rndis.c
    net/irda/irnet/irnet_ppp.c

    Linus Torvalds
     

23 Sep, 2010

1 commit


20 Aug, 2010

1 commit


03 Apr, 2009

1 commit

  • Patch for Per-CSS(Cgroup Subsys State) ID and private hierarchy code.

    This patch attaches unique ID to each css and provides following.

    - css_lookup(subsys, id)
    returns pointer to struct cgroup_subysys_state of id.
    - css_get_next(subsys, id, rootid, depth, foundid)
    returns the next css under "root" by scanning

    When cgroup_subsys->use_id is set, an id for css is maintained.

    The cgroup framework only parepares
    - css_id of root css for subsys
    - id is automatically attached at creation of css.
    - id is *not* freed automatically. Because the cgroup framework
    don't know lifetime of cgroup_subsys_state.
    free_css_id() function is provided. This must be called by subsys.

    There are several reasons to develop this.
    - Saving space .... For example, memcg's swap_cgroup is array of
    pointers to cgroup. But it is not necessary to be very fast.
    By replacing pointers(8bytes per ent) to ID (2byes per ent), we can
    reduce much amount of memory usage.

    - Scanning without lock.
    CSS_ID provides "scan id under this ROOT" function. By this, scanning
    css under root can be written without locks.
    ex)
    do {
    rcu_read_lock();
    next = cgroup_get_next(subsys, id, root, &found);
    /* check sanity of next here */
    css_tryget();
    rcu_read_unlock();
    id = found + 1
    } while(...)

    Characteristics:
    - Each css has unique ID under subsys.
    - Lifetime of ID is controlled by subsys.
    - css ID contains "ID" and "Depth in hierarchy" and stack of hierarchy
    - Allowed ID is 1-65535, ID 0 is UNUSED ID.

    Design Choices:
    - scan-by-ID v.s. scan-by-tree-walk.
    As /proc's pid scan does, scan-by-ID is robust when scanning is done
    by following kind of routine.
    scan -> rest a while(release a lock) -> conitunue from interrupted
    memcg's hierarchical reclaim does this.

    - When subsys->use_id is set, # of css in the system is limited to
    65535.

    [bharata@linux.vnet.ibm.com: remove rcu_read_lock() from css_get_next()]
    Signed-off-by: KAMEZAWA Hiroyuki
    Acked-by: Paul Menage
    Cc: Li Zefan
    Cc: Balbir Singh
    Cc: Daisuke Nishimura
    Signed-off-by: Bharata B Rao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     

02 Dec, 2008

1 commit

  • 2nd part of the fixes needed for
    http://bugzilla.kernel.org/show_bug.cgi?id=11796.

    When the idr tree is either grown or shrunk, then the update to the number
    of layers and the top pointer were not atomic. This race caused crashes.

    The attached patch fixes that by replicating the layers counter in each
    layer, thus idr_find doesn't need idp->layers anymore.

    Signed-off-by: Manfred Spraul
    Cc: Clement Calmels
    Cc: Nadia Derbey
    Cc: Pierre Peiffer
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Manfred Spraul
     

26 Jul, 2008

3 commits

  • Make idr_find rcu-safe: it can now be called inside an rcu_read critical
    section.

    Signed-off-by: Nadia Derbey
    Reviewed-by: "Paul E. McKenney"
    Cc: Manfred Spraul
    Cc: Jim Houston
    Cc: Pierre Peiffer
    Acked-by: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nadia Derbey
     
  • Do some code factorization in the return code analysis.

    Signed-off-by: Nadia Derbey
    Cc: "Paul E. McKenney"
    Cc: Manfred Spraul
    Cc: Jim Houston
    Cc: Pierre Peiffer
    Acked-by: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nadia Derbey
     
  • After scalability problems have been detected when using the sysV ipcs, I have
    proposed to use an RCU based implementation of the IDR api instead (see
    threads http://lkml.org/lkml/2008/4/11/212 and
    http://lkml.org/lkml/2008/4/29/295).

    This resulted in many people asking to convert the idr API and make it rcu
    safe (because most of the code was duplicated and thus unmaintanable and
    unreviewable).

    So here is a first attempt.

    The important change wrt to the idr API itself is during idr removes: idr
    layers are freed after a grace period, instead of being moved to the free
    list.

    The important change wrt to ipcs, is that idr_find() can now be called
    locklessly inside a rcu read critical section.

    Here are the results I've got for the pmsg test sent by Manfred:

    2.6.25-rc3-mm1 2.6.25-rc3-mm1+ 2.6.25-mm1 Patched 2.6.25-mm1
    1 1168441 1064021 876000 947488
    2 1094264 921059 1549592 1730685
    3 2082520 1738165 1694370 2324880
    4 2079929 1695521 404553 2400408
    5 2898758 406566 391283 3246580
    6 2921417 261275 263249 3752148
    7 3308761 126056 191742 4243142
    8 3329456 100129 141722 4275780

    1st column: stock 2.6.25-rc3-mm1
    2nd column: 2.6.25-rc3-mm1 + ipc patches (store ipcs into idrs)
    3nd column: stock 2.6.25-mm1
    4th column: 2.6.25-mm1 + this pacth series.

    This patch:

    Add an rcu_head to the idr_layer structure in order to free it after a grace
    period.

    Signed-off-by: Nadia Derbey
    Reviewed-by: "Paul E. McKenney"
    Cc: Manfred Spraul
    Cc: Jim Houston
    Cc: Pierre Peiffer
    Acked-by: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nadia Derbey
     

29 Apr, 2008

1 commit

  • Avoid a possible kmem_cache_create() failure by creating idr_layer_cache
    unconditionary at boot time rather than creating it on-demand when idr_init()
    is called the first time.

    This change also enables us to eliminate the check every time idr_init() is
    called.

    [akpm@linux-foundation.org: rename init_id_cache() to idr_init_cache()]
    [akpm@linux-foundation.org: fix alpha build]
    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

17 Jul, 2007

2 commits

  • Remove all ids from the given idr tree. idr_destroy() only frees up
    unused, cached idp_layers, but this function will remove all id mappings
    and leave all idp_layers unused.

    A typical clean-up sequence for objects stored in an idr tree, will use
    idr_for_each() to free all objects, if necessay, then idr_remove_all() to
    remove all ids, and idr_destroy() to free up the cached idr_layers.

    Signed-off-by: Kristian Hoegsberg
    Cc: Tejun Heo
    Cc: Dave Airlie
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kristian Hoegsberg
     
  • This patch adds an iterator function for the idr data structure. Compared
    to just iterating through the idr with an integer and idr_find, this
    iterator is (almost, but not quite) linear in the number of elements, as
    opposed to the number of integers in the range covered by the idr. This
    makes a difference for sparse idrs, but more importantly, it's a nicer way
    to iterate through the elements.

    The drm subsystem is moving to idr for tracking contexts and drawables, and
    with this change, we can use the idr exclusively for tracking these
    resources.

    [akpm@linux-foundation.org: fix comment]
    Signed-off-by: Kristian Hoegsberg
    Cc: Tejun Heo
    Cc: Dave Airlie
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kristian Hoegsberg
     

12 Jul, 2007

1 commit

  • Implement idr based id allocator. ida is used the same way idr is
    used but lacks id -> ptr translation and thus consumes much less
    memory. struct ida_bitmap is attached as leaf nodes to idr tree which
    is managed by the idr code. Each ida_bitmap is 128bytes long and
    contains slightly less than a thousand slots.

    ida is more aggressive with releasing extra resources acquired using
    ida_pre_get(). After every successful id allocation, ida frees one
    reserved idr_layer if possible. Reserved ida_bitmap is not freed
    automatically but only one ida_bitmap is reserved and it's almost
    always used right away. Under most circumstances, ida won't hold on
    to memory for too long which isn't actively used.

    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     

04 Jul, 2006

1 commit


27 Jun, 2006

1 commit

  • This patch adds idr_replace() to replace an existing pointer in a single
    operation.

    Device-mapper will use this to update the pointer it stored against a given
    id.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Alasdair G Kergon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     

09 Nov, 2005

1 commit


28 Oct, 2005

1 commit


24 Oct, 2005

1 commit

  • Fix a bug which was reported and diagnosed by
    Stefan Jones

    IDR trees include a cache of idr_layer objects. There's no way to destroy
    this cache, so when we discard an overall idr tree we end up leaking some
    memory.

    Add and use idr_destroy() for this. v9fs and infiniband also need to use
    idr_destroy() to avoid leaks.

    Or, we make the cache global, like radix_tree_preload(). Which is probably
    better. Later.

    Cc: Eric Van Hensbergen
    Cc: Roland Dreier
    Cc: Robert Love
    Cc: John McCutchan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds