Project

General

Profile

Actions

Bug #5543

open

zfs lz4 compression cause two cross-calls per I/O

Added by Alexander Kolbasov over 6 years ago. Updated over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2015-01-17
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

When lz4 compression is enabled and uses the "heap" mode it goes through the following code:

static int
real_LZ4_compress(const char *source, char *dest, int isize, int osize)
{
    void *ctx = kmem_zalloc(sizeof (struct refTables), KM_NOSLEEP);
    int result;

    /*
     * out of kernel memory, gently fall through - this will disable
     * compression in zio_compress_data
     */
    if (ctx == NULL)
        return (0);

    if (isize < LZ4_64KLIMIT)
        result = LZ4_compress64kCtx(ctx, source, dest, isize, osize);
    else
        result = LZ4_compressCtx(ctx, source, dest, isize, osize);

    kmem_free(ctx, sizeof (struct refTables));
    return (result);
}

When the size is 16 K every allocation goes creates a new club and every kmem_free destroys it. Each club allocation/destruction causes TLB shutdown which is very expensive and we have two club operations per I/O which isn't good.
Actions

Also available in: Atom PDF