LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] mm: save two stranding bit in gfp_mask
@ 2018-05-16 20:20 Shakeel Butt
  2018-05-16 20:39 ` Vlastimil Babka
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shakeel Butt @ 2018-05-16 20:20 UTC (permalink / raw)
  To: Michal Hocko, Andrew Morton, Greg Thelen, Mel Gorman, Vlastimil Babka
  Cc: Linux MM, LKML, Shakeel Butt

___GFP_COLD and ___GFP_OTHER_NODE were removed but their bits were
stranded. Slide existing gfp masks to make those two bits available.

Signed-off-by: Shakeel Butt <shakeelb@google.com>
---
 include/linux/gfp.h | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 1a4582b44d32..8edf72d32411 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -16,31 +16,31 @@ struct vm_area_struct;
  */
 
 /* Plain integer GFP bitmasks. Do not use this directly. */
-#define ___GFP_DMA		0x01u
-#define ___GFP_HIGHMEM		0x02u
-#define ___GFP_DMA32		0x04u
-#define ___GFP_MOVABLE		0x08u
+#define ___GFP_DMA		0x1u
+#define ___GFP_HIGHMEM		0x2u
+#define ___GFP_DMA32		0x4u
+#define ___GFP_MOVABLE		0x8u
 #define ___GFP_RECLAIMABLE	0x10u
 #define ___GFP_HIGH		0x20u
 #define ___GFP_IO		0x40u
 #define ___GFP_FS		0x80u
-#define ___GFP_NOWARN		0x200u
-#define ___GFP_RETRY_MAYFAIL	0x400u
-#define ___GFP_NOFAIL		0x800u
-#define ___GFP_NORETRY		0x1000u
-#define ___GFP_MEMALLOC		0x2000u
-#define ___GFP_COMP		0x4000u
-#define ___GFP_ZERO		0x8000u
-#define ___GFP_NOMEMALLOC	0x10000u
-#define ___GFP_HARDWALL		0x20000u
-#define ___GFP_THISNODE		0x40000u
-#define ___GFP_ATOMIC		0x80000u
-#define ___GFP_ACCOUNT		0x100000u
-#define ___GFP_DIRECT_RECLAIM	0x400000u
-#define ___GFP_WRITE		0x800000u
-#define ___GFP_KSWAPD_RECLAIM	0x1000000u
+#define ___GFP_NOWARN		0x100u
+#define ___GFP_RETRY_MAYFAIL	0x200u
+#define ___GFP_NOFAIL		0x400u
+#define ___GFP_NORETRY		0x800u
+#define ___GFP_MEMALLOC		0x1000u
+#define ___GFP_COMP		0x2000u
+#define ___GFP_ZERO		0x4000u
+#define ___GFP_NOMEMALLOC	0x8000u
+#define ___GFP_HARDWALL		0x10000u
+#define ___GFP_THISNODE		0x20000u
+#define ___GFP_ATOMIC		0x40000u
+#define ___GFP_ACCOUNT		0x80000u
+#define ___GFP_DIRECT_RECLAIM	0x100000u
+#define ___GFP_WRITE		0x200000u
+#define ___GFP_KSWAPD_RECLAIM	0x400000u
 #ifdef CONFIG_LOCKDEP
-#define ___GFP_NOLOCKDEP	0x2000000u
+#define ___GFP_NOLOCKDEP	0x800000u
 #else
 #define ___GFP_NOLOCKDEP	0
 #endif
@@ -205,7 +205,7 @@ struct vm_area_struct;
 #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)
 
 /* Room for N __GFP_FOO bits */
-#define __GFP_BITS_SHIFT (25 + IS_ENABLED(CONFIG_LOCKDEP))
+#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP))
 #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
 
 /*
-- 
2.17.0.441.gb46fe60e1d-goog

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

* Re: [PATCH] mm: save two stranding bit in gfp_mask
  2018-05-16 20:20 [PATCH] mm: save two stranding bit in gfp_mask Shakeel Butt
@ 2018-05-16 20:39 ` Vlastimil Babka
  2018-05-16 21:21   ` Shakeel Butt
  2018-05-16 20:46 ` Michal Hocko
  2018-05-23  8:08 ` kbuild test robot
  2 siblings, 1 reply; 6+ messages in thread
From: Vlastimil Babka @ 2018-05-16 20:39 UTC (permalink / raw)
  To: Shakeel Butt, Michal Hocko, Andrew Morton, Greg Thelen, Mel Gorman
  Cc: Linux MM, LKML

On 05/16/2018 10:20 PM, Shakeel Butt wrote:
> ___GFP_COLD and ___GFP_OTHER_NODE were removed but their bits were
> stranded. Slide existing gfp masks to make those two bits available.

Well, there are already available for hypothetical new flags. Is there
anything that benefits from a smaller __GFP_BITS_SHIFT? Otherwise no big
objection, besides the churn. Maybe move the last (well, before
NOLOCKDEP) two flags to the "holes" instead of shifting everything? That
would be closer to what compaction does...
There's also an ongoing effort to make the lowest 4 flags a number,
would that mean more free bits and churn soon?
I would also dislike having to learn new numbers for typical flag
combinations to recognize them in oom reports/alloc failures, but
somebody had the great idea to print those symbolically, so nevermind.

Vlastimil

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

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

* Re: [PATCH] mm: save two stranding bit in gfp_mask
  2018-05-16 20:20 [PATCH] mm: save two stranding bit in gfp_mask Shakeel Butt
  2018-05-16 20:39 ` Vlastimil Babka
