]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: zbud: remove zbud
authorYosry Ahmed <yosry.ahmed@linux.dev>
Wed, 29 Jan 2025 18:06:32 +0000 (18:06 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 17 Mar 2025 05:06:01 +0000 (22:06 -0700)
The zbud compressed pages allocator is rarely used, most users use
zsmalloc.  zbud consumes much more memory (only stores 1 or 2 compressed
pages per physical page).  The only advantage of zbud is a marginal
performance improvement that by no means justify the memory overhead.

Historically, zsmalloc had significantly worse latency than zbud and
z3fold but offered better memory savings.  This is no longer the case as
shown by a simple recent analysis [1].  In a kernel build test on tmpfs in
a limited cgroup, zbud 2-3% less time than zsmalloc, but at the cost of
using ~32% more memory (1.5G vs 1.13G).  The tradeoff does not make sense
for zbud in any practical scenario.

The only alleged advantage of zbud is not having the dependency on
CONFIG_MMU, but CONFIG_SWAP already depends on CONFIG_MMU anyway, and zbud
is only used by zswap.

Remove zbud after z3fold's removal, leaving zsmalloc as the one and only
zpool allocator.  Leave the removal of the zpool API (and its associated
config options) to a followup cleanup after no more allocators show up.

Deprecating zbud for a few cycles before removing it was initially
proposed [2], like z3fold was marked as deprecated for 2 cycles [3].
However, Johannes rightfully pointed out that the 2 cycles is too short
for most downstream consumers, and z3fold was deprecated first only as a
courtesy anyway.

[1]https://lore.kernel.org/lkml/CAJD7tkbRF6od-2x_L8-A1QL3=2Ww13sCj4S3i4bNndqF+3+_Vg@mail.gmail.com/
[2]https://lore.kernel.org/lkml/Z5gdnSX5Lv-nfjQL@google.com/
[3]https://lore.kernel.org/lkml/20240904233343.933462-1-yosryahmed@google.com/

Link: https://lkml.kernel.org/r/20250129180633.3501650-3-yosry.ahmed@linux.dev
Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: WANG Xuerui <kernel@xen0n.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
CREDITS
Documentation/admin-guide/mm/zswap.rst
MAINTAINERS
arch/loongarch/configs/loongson3_defconfig
arch/s390/configs/debug_defconfig
arch/s390/configs/defconfig
include/linux/zpool.h
mm/Kconfig
mm/Makefile
mm/zbud.c [deleted file]
mm/zpool.c

diff --git a/CREDITS b/CREDITS
index aeccd79f9778a62f93cc8f41ac0862f62c832116..5e65bf8553ba3cb7e7a24e2bbf5211937e2ed48b 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1895,6 +1895,7 @@ S: Czech Republic
 N: Seth Jennings
 E: sjenning@redhat.com
 D: Creation and maintenance of zswap
+D: Creation and maintenace of the zbud allocator
 
 N: Jeremy Kerr
 D: Maintainer of SPU File System
@@ -3788,6 +3789,7 @@ N: Dan Streetman
 E: ddstreet@ieee.org
 D: Maintenance and development of zswap
 D: Creation and maintenance of the zpool API
+D: Maintenace of the zbud allocator
 
 N: Drew Sullivan
 E: drew@ss.org
index 3598dcd7dbe7e152432e821009a4684d2087f3e4..fd3370aa43fe869112c4bc6c5e78ca6a169aac65 100644 (file)
@@ -60,15 +60,13 @@ accessed.  The compressed memory pool grows on demand and shrinks as compressed
 pages are freed.  The pool is not preallocated.  By default, a zpool
 of type selected in ``CONFIG_ZSWAP_ZPOOL_DEFAULT`` Kconfig option is created,
 but it can be overridden at boot time by setting the ``zpool`` attribute,
-e.g. ``zswap.zpool=zbud``. It can also be changed at runtime using the sysfs
+e.g. ``zswap.zpool=zsmalloc``. It can also be changed at runtime using the sysfs
 ``zpool`` attribute, e.g.::
 
-       echo zbud > /sys/module/zswap/parameters/zpool
+       echo zsmalloc > /sys/module/zswap/parameters/zpool
 
-The zbud type zpool allocates exactly 1 page to store 2 compressed pages, which
-means the compression ratio will always be 2:1 or worse (because of half-full
-zbud pages).  The zsmalloc type zpool has a more complex compressed page
-storage method, and it can achieve greater storage densities.
+The zsmalloc type zpool has a complex compressed page storage method, and it
+can achieve great storage densities.
 
 When a swap page is passed from swapout to zswap, zswap maintains a mapping
 of the swap entry, a combination of the swap type and swap offset, to the zpool
index a65a73227e3dffc25e94dee96c636562b4e69d6e..60421d3e48a8f7b50c4a709a0d69800e38f8533b 100644 (file)
@@ -26191,13 +26191,6 @@ F:     Documentation/networking/device_drivers/hamradio/z8530drv.rst
 F:     drivers/net/hamradio/*scc.c
 F:     drivers/net/hamradio/z8530.h
 
-ZBUD COMPRESSED PAGE ALLOCATOR
-M:     Seth Jennings <sjenning@redhat.com>
-M:     Dan Streetman <ddstreet@ieee.org>
-L:     linux-mm@kvack.org
-S:     Maintained
-F:     mm/zbud.c
-
 ZD1211RW WIRELESS DRIVER
 L:     linux-wireless@vger.kernel.org
 S:     Orphan
index 73c77500ac467f1a8c58cb2254cf39c0c03b6592..7ce5beb3cbf3497e44fdc3f17f67ff1721b60af2 100644 (file)
@@ -109,8 +109,7 @@ CONFIG_BINFMT_MISC=m
 CONFIG_ZPOOL=y
 CONFIG_ZSWAP=y
 CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y
-CONFIG_ZBUD=y
-CONFIG_ZSMALLOC=m
+CONFIG_ZSMALLOC=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_MEMORY_HOTPLUG=y
 # CONFIG_MHP_DEFAULT_ONLINE_TYPE_OFFLINE is not set
index 80bdfbae6e5b4d86835ea1f6645fa25d0e123076..074df63283769575bdfc04ab7b387e244f602d99 100644 (file)
@@ -92,7 +92,7 @@ CONFIG_UNIXWARE_DISKLABEL=y
 CONFIG_IOSCHED_BFQ=y
 CONFIG_BINFMT_MISC=m
 CONFIG_ZSWAP=y
-CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD=y
+CONFIG_ZSMALLOC=y
 CONFIG_ZSMALLOC_STAT=y
 CONFIG_SLAB_BUCKETS=y
 CONFIG_SLUB_STATS=y
index 449a0e996b963be51de3fe44c4886037536224cd..ac68e663dd4dc5996283060cb9f431409214e0b2 100644 (file)
@@ -86,7 +86,7 @@ CONFIG_UNIXWARE_DISKLABEL=y
 CONFIG_IOSCHED_BFQ=y
 CONFIG_BINFMT_MISC=m
 CONFIG_ZSWAP=y
-CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD=y
+CONFIG_ZSMALLOC=y
 CONFIG_ZSMALLOC_STAT=y
 CONFIG_SLAB_BUCKETS=y
 # CONFIG_COMPAT_BRK is not set
index a67d62b796980a6bae9d695bd93ef23f533ba164..5e6dc46b8cc4cb5f423ad29f65d868a18edf262f 100644 (file)
@@ -4,9 +4,8 @@
  *
  * Copyright (C) 2014 Dan Streetman
  *
- * This is a common frontend for the zbud and zsmalloc memory
- * storage pool implementations.  Typically, this is used to
- * store compressed memory.
+ * This is a common frontend for the zswap compressed memory storage
+ * implementations.
  */
 
 #ifndef _ZPOOL_H_
index 6fa19022c09b812f44e956ad0be3adc47fc999ae..fba9757e58147ee70c383196f06b535042e069fa 100644 (file)
@@ -129,7 +129,6 @@ choice
        prompt "Default allocator"
        depends on ZSWAP
        default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU
-       default ZSWAP_ZPOOL_DEFAULT_ZBUD
        help
          Selects the default allocator for the compressed cache for
          swap pages.
@@ -140,12 +139,6 @@ choice
          The selection made here can be overridden by using the kernel
          command line 'zswap.zpool=' option.
 
-config ZSWAP_ZPOOL_DEFAULT_ZBUD
-       bool "zbud"
-       select ZBUD
-       help
-         Use the zbud allocator as the default allocator.
-
 config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
        bool "zsmalloc"
        select ZSMALLOC
@@ -156,20 +149,9 @@ endchoice
 config ZSWAP_ZPOOL_DEFAULT
        string
        depends on ZSWAP
-       default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
        default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
        default ""
 
-config ZBUD
-       tristate "2:1 compression allocator (zbud)"
-       depends on ZSWAP
-       help
-         A 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.
-
 config ZSMALLOC
        tristate
        prompt "N:1 compression allocator (zsmalloc)" if (ZSWAP || ZRAM)
index e4c03da3c08467560bec1fcf7aed1e00f6604082..53392d2af3a58fb7ff2be95db072f69360b5d6c7 100644 (file)
@@ -113,7 +113,6 @@ obj-$(CONFIG_DEBUG_VM_PGTABLE) += debug_vm_pgtable.o
 obj-$(CONFIG_PAGE_OWNER) += page_owner.o
 obj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o
 obj-$(CONFIG_ZPOOL)    += zpool.o
-obj-$(CONFIG_ZBUD)     += zbud.o
 obj-$(CONFIG_ZSMALLOC) += zsmalloc.o
 obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
 obj-$(CONFIG_CMA)      += cma.o
diff --git a/mm/zbud.c b/mm/zbud.c
deleted file mode 100644 (file)
index e9836ff..0000000
--- a/mm/zbud.c
+++ /dev/null
@@ -1,455 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * zbud.c
- *
- * Copyright (C) 2013, Seth Jennings, IBM
- *
- * Concepts based on zcache internal zbud allocator by Dan Magenheimer.
- *
- * zbud is an special purpose allocator for storing compressed pages.  Contrary
- * to what its name may suggest, zbud is not a buddy allocator, but rather an
- * allocator that "buddies" two compressed pages together in a single memory
- * 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
- * justified" 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.
- *
- * zbud pages are divided into "chunks".  The size of the chunks is fixed at
- * compile time and determined by NCHUNKS_ORDER below.  Dividing zbud pages
- * into chunks allows organizing unbuddied zbud pages into a manageable number
- * of unbuddied lists according to the number of free chunks available in the
- * zbud page.
- *
- * The zbud API differs from that of conventional allocators in that the
- * allocation function, zbud_alloc(), returns an opaque handle to the user,
- * not a dereferenceable pointer.  The user must map the handle using
- * zbud_map() in order to get a usable pointer by which to access the
- * allocation data and unmap the handle with zbud_unmap() when operations
- * on the allocation data are complete.
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/atomic.h>
-#include <linux/list.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/preempt.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/zpool.h>
-
-/*****************
- * Structures
-*****************/
-/*
- * NCHUNKS_ORDER determines the internal allocation granularity, effectively
- * adjusting internal fragmentation.  It also determines the number of
- * freelists maintained in each pool. NCHUNKS_ORDER of 6 means that the
- * allocation granularity will be in chunks of size PAGE_SIZE/64. As one chunk
- * in allocated page is occupied by zbud header, NCHUNKS will be calculated to
- * 63 which shows the max number of free chunks in zbud page, also there will be
- * 63 freelists per pool.
- */
-#define NCHUNKS_ORDER  6
-
-#define CHUNK_SHIFT    (PAGE_SHIFT - NCHUNKS_ORDER)
-#define CHUNK_SIZE     (1 << CHUNK_SHIFT)
-#define ZHDR_SIZE_ALIGNED CHUNK_SIZE
-#define NCHUNKS                ((PAGE_SIZE - ZHDR_SIZE_ALIGNED) >> CHUNK_SHIFT)
-
-struct zbud_pool;
-
-/**
- * struct zbud_pool - stores metadata for each zbud pool
- * @lock:      protects all pool fields and first|last_chunk fields of any
- *             zbud page in the pool
- * @unbuddied: array of lists tracking zbud pages that only contain one buddy;
- *             the lists each zbud page is added to depends on the size of
- *             its free region.
- * @buddied:   list tracking the zbud pages that contain two buddies;
- *             these zbud pages are full
- * @pages_nr:  number of zbud pages in the pool.
- *
- * This structure is allocated at pool creation time and maintains metadata
- * pertaining to a particular zbud pool.
- */
-struct zbud_pool {
-       spinlock_t lock;
-       union {
-               /*
-                * Reuse unbuddied[0] as buddied on the ground that
-                * unbuddied[0] is unused.
-                */
-               struct list_head buddied;
-               struct list_head unbuddied[NCHUNKS];
-       };
-       u64 pages_nr;
-};
-
-/*
- * struct zbud_header - zbud page metadata occupying the first chunk of each
- *                     zbud page.
- * @buddy:     links the zbud page into the unbuddied/buddied lists in the pool
- * @first_chunks:      the size of the first buddy in chunks, 0 if free
- * @last_chunks:       the size of the last buddy in chunks, 0 if free
- */
-struct zbud_header {
-       struct list_head buddy;
-       unsigned int first_chunks;
-       unsigned int last_chunks;
-};
-
-/*****************
- * Helpers
-*****************/
-/* Just to make the code easier to read */
-enum buddy {
-       FIRST,
-       LAST
-};
-
-/* Converts an allocation size in bytes to size in zbud chunks */
-static int size_to_chunks(size_t size)
-{
-       return (size + CHUNK_SIZE - 1) >> CHUNK_SHIFT;
-}
-
-#define for_each_unbuddied_list(_iter, _begin) \
-       for ((_iter) = (_begin); (_iter) < NCHUNKS; (_iter)++)
-
-/* Initializes the zbud header of a newly allocated zbud page */
-static struct zbud_header *init_zbud_page(struct page *page)
-{
-       struct zbud_header *zhdr = page_address(page);
-       zhdr->first_chunks = 0;
-       zhdr->last_chunks = 0;
-       INIT_LIST_HEAD(&zhdr->buddy);
-       return zhdr;
-}
-
-/* Resets the struct page fields and frees the page */
-static void free_zbud_page(struct zbud_header *zhdr)
-{
-       __free_page(virt_to_page(zhdr));
-}
-
-/*
- * Encodes the handle of a particular buddy within a zbud page
- * Pool lock should be held as this function accesses first|last_chunks
- */
-static unsigned long encode_handle(struct zbud_header *zhdr, enum buddy bud)
-{
-       unsigned long handle;
-
-       /*
-        * For now, the encoded handle is actually just the pointer to the data
-        * but this might not always be the case.  A little information hiding.
-        * Add CHUNK_SIZE to the handle if it is the first allocation to jump
-        * over the zbud header in the first chunk.
-        */
-       handle = (unsigned long)zhdr;
-       if (bud == FIRST)
-               /* skip over zbud header */
-               handle += ZHDR_SIZE_ALIGNED;
-       else /* bud == LAST */
-               handle += PAGE_SIZE - (zhdr->last_chunks  << CHUNK_SHIFT);
-       return handle;
-}
-
-/* Returns the zbud page where a given handle is stored */
-static struct zbud_header *handle_to_zbud_header(unsigned long handle)
-{
-       return (struct zbud_header *)(handle & PAGE_MASK);
-}
-
-/* Returns the number of free chunks in a zbud page */
-static int num_free_chunks(struct zbud_header *zhdr)
-{
-       /*
-        * Rather than branch for different situations, just use the fact that
-        * free buddies have a length of zero to simplify everything.
-        */
-       return NCHUNKS - zhdr->first_chunks - zhdr->last_chunks;
-}
-
-/*****************
- * API Functions
-*****************/
-/**
- * zbud_create_pool() - create a new zbud pool
- * @gfp:       gfp flags when allocating the zbud pool structure
- *
- * Return: pointer to the new zbud pool or NULL if the metadata allocation
- * failed.
- */
-static struct zbud_pool *zbud_create_pool(gfp_t gfp)
-{
-       struct zbud_pool *pool;
-       int i;
-
-       pool = kzalloc(sizeof(struct zbud_pool), gfp);
-       if (!pool)
-               return NULL;
-       spin_lock_init(&pool->lock);
-       for_each_unbuddied_list(i, 0)
-               INIT_LIST_HEAD(&pool->unbuddied[i]);
-       INIT_LIST_HEAD(&pool->buddied);
-       pool->pages_nr = 0;
-       return pool;
-}
-
-/**
- * zbud_destroy_pool() - destroys an existing zbud pool
- * @pool:      the zbud pool to be destroyed
- *
- * The pool should be emptied before this function is called.
- */
-static void zbud_destroy_pool(struct zbud_pool *pool)
-{
-       kfree(pool);
-}
-
-/**
- * zbud_alloc() - allocates a region of a given size
- * @pool:      zbud pool from which to allocate
- * @size:      size in bytes of the desired allocation
- * @gfp:       gfp flags used if the pool needs to grow
- * @handle:    handle of the new allocation
- *
- * This function will attempt to find a free region in the pool large enough to
- * satisfy the allocation request.  A search of the unbuddied lists is
- * performed first. If no suitable free region is found, then a new page is
- * allocated and added to the pool to satisfy the request.
- *
- * gfp should not set __GFP_HIGHMEM as highmem pages cannot be used
- * as zbud pool pages.
- *
- * Return: 0 if success and handle is set, otherwise -EINVAL if the size or
- * gfp arguments are invalid or -ENOMEM if the pool was unable to allocate
- * a new page.
- */
-static int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
-                       unsigned long *handle)
-{
-       int chunks, i, freechunks;
-       struct zbud_header *zhdr = NULL;
-       enum buddy bud;
-       struct page *page;
-
-       if (!size || (gfp & __GFP_HIGHMEM))
-               return -EINVAL;
-       if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE)
-               return -ENOSPC;
-       chunks = size_to_chunks(size);
-       spin_lock(&pool->lock);
-
-       /* First, try to find an unbuddied zbud page. */
-       for_each_unbuddied_list(i, chunks) {
-               if (!list_empty(&pool->unbuddied[i])) {
-                       zhdr = list_first_entry(&pool->unbuddied[i],
-                                       struct zbud_header, buddy);
-                       list_del(&zhdr->buddy);
-                       if (zhdr->first_chunks == 0)
-                               bud = FIRST;
-                       else
-                               bud = LAST;
-                       goto found;
-               }
-       }
-
-       /* Couldn't find unbuddied zbud page, create new one */
-       spin_unlock(&pool->lock);
-       page = alloc_page(gfp);
-       if (!page)
-               return -ENOMEM;
-       spin_lock(&pool->lock);
-       pool->pages_nr++;
-       zhdr = init_zbud_page(page);
-       bud = FIRST;
-
-found:
-       if (bud == FIRST)
-               zhdr->first_chunks = chunks;
-       else
-               zhdr->last_chunks = chunks;
-
-       if (zhdr->first_chunks == 0 || zhdr->last_chunks == 0) {
-               /* Add to unbuddied list */
-               freechunks = num_free_chunks(zhdr);
-               list_add(&zhdr->buddy, &pool->unbuddied[freechunks]);
-       } else {
-               /* Add to buddied list */
-               list_add(&zhdr->buddy, &pool->buddied);
-       }
-
-       *handle = encode_handle(zhdr, bud);
-       spin_unlock(&pool->lock);
-
-       return 0;
-}
-
-/**
- * zbud_free() - frees the allocation associated with the given handle
- * @pool:      pool in which the allocation resided
- * @handle:    handle associated with the allocation returned by zbud_alloc()
- */
-static void zbud_free(struct zbud_pool *pool, unsigned long handle)
-{
-       struct zbud_header *zhdr;
-       int freechunks;
-
-       spin_lock(&pool->lock);
-       zhdr = handle_to_zbud_header(handle);
-
-       /* If first buddy, handle will be page aligned */
-       if ((handle - ZHDR_SIZE_ALIGNED) & ~PAGE_MASK)
-               zhdr->last_chunks = 0;
-       else
-               zhdr->first_chunks = 0;
-
-       /* Remove from existing buddy list */
-       list_del(&zhdr->buddy);
-
-       if (zhdr->first_chunks == 0 && zhdr->last_chunks == 0) {
-               /* zbud page is empty, free */
-               free_zbud_page(zhdr);
-               pool->pages_nr--;
-       } else {
-               /* Add to unbuddied list */
-               freechunks = num_free_chunks(zhdr);
-               list_add(&zhdr->buddy, &pool->unbuddied[freechunks]);
-       }
-
-       spin_unlock(&pool->lock);
-}
-
-/**
- * zbud_map() - maps the allocation associated with the given handle
- * @pool:      pool in which the allocation resides
- * @handle:    handle associated with the allocation to be mapped
- *
- * While trivial for zbud, the mapping functions for others allocators
- * implementing this allocation API could have more complex information encoded
- * in the handle and could create temporary mappings to make the data
- * accessible to the user.
- *
- * Returns: a pointer to the mapped allocation
- */
-static void *zbud_map(struct zbud_pool *pool, unsigned long handle)
-{
-       return (void *)(handle);
-}
-
-/**
- * zbud_unmap() - maps the allocation associated with the given handle
- * @pool:      pool in which the allocation resides
- * @handle:    handle associated with the allocation to be unmapped
- */
-static void zbud_unmap(struct zbud_pool *pool, unsigned long handle)
-{
-}
-
-/**
- * zbud_get_pool_pages() - gets the zbud pool size in pages
- * @pool:      pool whose size is being queried
- *
- * Returns: size in pages of the given pool.  The pool lock need not be
- * taken to access pages_nr.
- */
-static u64 zbud_get_pool_pages(struct zbud_pool *pool)
-{
-       return pool->pages_nr;
-}
-
-/*****************
- * zpool
- ****************/
-
-static void *zbud_zpool_create(const char *name, gfp_t gfp)
-{
-       return zbud_create_pool(gfp);
-}
-
-static void zbud_zpool_destroy(void *pool)
-{
-       zbud_destroy_pool(pool);
-}
-
-static int zbud_zpool_malloc(void *pool, size_t size, gfp_t gfp,
-                       unsigned long *handle)
-{
-       return zbud_alloc(pool, size, gfp, handle);
-}
-static void zbud_zpool_free(void *pool, unsigned long handle)
-{
-       zbud_free(pool, handle);
-}
-
-static void *zbud_zpool_map(void *pool, unsigned long handle,
-                       enum zpool_mapmode mm)
-{
-       return zbud_map(pool, handle);
-}
-static void zbud_zpool_unmap(void *pool, unsigned long handle)
-{
-       zbud_unmap(pool, handle);
-}
-
-static u64 zbud_zpool_total_pages(void *pool)
-{
-       return zbud_get_pool_pages(pool);
-}
-
-static struct zpool_driver zbud_zpool_driver = {
-       .type =         "zbud",
-       .sleep_mapped = true,
-       .owner =        THIS_MODULE,
-       .create =       zbud_zpool_create,
-       .destroy =      zbud_zpool_destroy,
-       .malloc =       zbud_zpool_malloc,
-       .free =         zbud_zpool_free,
-       .map =          zbud_zpool_map,
-       .unmap =        zbud_zpool_unmap,
-       .total_pages =  zbud_zpool_total_pages,
-};
-
-MODULE_ALIAS("zpool-zbud");
-
-static int __init init_zbud(void)
-{
-       /* Make sure the zbud header will fit in one chunk */
-       BUILD_BUG_ON(sizeof(struct zbud_header) > ZHDR_SIZE_ALIGNED);
-       pr_info("loaded\n");
-
-       zpool_register_driver(&zbud_zpool_driver);
-
-       return 0;
-}
-
-static void __exit exit_zbud(void)
-{
-       zpool_unregister_driver(&zbud_zpool_driver);
-       pr_info("unloaded\n");
-}
-
-module_init(init_zbud);
-module_exit(exit_zbud);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Seth Jennings <sjennings@variantweb.net>");
-MODULE_DESCRIPTION("Buddy Allocator for Compressed Pages");
index b9fda1fa857da7eb5a91445fabda6946e810dcfa..4bbd12d4b65992af6ea06f480fc07a5f23ca9e47 100644 (file)
@@ -95,7 +95,7 @@ static void zpool_put_driver(struct zpool_driver *driver)
 
 /**
  * zpool_has_pool() - Check if the pool driver is available
- * @type:      The type of the zpool to check (e.g. zbud, zsmalloc)
+ * @type:      The type of the zpool to check (e.g. zsmalloc)
  *
  * This checks if the @type pool driver is available.  This will try to load
  * the requested module, if needed, but there is no guarantee the module will
@@ -130,7 +130,7 @@ EXPORT_SYMBOL(zpool_has_pool);
 
 /**
  * zpool_create_pool() - Create a new zpool
- * @type:      The type of the zpool to create (e.g. zbud, zsmalloc)
+ * @type:      The type of the zpool to create (e.g. zsmalloc)
  * @name:      The name of the zpool (e.g. zram0, zswap)
  * @gfp:       The GFP flags to use when allocating the pool.
  *