Whamcloud - gitweb
LU-1402 libcfs: CFS_ALLOC_HIGH is __GFP_HIGHMEM
authorIsaac Huang <Isaac_Huang@xyratex.com>
Mon, 14 May 2012 20:23:04 +0000 (14:23 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 9 Jun 2012 07:31:40 +0000 (03:31 -0400)
According to the comment above CFS_ALLOC_HIGH, the flag
allows allocator to return memory in the highmen zone, but
cfs_alloc_flags_to_gfp() incorrectly converts it to
__GFP_HIGH, which enables the use of emergency pools.

__GFP_HIGHMEM should be used instead. Also it makes sense to rename
CFS_ALLOC_HIGH to CFS_ALLOC_HIGHMEM to avoid further confusion.

Signed-off-by: Isaac Huang <Isaac_Huang@xyratex.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I088f36faec1fe22902065d680730731f8deab5d2
Reviewed-on: http://review.whamcloud.com/2732
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: wangdi <di.wang@whamcloud.com>
Reviewed-by: Liang Zhen <liang@whamcloud.com>
libcfs/include/libcfs/libcfs.h
libcfs/libcfs/linux/linux-mem.c
lustre/ptlrpc/sec_bulk.c

index 28e9f3b..5fbeed9 100644 (file)
@@ -204,10 +204,11 @@ enum cfs_alloc_flags {
 
 /* flags for cfs_page_alloc() in addition to enum cfs_alloc_flags */
 enum cfs_alloc_page_flags {
-        /* allow to return page beyond KVM. It has to be mapped into KVM by
-         * cfs_page_map(); */
-        CFS_ALLOC_HIGH   = 0x40,
-        CFS_ALLOC_HIGHUSER = CFS_ALLOC_WAIT | CFS_ALLOC_FS | CFS_ALLOC_IO | CFS_ALLOC_HIGH,
+       /* allow to return page beyond KVM. It has to be mapped into KVM by
+        * cfs_kmap() and unmapped with cfs_kunmap(). */
+       CFS_ALLOC_HIGHMEM  = 0x40,
+       CFS_ALLOC_HIGHUSER = CFS_ALLOC_WAIT | CFS_ALLOC_FS | CFS_ALLOC_IO |
+                            CFS_ALLOC_HIGHMEM,
 };
 
 /*
index 1708a12..f4c78da 100644 (file)
@@ -53,8 +53,8 @@ static unsigned int cfs_alloc_flags_to_gfp(u_int32_t flags)
                 mflags |= __GFP_IO;
         if (flags & CFS_ALLOC_FS)
                 mflags |= __GFP_FS;
-        if (flags & CFS_ALLOC_HIGH)
-                mflags |= __GFP_HIGH;
+       if (flags & CFS_ALLOC_HIGHMEM)
+               mflags |= __GFP_HIGHMEM;
         return mflags;
 }
 
index 9452e04..bfce3e1 100644 (file)
@@ -420,8 +420,8 @@ static int enc_pools_add_pages(int npages)
                         goto out_pools;
 
                 for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
-                        pools[i][j] = cfs_alloc_page(CFS_ALLOC_IO |
-                                                     CFS_ALLOC_HIGH);
+                       pools[i][j] = cfs_alloc_page(CFS_ALLOC_IO |
+                                                    CFS_ALLOC_HIGHMEM);
                         if (pools[i][j] == NULL)
                                 goto out_pools;