@ 2018-05-16 20:46 ` Michal Hocko
  2018-05-23  8:08 ` kbuild test robot
  2 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2018-05-16 20:46 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Andrew Morton, Greg Thelen, Mel Gorman, Vlastimil Babka, Linux MM, LKML

On Wed 16-05-18 13:20:23, Shakeel Butt wrote:
> ___GFP_COLD and ___GFP_OTHER_NODE were removed but their bits were
> stranded. Slide existing gfp masks to make those two bits available.

Could you make the patch a bit smaller smaller? E.g.

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 1a4582b44d32..92c82ac8420f 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -24,6 +24,7 @@ struct vm_area_struct;
 #define ___GFP_HIGH		0x20u
 #define ___GFP_IO		0x40u
 #define ___GFP_FS		0x80u
+#define ___GFP_WRITE		0x100u
 #define ___GFP_NOWARN		0x200u
 #define ___GFP_RETRY_MAYFAIL	0x400u
 #define ___GFP_NOFAIL		0x800u
@@ -36,11 +37,10 @@ struct vm_area_struct;
 #define ___GFP_THISNODE		0x40000u
 #define ___GFP_ATOMIC		0x80000u
 #define ___GFP_ACCOUNT		0x100000u
-#define ___GFP_DIRECT_RECLAIM	0x400000u
-#define ___GFP_WRITE		0x800000u
-#define ___GFP_KSWAPD_RECLAIM	0x1000000u
+#define ___GFP_DIRECT_RECLAIM	0x200000u
+#define ___GFP_KSWAPD_RECLAIM	0x400000u
 #ifdef CONFIG_LOCKDEP
-#define ___GFP_NOLOCKDEP	0x2000000u
+#define ___GFP_NOLOCKDEP	0x800000u
 #else
 #define ___GFP_NOLOCKDEP	0
 #endif

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

