11 Sep, 2013

1 commit

  • Convert the driver shrinkers to the new API. Most changes are compile
    tested only because I either don't have the hardware or it's staging
    stuff.

    FWIW, the md and android code is pretty good, but the rest of it makes me
    want to claw my eyes out. The amount of broken code I just encountered is
    mind boggling. I've added comments explaining what is broken, but I fear
    that some of the code would be best dealt with by being dragged behind the
    bike shed, burying in mud up to it's neck and then run over repeatedly
    with a blunt lawn mower.

    Special mention goes to the zcache/zcache2 drivers. They can't co-exist
    in the build at the same time, they are under different menu options in
    menuconfig, they only show up when you've got the right set of mm
    subsystem options configured and so even compile testing is an exercise in
    pulling teeth. And that doesn't even take into account the horrible,
    broken code...

    [glommer@openvz.org: fixes for i915, android lowmem, zcache, bcache]
    Signed-off-by: Dave Chinner
    Signed-off-by: Glauber Costa
    Acked-by: Mel Gorman
    Cc: Daniel Vetter
    Cc: Kent Overstreet
    Cc: John Stultz
    Cc: David Rientjes
    Cc: Jerome Glisse
    Cc: Thomas Hellstrom
    Cc: "Theodore Ts'o"
    Cc: Adrian Hunter
    Cc: Al Viro
    Cc: Artem Bityutskiy
    Cc: Arve Hjønnevåg
    Cc: Carlos Maiolino
    Cc: Christoph Hellwig
    Cc: Chuck Lever
    Cc: Daniel Vetter
    Cc: David Rientjes
    Cc: Gleb Natapov
    Cc: Greg Thelen
    Cc: J. Bruce Fields
    Cc: Jan Kara
    Cc: Jerome Glisse
    Cc: John Stultz
    Cc: KAMEZAWA Hiroyuki
    Cc: Kent Overstreet
    Cc: Kirill A. Shutemov
    Cc: Marcelo Tosatti
    Cc: Mel Gorman
    Cc: Steven Whitehouse
    Cc: Thomas Hellstrom
    Cc: Trond Myklebust
    Signed-off-by: Andrew Morton

    Signed-off-by: Al Viro

    Dave Chinner
     

11 Jul, 2013

2 commits

  • This patch changes dm-bufio so that it submits write I/Os outside of the
    lock. If the number of submitted buffers is greater than the number of
    requests on the target queue, submit_bio blocks. We want to block outside
    of the lock to improve latency of other threads that may need the lock.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Use __GFP_HIGHMEM in __vmalloc.

    Pages allocated with __vmalloc can be allocated in high memory that is not
    directly mapped to kernel space, so use __GFP_HIGHMEM just like vmalloc
    does. This patch reduces memory pressure slightly because pages can be
    allocated in the high zone.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

10 May, 2013

1 commit

  • This patch uses memalloc_noio_save to avoid a possible deadlock in
    dm-bufio. (it could happen only with large block size, at most
    PAGE_SIZE << MAX_ORDER (typically 8MiB).

    __vmalloc doesn't fully respect gfp flags. The specified gfp flags are
    used for allocation of requested pages, structures vmap_area, vmap_block
    and vm_struct and the radix tree nodes.

    However, the kernel pagetables are allocated always with GFP_KERNEL.
    Thus the allocation of pagetables can recurse back to the I/O layer and
    cause a deadlock.

    This patch uses the function memalloc_noio_save to set per-process
    PF_MEMALLOC_NOIO flag and the function memalloc_noio_restore to restore
    it. When this flag is set, all allocations in the process are done with
    implied GFP_NOIO flag, thus the deadlock can't happen.

    This should be backported to stable kernels, but they don't have the
    PF_MEMALLOC_NOIO flag and memalloc_noio_save/memalloc_noio_restore
    functions. So, PF_MEMALLOC should be set and restored instead.

    Signed-off-by: Mikulas Patocka
    Cc: stable@kernel.org
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

21 Mar, 2013

1 commit

  • A deadlock was found in the prefetch code in the dm verity map
    function. This patch fixes this by transferring the prefetch
    to a worker thread and skipping it completely if kmalloc fails.

    If generic_make_request is called recursively, it queues the I/O
    request on the current->bio_list without making the I/O request
    and returns. The routine making the recursive call cannot wait
    for the I/O to complete.

    The deadlock occurs when one thread grabs the bufio_client
    mutex and waits for an I/O to complete but the I/O is queued
    on another thread's current->bio_list and is waiting to get
    the mutex held by the first thread.

    The fix recognises that prefetching is not essential. If memory
    can be allocated, it queues the prefetch request to the worker thread,
    but if not, it does nothing.

    Signed-off-by: Paul Taysom
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon
    Cc: stable@kernel.org

    Mikulas Patocka
     

02 Mar, 2013

1 commit


28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

12 Oct, 2012

2 commits

  • Use the ACCESS_ONCE macro in dm-bufio and dm-verity where a variable
    can be modified asynchronously (through sysfs) and we want to prevent
    compiler optimizations that assume that the variable hasn't changed.
    (See Documentation/atomic_ops.txt.)

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Use list_move() instead of list_del() + list_add().

    spatch with a semantic match was used to find this.
    (http://coccinelle.lip6.fr/)

    Signed-off-by: Wei Yongjun
    Signed-off-by: Alasdair G Kergon

    Wei Yongjun
     

29 Mar, 2012

1 commit

  • This patch introduces a new function dm_bufio_prefetch. It prefetches
    the specified range of blocks into dm-bufio cache without waiting
    for i/o completion.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

04 Feb, 2012

1 commit


08 Nov, 2011

1 commit


01 Nov, 2011

1 commit

  • The dm-bufio interface allows you to do cached I/O on devices,
    holding recently-read blocks in memory and performing delayed writes.

    We don't use buffer cache or page cache already present in the kernel, because:
    * we need to handle block sizes larger than a page
    * we can't allocate memory to perform reads or we'd have deadlocks

    Currently, when a cache is required, we limit its size to a fraction of
    available memory. Usage can be viewed and changed in
    /sys/module/dm_bufio/parameters/ .

    The first user is thin provisioning, but more dm users are planned.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka