perf vendor events: Update metrics for ivytown
[linux-2.6-microblaze.git] / mm / zsmalloc.c
index 71d6edc..34f784a 100644 (file)
@@ -386,7 +386,10 @@ static int zs_zpool_malloc(void *pool, size_t size, gfp_t gfp,
                        unsigned long *handle)
 {
        *handle = zs_malloc(pool, size, gfp);
-       return *handle ? 0 : -1;
+
+       if (IS_ERR((void *)(*handle)))
+               return PTR_ERR((void *)*handle);
+       return 0;
 }
 static void zs_zpool_free(void *pool, unsigned long handle)
 {
@@ -1388,7 +1391,7 @@ static unsigned long obj_malloc(struct zs_pool *pool,
  * @gfp: gfp flags when allocating object
  *
  * On success, handle to the allocated object is returned,
- * otherwise 0.
+ * otherwise an ERR_PTR().
  * Allocation requests with size > ZS_MAX_ALLOC_SIZE will fail.
  */
 unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp)
@@ -1399,11 +1402,11 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp)
        struct zspage *zspage;
 
        if (unlikely(!size || size > ZS_MAX_ALLOC_SIZE))
-               return 0;
+               return (unsigned long)ERR_PTR(-EINVAL);
 
        handle = cache_alloc_handle(pool, gfp);
        if (!handle)
-               return 0;
+               return (unsigned long)ERR_PTR(-ENOMEM);
 
        /* extra space in chunk to keep the handle */
        size += ZS_HANDLE_SIZE;
@@ -1428,7 +1431,7 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp)
        zspage = alloc_zspage(pool, class, gfp);
        if (!zspage) {
                cache_free_handle(pool, handle);
-               return 0;
+               return (unsigned long)ERR_PTR(-ENOMEM);
        }
 
        spin_lock(&class->lock);
@@ -2169,7 +2172,8 @@ static int zs_register_shrinker(struct zs_pool *pool)
        pool->shrinker.batch = 0;
        pool->shrinker.seeks = DEFAULT_SEEKS;
 
-       return register_shrinker(&pool->shrinker);
+       return register_shrinker(&pool->shrinker, "mm-zspool:%s",
+                                pool->name);
 }
 
 /**