mm: save two stranding bit in gfp_mask
diff mbox

Message ID 20180516202023.167627-1-shakeelb@google.com
State New
Headers show

Commit Message

Shakeel Butt May 16, 2018, 8:20 p.m. UTC
___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(-)

Comments

Vlastimil Babka May 16, 2018, 8:39 p.m. UTC | #1
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>
Shakeel Butt May 16, 2018, 9:21 p.m. UTC | #2
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).
kbuild test robot May 23, 2018, 8:08 a.m. UTC | #3
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
Michal Hocko May 23, 2018, 8:17 a.m. UTC | #4
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

Patch
diff mbox

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))
 
 /*