Other than that I have no real objections. It is good to see how many
bits we are using. So
Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  include/linux/gfp.h | 42 +++++++++++++++++++++---------------------
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index 1a4582b44d32..8edf72d32411 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -16,31 +16,31 @@ struct vm_area_struct;
>   */
>  
>  /* Plain integer GFP bitmasks. Do not use this directly. */
> -#define ___GFP_DMA		0x01u
> -#define ___GFP_HIGHMEM		0x02u
> -#define ___GFP_DMA32		0x04u
> -#define ___GFP_MOVABLE		0x08u
> +#define ___GFP_DMA		0x1u
> +#define ___GFP_HIGHMEM		0x2u
> +#define ___GFP_DMA32		0x4u
> +#define ___GFP_MOVABLE		0x8u
>  #define ___GFP_RECLAIMABLE	0x10u
>  #define ___GFP_HIGH		0x20u
>  #define ___GFP_IO		0x40u
>  #define ___GFP_FS		0x80u
> -#define ___GFP_NOWARN		0x200u
> -#define ___GFP_RETRY_MAYFAIL	0x400u
> -#define ___GFP_NOFAIL		0x800u
> -#define ___GFP_NORETRY		0x1000u
> -#define ___GFP_MEMALLOC		0x2000u
> -#define ___GFP_COMP		0x4000u
> -#define ___GFP_ZERO		0x8000u
> -#define ___GFP_NOMEMALLOC	0x10000u
> -#define ___GFP_HARDWALL		0x20000u
> -#define ___GFP_THISNODE		0x40000u
> -#define ___GFP_ATOMIC		0x80000u
> -#define ___GFP_ACCOUNT		0x100000u
> -#define ___GFP_DIRECT_RECLAIM	0x400000u
> -#define ___GFP_WRITE		0x800000u
> -#define ___GFP_KSWAPD_RECLAIM	0x1000000u
> +#define ___GFP_NOWARN		0x100u
> +#define ___GFP_RETRY_MAYFAIL	0x200u
> +#define ___GFP_NOFAIL		0x400u
> +#define ___GFP_NORETRY		0x800u
> +#define ___GFP_MEMALLOC		0x1000u
> +#define ___GFP_COMP		0x2000u
> +#define ___GFP_ZERO		0x4000u
> +#define ___GFP_NOMEMALLOC	0x8000u
> +#define ___GFP_HARDWALL		0x10000u
> +#define ___GFP_THISNODE		0x20000u
> +#define ___GFP_ATOMIC		0x40000u
> +#define ___GFP_ACCOUNT		0x80000u
> +#define ___GFP_DIRECT_RECLAIM	0x100000u
> +#define ___GFP_WRITE		0x200000u
> +#define ___GFP_KSWAPD_RECLAIM	0x400000u
>  #ifdef CONFIG_LOCKDEP
> -#define ___GFP_NOLOCKDEP	0x2000000u
> +#define ___GFP_NOLOCKDEP	0x800000u
>  #else
>  #define ___GFP_NOLOCKDEP	0
>  #endif
> @@ -205,7 +205,7 @@ struct vm_area_struct;
>  #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)
>  
>  /* Room for N __GFP_FOO bits */
> -#define __GFP_BITS_SHIFT (25 + IS_ENABLED(CONFIG_LOCKDEP))
> +#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP))
>  #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
>  
>  /*
> -- 
> 2.17.0.441.gb46fe60e1d-goog

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm: save two stranding bit in gfp_mask
  2018-05-16 20:39 ` Vlastimil Babka
@ 2018-05-16 21:21   ` Shakeel Butt
  0 siblings, 0 replies; 6+ messages in thread
From: Shakeel Butt @ 2018-05-16 21:21 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Michal Hocko, Andrew Morton, Greg Thelen, Mel Gorman, Linux MM, LKML

On Wed, May 16, 2018 at 1:41 PM Vlastimil Babka <vbabka@suse.cz> wrote:
> On 05/16/2018 10:20 PM, Shakeel Butt wrote:
> > ___GFP_COLD and ___GFP_OTHER_NODE were removed but their bits were
> > stranded. Slide existing gfp masks to make those two bits available.
> Well, there are already available for hypothetical new flags. Is there
> anything that benefits from a smaller __GFP_BITS_SHIFT?

I am prototyping to pass along the type of kmem allocation e.g. page table,
vmalloc, stack e.t.c. (still very preliminary).

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

* Re: [PATCH] mm: save two stranding bit in gfp_mask
  2018-05-16 20:20 [PATCH] mm: save two stranding bit in gfp_mask Shakeel Butt
  2018-05-16 20:39 ` Vlastimil Babka
  2018-05-16 20:46 ` Michal Hocko
@ 2018-05-23  8:08 ` kbuild test robot
  2018-05-23  8:17   ` Michal Hocko
  2 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2018-05-23  8:08 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: kbuild-all, Michal Hocko, Andrew Morton, Greg Thelen, Mel Gorman,
	Vlastimil Babka, Linux MM, LKML, Shakeel Butt

Hi Shakeel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mmotm/master]
[also build test WARNING on v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Shakeel-Butt/mm-save-two-stranding-bit-in-gfp_mask/20180518-202316
base:   git://git.cmpxchg.org/linux-mmotm.git master


vim +/jl +2585 fs/reiserfs/journal.c

^1da177e Linus Torvalds 2005-04-16  2573  
^1da177e Linus Torvalds 2005-04-16  2574  static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s)
^1da177e Linus Torvalds 2005-04-16  2575  {
^1da177e Linus Torvalds 2005-04-16  2576  	struct reiserfs_journal_list *jl;
8c777cc4 Pekka Enberg   2006-02-01  2577  	jl = kzalloc(sizeof(struct reiserfs_journal_list),
8c777cc4 Pekka Enberg   2006-02-01  2578  		     GFP_NOFS | __GFP_NOFAIL);
^1da177e Linus Torvalds 2005-04-16  2579  	INIT_LIST_HEAD(&jl->j_list);
^1da177e Linus Torvalds 2005-04-16  2580  	INIT_LIST_HEAD(&jl->j_working_list);
^1da177e Linus Torvalds 2005-04-16  2581  	INIT_LIST_HEAD(&jl->j_tail_bh_list);
^1da177e Linus Torvalds 2005-04-16  2582  	INIT_LIST_HEAD(&jl->j_bh_list);
90415dea Jeff Mahoney   2008-07-25  2583  	mutex_init(&jl->j_commit_mutex);
^1da177e Linus Torvalds 2005-04-16  2584  	SB_JOURNAL(s)->j_num_lists++;
^1da177e Linus Torvalds 2005-04-16 @2585  	get_journal_list(jl);
^1da177e Linus Torvalds 2005-04-16  2586  	return jl;
^1da177e Linus Torvalds 2005-04-16  2587  }
^1da177e Linus Torvalds 2005-04-16  2588  

:::::: The code at line 2585 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

* Re: [PATCH] mm: save two stranding bit in gfp_mask
  2018-05-23  8:08 ` kbuild test robot
@ 2018-05-23  8:17   ` Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2018-05-23  8:17 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Shakeel Butt, kbuild-all, Andrew Morton, Greg Thelen, Mel Gorman,
	Vlastimil Babka, Linux MM, LKML

On Wed 23-05-18 16:08:28, kbuild test robot wrote:
> Hi Shakeel,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on mmotm/master]
> [also build test WARNING on v4.17-rc6]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Shakeel-Butt/mm-save-two-stranding-bit-in-gfp_mask/20180518-202316
> base:   git://git.cmpxchg.org/linux-mmotm.git master
> 

What is the warning? Btw. this smells like a failure in the script of
some sort. The patch you are referring doesn't really change any code
except using different valuues for gfp constants which shouldn't make
any difference to any code.

> vim +/jl +2585 fs/reiserfs/journal.c
> 
> ^1da177e Linus Torvalds 2005-04-16  2573  
> ^1da177e Linus Torvalds 2005-04-16  2574  static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s)
> ^1da177e Linus Torvalds 2005-04-16  2575  {
> ^1da177e Linus Torvalds 2005-04-16  2576  	struct reiserfs_journal_list *jl;
> 8c777cc4 Pekka Enberg   2006-02-01  2577  	jl = kzalloc(sizeof(struct reiserfs_journal_list),
> 8c777cc4 Pekka Enberg   2006-02-01  2578  		     GFP_NOFS | __GFP_NOFAIL);
> ^1da177e Linus Torvalds 2005-04-16  2579  	INIT_LIST_HEAD(&jl->j_list);
> ^1da177e Linus Torvalds 2005-04-16  2580  	INIT_LIST_HEAD(&jl->j_working_list);
> ^1da177e Linus Torvalds 2005-04-16  2581  	INIT_LIST_HEAD(&jl->j_tail_bh_list);
> ^1da177e Linus Torvalds 2005-04-16  2582  	INIT_LIST_HEAD(&jl->j_bh_list);
> 90415dea Jeff Mahoney   2008-07-25  2583  	mutex_init(&jl->j_commit_mutex);
> ^1da177e Linus Torvalds 2005-04-16  2584  	SB_JOURNAL(s)->j_num_lists++;
> ^1da177e Linus Torvalds 2005-04-16 @2585  	get_journal_list(jl);
> ^1da177e Linus Torvalds 2005-04-16  2586  	return jl;
> ^1da177e Linus Torvalds 2005-04-16  2587  }
> ^1da177e Linus Torvalds 2005-04-16  2588  
> 
> :::::: The code at line 2585 was first introduced by commit
> :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
> 
> :::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
> :::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2018-05-23  8:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 20:20 [PATCH] mm: save two stranding bit in gfp_mask Shakeel Butt
2018-05-16 20:39 ` Vlastimil Babka
2018-05-16 21:21   ` Shakeel Butt
2018-05-16 20:46 ` Michal Hocko
2018-05-23  8:08 ` kbuild test robot
2018-05-23  8:17   ` Michal Hocko

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).