16 Jan, 2016

1 commit


07 Nov, 2015

1 commit


09 Sep, 2015

2 commits


26 Jun, 2015

1 commit

  • Remove zpool_evict() helper function. As zbud is currently the only
    zpool implementation that supports eviction, add zpool and zpool_ops
    references to struct zbud_pool and directly call zpool_ops->evict(zpool,
    handle) on eviction.

    Currently zpool provides the zpool_evict helper which locks the zpool
    list lock and searches through all pools to find the specific one
    matching the caller, and call the corresponding zpool_ops->evict
    function. However, this is unnecessary, as the zbud pool can simply
    keep a reference to the zpool that created it, as well as the zpool_ops,
    and directly call the zpool_ops->evict function, when it needs to evict
    a page. This avoids a spinlock and list search in zpool for each
    eviction.

    Signed-off-by: Dan Streetman
    Cc: Seth Jennings
    Cc: Minchan Kim
    Cc: Nitin Gupta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Streetman
     

13 Feb, 2015

1 commit

  • Currently the underlay of zpool: zsmalloc/zbud, do not know who creates
    them. There is not a method to let zsmalloc/zbud find which caller they
    belong to.

    Now we want to add statistics collection in zsmalloc. We need to name the
    debugfs dir for each pool created. The way suggested by Minchan Kim is to
    use a name passed by caller(such as zram) to create the zsmalloc pool.

    /sys/kernel/debug/zsmalloc/zram0

    This patch adds an argument `name' to zs_create_pool() and other related
    functions.

    Signed-off-by: Ganesh Mahendran
    Acked-by: Minchan Kim
    Cc: Seth Jennings
    Cc: Nitin Gupta
    Cc: Dan Streetman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ganesh Mahendran
     

14 Dec, 2014

1 commit

  • When zbud is initialized through the zpool wrapper, pool->ops which
    points to user-defined operations is always set regardless of whether it
    is specified from the upper layer. This causes zbud_reclaim_page() to
    iterate its loop for evicting pool pages out without any gain.

    This patch sets the user-defined ops only when it is needed, so that
    zbud_reclaim_page() can bail out the reclamation loop earlier if there
    is no user-defined operations specified.

    Signed-off-by: Heesub Shin
    Acked-by: Dan Streetman
    Cc: Seth Jennings
    Cc: Sunae Seo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Heesub Shin
     

20 Nov, 2014

1 commit


13 Nov, 2014

1 commit


10 Oct, 2014

1 commit

  • For now, there are NCHUNKS of 64 freelists in zbud_pool, the last
    unbuddied[63] freelist linked with all zbud pages which have free chunks
    of 63. Calculating according to context of num_free_chunks(), our max
    chunk number of unbuddied zbud page is 62, so none of zbud pages will be
    added/removed in last freelist, but still we will try to find an unbuddied
    zbud page in the last unused freelist, it is unneeded.

    This patch redefines NCHUNKS to 63 as free chunk number in one zbud page,
    hence we can decrease size of zpool and avoid accessing the last unused
    freelist whenever failing to allocate zbud from freelist in zbud_alloc.

    Signed-off-by: Chao Yu
    Cc: Seth Jennings
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chao Yu
     

30 Aug, 2014

1 commit

  • To avoid potential format string expansion via module parameters, do not
    use the zpool type directly in request_module() without a format string.
    Additionally, to avoid arbitrary modules being loaded via zpool API
    (e.g. via the zswap_zpool_type module parameter) add a "zpool-" prefix
    to the requested module, as well as module aliases for the existing
    zpool types (zbud and zsmalloc).

    Signed-off-by: Kees Cook
    Cc: Seth Jennings
    Cc: Minchan Kim
    Cc: Nitin Gupta
    Acked-by: Dan Streetman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

07 Aug, 2014

2 commits

  • Update zbud and zsmalloc to implement the zpool api.

    [fengguang.wu@intel.com: make functions static]
    Signed-off-by: Dan Streetman
    Tested-by: Seth Jennings
    Cc: Minchan Kim
    Cc: Nitin Gupta
    Cc: Weijie Yang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Streetman
     
  • Change the type of the zbud_alloc() size param from unsigned int to
    size_t.

    Technically, this should not make any difference, as the zbud
    implementation already restricts the size to well within either type's
    limits; but as zsmalloc (and kmalloc) use size_t, and zpool will use
    size_t, this brings the size parameter type in line with zsmalloc/zpool.

    Signed-off-by: Dan Streetman
    Acked-by: Seth Jennings
    Tested-by: Seth Jennings
    Cc: Weijie Yang
    Cc: Minchan Kim
    Cc: Nitin Gupta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Streetman
     

05 Jun, 2014

1 commit


12 Sep, 2013

1 commit


01 Aug, 2013

1 commit

  • zbud_alloc() incorrectly verifies the size of allocation limit. It
    should deny the allocation request greater than (PAGE_SIZE -
    ZHDR_SIZE_ALIGNED - CHUNK_SIZE), not (PAGE_SIZE - ZHDR_SIZE_ALIGNED)
    which has no remaining spaces for its buddy. There is no point in
    spending the entire zbud page storing only a single page, since we don't
    have any benefits.

    Signed-off-by: Heesub Shin
    Acked-by: Seth Jennings
    Cc: Bob Liu
    Cc: Dongjun Shin
    Cc: Sunae Seo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Heesub Shin
     

11 Jul, 2013

1 commit

  • zbud is an special purpose allocator for storing compressed pages. It
    is designed to store up to two compressed pages per physical page.
    While this design limits storage density, it has simple and
    deterministic reclaim properties that make it preferable to a higher
    density approach when reclaim will be used.

    zbud works by storing compressed pages, or "zpages", together in pairs
    in a single memory page called a "zbud page". The first buddy is "left
    justifed" at the beginning of the zbud page, and the last buddy is
    "right justified" at the end of the zbud page. The benefit is that if
    either buddy is freed, the freed buddy space, coalesced with whatever
    slack space that existed between the buddies, results in the largest
    possible free region within the zbud page.

    zbud also provides an attractive lower bound on density. The ratio of
    zpages to zbud pages can not be less than 1. This ensures that zbud can
    never "do harm" by using more pages to store zpages than the
    uncompressed zpages would have used on their own.

    This implementation is a rewrite of the zbud allocator internally used
    by zcache in the driver/staging tree. The rewrite was necessary to
    remove some of the zcache specific elements that were ingrained
    throughout and provide a generic allocation interface that can later be
    used by zsmalloc and others.

    This patch adds zbud to mm/ for later use by zswap.

    Signed-off-by: Seth Jennings
    Acked-by: Rik van Riel
    Cc: Greg Kroah-Hartman
    Cc: Nitin Gupta
    Cc: Minchan Kim
    Cc: Konrad Rzeszutek Wilk
    Cc: Dan Magenheimer
    Cc: Robert Jennings
    Cc: Jenifer Hopper
    Cc: Mel Gorman
    Cc: Johannes Weiner
    Cc: Larry Woodman
    Cc: Benjamin Herrenschmidt
    Cc: Dave Hansen
    Cc: Joe Perches
    Cc: Joonsoo Kim
    Cc: Cody P Schafer
    Cc: Hugh Dickens
    Cc: Paul Mackerras
    Cc: Bob Liu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Seth Jennings