Message ID | 1526916033-4877-11-git-send-email-yehs2007@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, May 21, 2018 at 11:20:31PM +0800, Huaisheng Ye wrote: > @@ -343,7 +343,7 @@ static void destroy_cache(struct zs_pool *pool) > static unsigned long cache_alloc_handle(struct zs_pool *pool, gfp_t gfp) > { > return (unsigned long)kmem_cache_alloc(pool->handle_cachep, > - gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); > + gfp & ~__GFP_ZONE_MOVABLE); > } This should be & ~GFP_ZONEMASK Actually, we should probably have a function to clear those bits rather than have every driver manipulating the gfp mask like this. Maybe #define gfp_normal(gfp) ((gfp) & ~GFP_ZONEMASK) return (unsigned long)kmem_cache_alloc(pool->handle_cachep, - gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); + gfp_normal(gfp));
From: owner-linux-mm@kvack.org On Behalf Of Matthew Wilcox > > On Mon, May 21, 2018 at 11:20:31PM +0800, Huaisheng Ye wrote: > > @@ -343,7 +343,7 @@ static void destroy_cache(struct zs_pool *pool) > > static unsigned long cache_alloc_handle(struct zs_pool *pool, gfp_t gfp) > > { > > return (unsigned long)kmem_cache_alloc(pool->handle_cachep, > > - gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); > > + gfp & ~__GFP_ZONE_MOVABLE); > > } > > This should be & ~GFP_ZONEMASK > > Actually, we should probably have a function to clear those bits rather > than have every driver manipulating the gfp mask like this. Maybe > > #define gfp_normal(gfp) ((gfp) & ~GFP_ZONEMASK) Good idea! > > return (unsigned long)kmem_cache_alloc(pool->handle_cachep, > - gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); > + gfp_normal(gfp)); Sincerely, Huaisheng Ye
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index c301350..06b2902 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -343,7 +343,7 @@ static void destroy_cache(struct zs_pool *pool) static unsigned long cache_alloc_handle(struct zs_pool *pool, gfp_t gfp) { return (unsigned long)kmem_cache_alloc(pool->handle_cachep, - gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); + gfp & ~__GFP_ZONE_MOVABLE); } static void cache_free_handle(struct zs_pool *pool, unsigned long handle) @@ -354,7 +354,7 @@ static void cache_free_handle(struct zs_pool *pool, unsigned long handle) static struct zspage *cache_alloc_zspage(struct zs_pool *pool, gfp_t flags) { return kmem_cache_alloc(pool->zspage_cachep, - flags & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); + flags & ~__GFP_ZONE_MOVABLE); } static void cache_free_zspage(struct zs_pool *pool, struct zspage *zspage)