zsmalloc: use preempt.h for in_interrupt()
[firefly-linux-kernel-4.4.55.git] / mm / zsmalloc.c
index f135b1b6fcdcab49aaf0845e078c6fc299b4b28b..c4811067bec7c5420f057e17e585ba15f2602050 100644 (file)
@@ -38,6 +38,7 @@
  *     page->lru: links together first pages of various zspages.
  *             Basically forming list of zspages in a fullness group.
  *     page->mapping: class index and fullness group of the zspage
+ *     page->inuse: the number of objects that are used in this zspage
  *
  * Usage of struct page flags:
  *     PG_private: identifies the first component page
@@ -58,7 +59,7 @@
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/vmalloc.h>
-#include <linux/hardirq.h>
+#include <linux/preempt.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
 #include <linux/debugfs.h>
@@ -237,7 +238,7 @@ struct link_free {
 };
 
 struct zs_pool {
-       char *name;
+       const char *name;
 
        struct size_class **size_class;
        struct kmem_cache *handle_cachep;
@@ -311,7 +312,7 @@ static void record_obj(unsigned long handle, unsigned long obj)
 
 #ifdef CONFIG_ZPOOL
 
-static void *zs_zpool_create(char *name, gfp_t gfp,
+static void *zs_zpool_create(const char *name, gfp_t gfp,
                             const struct zpool_ops *zpool_ops,
                             struct zpool *zpool)
 {
@@ -548,7 +549,7 @@ static const struct file_operations zs_stat_size_ops = {
        .release        = single_release,
 };
 
-static int zs_pool_stat_create(char *name, struct zs_pool *pool)
+static int zs_pool_stat_create(const char *name, struct zs_pool *pool)
 {
        struct dentry *entry;
 
@@ -588,7 +589,7 @@ static void __exit zs_stat_exit(void)
 {
 }
 
-static inline int zs_pool_stat_create(char *name, struct zs_pool *pool)
+static inline int zs_pool_stat_create(const char *name, struct zs_pool *pool)
 {
        return 0;
 }
@@ -824,7 +825,7 @@ static unsigned long obj_to_head(struct size_class *class, struct page *page,
 {
        if (class->huge) {
                VM_BUG_ON(!is_first_page(page));
-               return *(unsigned long *)page_private(page);
+               return page_private(page);
        } else
                return *(unsigned long *)obj;
 }
@@ -1866,7 +1867,7 @@ static int zs_register_shrinker(struct zs_pool *pool)
  * On success, a pointer to the newly created pool is returned,
  * otherwise NULL.
  */
-struct zs_pool *zs_create_pool(char *name, gfp_t flags)
+struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
 {
        int i;
        struct zs_pool *pool;