mm/z3fold.c: allow __GFP_HIGHMEM in z3fold_alloc
One of the gfp flags used to show that a page is movable is __GFP_HIGHMEM. Currently z3fold_alloc() fails when __GFP_HIGHMEM is passed. Now that z3fold pages are movable, we allow __GFP_HIGHMEM. We strip the movability related flags from the call to kmem_cache_alloc() for our slots since it is a kernel allocation. [akpm@linux-foundation.org: coding-style fixes] Link: http://lkml.kernel.org/r/20190712222118.108192-1-henryburns@google.com Signed-off-by: Henry Burns <henryburns@google.com> Acked-by: Vitaly Wool <vitalywool@gmail.com> Reviewed-by: Shakeel Butt <shakeelb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
929f92f780
commit
f1549cb5ab
|
@ -195,8 +195,10 @@ static void compact_page_work(struct work_struct *w);
|
||||||
static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
|
static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
|
||||||
gfp_t gfp)
|
gfp_t gfp)
|
||||||
{
|
{
|
||||||
struct z3fold_buddy_slots *slots = kmem_cache_alloc(pool->c_handle,
|
struct z3fold_buddy_slots *slots;
|
||||||
gfp);
|
|
||||||
|
slots = kmem_cache_alloc(pool->c_handle,
|
||||||
|
(gfp & ~(__GFP_HIGHMEM | __GFP_MOVABLE)));
|
||||||
|
|
||||||
if (slots) {
|
if (slots) {
|
||||||
memset(slots->slot, 0, sizeof(slots->slot));
|
memset(slots->slot, 0, sizeof(slots->slot));
|
||||||
|
@ -853,7 +855,7 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
|
||||||
enum buddy bud;
|
enum buddy bud;
|
||||||
bool can_sleep = gfpflags_allow_blocking(gfp);
|
bool can_sleep = gfpflags_allow_blocking(gfp);
|
||||||
|
|
||||||
if (!size || (gfp & __GFP_HIGHMEM))
|
if (!size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (size > PAGE_SIZE)
|
if (size > PAGE_SIZE)
|
||||||
|
|
Loading…
Reference in New Issue