mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
kmem-cache: Use a taskq for async allocations
Shift the asynchronous allocations over to use the taskq interfaces. This allows us to abandon the kernels delayed work queue interface and all the compatibility code it requires. This code never actually used the delay functionality it was just done this way to leverage the existing compatibility code. All that is required is a thread context to perform the allocation in. The only thing clever in this change is that we take advantage of the preallocated task queue entries to avoid a memory allocation. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
a10287e00d
commit
33e94ef1dd
@ -432,7 +432,7 @@ typedef struct spl_kmem_slab {
|
|||||||
typedef struct spl_kmem_alloc {
|
typedef struct spl_kmem_alloc {
|
||||||
struct spl_kmem_cache *ska_cache; /* Owned by cache */
|
struct spl_kmem_cache *ska_cache; /* Owned by cache */
|
||||||
int ska_flags; /* Allocation flags */
|
int ska_flags; /* Allocation flags */
|
||||||
struct delayed_work ska_work; /* Allocation work */
|
taskq_ent_t ska_tqe; /* Task queue entry */
|
||||||
} spl_kmem_alloc_t;
|
} spl_kmem_alloc_t;
|
||||||
|
|
||||||
typedef struct spl_kmem_emergency {
|
typedef struct spl_kmem_emergency {
|
||||||
|
@ -1697,8 +1697,7 @@ spl_cache_obj(spl_kmem_cache_t *skc, spl_kmem_slab_t *sks)
|
|||||||
static void
|
static void
|
||||||
spl_cache_grow_work(void *data)
|
spl_cache_grow_work(void *data)
|
||||||
{
|
{
|
||||||
spl_kmem_alloc_t *ska =
|
spl_kmem_alloc_t *ska = (spl_kmem_alloc_t *)data;
|
||||||
spl_get_work_data(data, spl_kmem_alloc_t, ska_work.work);
|
|
||||||
spl_kmem_cache_t *skc = ska->ska_cache;
|
spl_kmem_cache_t *skc = ska->ska_cache;
|
||||||
spl_kmem_slab_t *sks;
|
spl_kmem_slab_t *sks;
|
||||||
|
|
||||||
@ -1777,8 +1776,9 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj)
|
|||||||
atomic_inc(&skc->skc_ref);
|
atomic_inc(&skc->skc_ref);
|
||||||
ska->ska_cache = skc;
|
ska->ska_cache = skc;
|
||||||
ska->ska_flags = flags & ~__GFP_FS;
|
ska->ska_flags = flags & ~__GFP_FS;
|
||||||
spl_init_delayed_work(&ska->ska_work, spl_cache_grow_work, ska);
|
taskq_init_ent(&ska->ska_tqe);
|
||||||
schedule_delayed_work(&ska->ska_work, 0);
|
taskq_dispatch_ent(spl_kmem_cache_taskq,
|
||||||
|
spl_cache_grow_work, ska, 0, &ska->ska_tqe);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user