From 220c6d92200792c318f5248e8e44dbcfc712c788 Mon Sep 17 00:00:00 2001 From: Isaac Huang Date: Mon, 14 May 2012 14:23:04 -0600 Subject: [PATCH] LU-1402 libcfs: CFS_ALLOC_HIGH is __GFP_HIGHMEM 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 Signed-off-by: Andreas Dilger Change-Id: I088f36faec1fe22902065d680730731f8deab5d2 Reviewed-on: http://review.whamcloud.com/2732 Tested-by: Hudson Tested-by: Maloo Reviewed-by: wangdi Reviewed-by: Liang Zhen --- libcfs/include/libcfs/libcfs.h | 9 +++++---- libcfs/libcfs/linux/linux-mem.c | 4 ++-- lustre/ptlrpc/sec_bulk.c | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index 28e9f3b..5fbeed9 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -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, }; /* diff --git a/libcfs/libcfs/linux/linux-mem.c b/libcfs/libcfs/linux/linux-mem.c index 1708a12..f4c78da 100644 --- a/libcfs/libcfs/linux/linux-mem.c +++ b/libcfs/libcfs/linux/linux-mem.c @@ -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; } diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c index 9452e04..bfce3e1 100644 --- a/lustre/ptlrpc/sec_bulk.c +++ b/lustre/ptlrpc/sec_bulk.c @@ -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; -- 1.8.3.1