diff options
author | Seth Jennings <sjenning@linux.vnet.ibm.com> | 2012-07-02 21:15:50 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-09 18:34:59 (GMT) |
commit | 103123305c4f695cbb11555d51a32ea14d6bed05 (patch) | |
tree | afffe95f37834030298e3480a57af6e45d18490c /drivers/staging/zsmalloc/zsmalloc-main.c | |
parent | 5f601902c61e6cda627ec71c10609021067ed0fa (diff) | |
download | linux-fsl-qoriq-103123305c4f695cbb11555d51a32ea14d6bed05.tar.xz |
staging: zsmalloc: add single-page object fastpath in unmap
Improve zs_unmap_object() performance by adding a fast path for
objects that don't span pages.
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/zsmalloc/zsmalloc-main.c')
-rw-r--r-- | drivers/staging/zsmalloc/zsmalloc-main.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index a7a6f22..4942d41 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -774,6 +774,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle) } zs_copy_map_object(area->vm_buf, page, off, class->size); + area->vm_addr = NULL; return area->vm_buf; } EXPORT_SYMBOL_GPL(zs_map_object); @@ -788,6 +789,14 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) struct size_class *class; struct mapping_area *area; + area = &__get_cpu_var(zs_map_area); + if (area->vm_addr) { + /* single-page object fastpath */ + kunmap_atomic(area->vm_addr); + put_cpu_var(zs_map_area); + return; + } + BUG_ON(!handle); obj_handle_to_location(handle, &page, &obj_idx); @@ -795,11 +804,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) class = &pool->size_class[class_idx]; off = obj_idx_to_offset(page, obj_idx, class->size); - area = &__get_cpu_var(zs_map_area); - if (off + class->size <= PAGE_SIZE) - kunmap_atomic(area->vm_addr); - else - zs_copy_unmap_object(area->vm_buf, page, off, class->size); + zs_copy_unmap_object(area->vm_buf, page, off, class->size); put_cpu_var(zs_map_area); } EXPORT_SYMBOL_GPL(zs_unmap_object); |