linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/z3fold.c: Allow __GFP_HIGHMEM in z3fold_alloc
@ 2019-07-12 22:21 Henry Burns
  2019-07-13  8:24 ` Vitaly Wool
  2019-07-13 16:05 ` Shakeel Butt
  0 siblings, 2 replies; 3+ messages in thread
From: Henry Burns @ 2019-07-12 22:21 UTC (permalink / raw)
  To: Vitaly Wool, Andrew Morton
  Cc: Vitaly Vul, Shakeel Butt, Jonathan Adams, Greg Kroah-Hartman,
	Snild Dolkow, Thomas Gleixner, linux-mm, linux-kernel,
	Henry Burns

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.

Signed-off-by: Henry Burns <henryburns@google.com>
---
 mm/z3fold.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index e78f95284d7c..cb567ddf051c 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -193,7 +193,8 @@ static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
 							gfp_t gfp)
 {
 	struct z3fold_buddy_slots *slots = kmem_cache_alloc(pool->c_handle,
-							    gfp);
+							    (gfp & ~(__GFP_HIGHMEM
+								   | __GFP_MOVABLE)));
 
 	if (slots) {
 		memset(slots->slot, 0, sizeof(slots->slot));
@@ -844,7 +845,7 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
 	enum buddy bud;
 	bool can_sleep = gfpflags_allow_blocking(gfp);
 
-	if (!size || (gfp & __GFP_HIGHMEM))
+	if (!size)
 		return -EINVAL;
 
 	if (size > PAGE_SIZE)
-- 
2.22.0.510.g264f2c817a-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/z3fold.c: Allow __GFP_HIGHMEM in z3fold_alloc
  2019-07-12 22:21 [PATCH] mm/z3fold.c: Allow __GFP_HIGHMEM in z3fold_alloc Henry Burns
@ 2019-07-13  8:24 ` Vitaly Wool
  2019-07-13 16:05 ` Shakeel Butt
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Wool @ 2019-07-13  8:24 UTC (permalink / raw)
  To: Henry Burns
  Cc: Andrew Morton, Vitaly Vul, Shakeel Butt, Jonathan Adams,
	Greg Kroah-Hartman, Snild Dolkow, Thomas Gleixner, Linux-MM,
	LKML

On Sat, Jul 13, 2019 at 12:22 AM Henry Burns <henryburns@google.com> wrote:
>
> 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.
>
> Signed-off-by: Henry Burns <henryburns@google.com>

Acked-by: Vitaly Wool <vitalywool@gmail.com>

> ---
>  mm/z3fold.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index e78f95284d7c..cb567ddf051c 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -193,7 +193,8 @@ static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
>                                                         gfp_t gfp)
>  {
>         struct z3fold_buddy_slots *slots = kmem_cache_alloc(pool->c_handle,
> -                                                           gfp);
> +                                                           (gfp & ~(__GFP_HIGHMEM
> +                                                                  | __GFP_MOVABLE)));
>
>         if (slots) {
>                 memset(slots->slot, 0, sizeof(slots->slot));
> @@ -844,7 +845,7 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
>         enum buddy bud;
>         bool can_sleep = gfpflags_allow_blocking(gfp);
>
> -       if (!size || (gfp & __GFP_HIGHMEM))
> +       if (!size)
>                 return -EINVAL;
>
>         if (size > PAGE_SIZE)
> --
> 2.22.0.510.g264f2c817a-goog
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/z3fold.c: Allow __GFP_HIGHMEM in z3fold_alloc
  2019-07-12 22:21 [PATCH] mm/z3fold.c: Allow __GFP_HIGHMEM in z3fold_alloc Henry Burns
  2019-07-13  8:24 ` Vitaly Wool
@ 2019-07-13 16:05 ` Shakeel Butt
  1 sibling, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2019-07-13 16:05 UTC (permalink / raw)
  To: Henry Burns
  Cc: Vitaly Wool, Andrew Morton, Vitaly Vul, Jonathan Adams,
	Greg Kroah-Hartman, Snild Dolkow, Thomas Gleixner, Linux MM,
	LKML

On Fri, Jul 12, 2019 at 3:22 PM Henry Burns <henryburns@google.com> wrote:
>
> 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.
>
> Signed-off-by: Henry Burns <henryburns@google.com>

Reviewed-by: Shakeel Butt <shakeelb@google.com>

> ---
>  mm/z3fold.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index e78f95284d7c..cb567ddf051c 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -193,7 +193,8 @@ static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
>                                                         gfp_t gfp)
>  {
>         struct z3fold_buddy_slots *slots = kmem_cache_alloc(pool->c_handle,
> -                                                           gfp);
> +                                                           (gfp & ~(__GFP_HIGHMEM
> +                                                                  | __GFP_MOVABLE)));
>
>         if (slots) {
>                 memset(slots->slot, 0, sizeof(slots->slot));
> @@ -844,7 +845,7 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
>         enum buddy bud;
>         bool can_sleep = gfpflags_allow_blocking(gfp);
>
> -       if (!size || (gfp & __GFP_HIGHMEM))
> +       if (!size)
>                 return -EINVAL;
>
>         if (size > PAGE_SIZE)
> --
> 2.22.0.510.g264f2c817a-goog
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-13 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 22:21 [PATCH] mm/z3fold.c: Allow __GFP_HIGHMEM in z3fold_alloc Henry Burns
2019-07-13  8:24 ` Vitaly Wool
2019-07-13 16:05 ` Shakeel Butt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).