Browse Source

[PATCH] Add GFP_NOWAIT

Introduce GFP_NOWAIT, as an alias for GFP_ATOMIC & ~__GFP_HIGH.

This also changes XFS, which is the only in-tree user of this idiom that I
could find.  The XFS piece is compile-tested only.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Acked-by: Nathan Scott <nathans@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Jeff Dike 19 years ago
parent
commit
7b04d7170e
2 changed files with 3 additions and 1 deletions
  1. 1 1
      fs/xfs/linux-2.6/xfs_buf.c
  2. 2 0
      include/linux/gfp.h

+ 1 - 1
fs/xfs/linux-2.6/xfs_buf.c

@@ -182,7 +182,7 @@ free_address(
 {
 {
 	a_list_t	*aentry;
 	a_list_t	*aentry;
 
 
-	aentry = kmalloc(sizeof(a_list_t), GFP_ATOMIC & ~__GFP_HIGH);
+	aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
 	if (likely(aentry)) {
 	if (likely(aentry)) {
 		spin_lock(&as_lock);
 		spin_lock(&as_lock);
 		aentry->next = as_free_head;
 		aentry->next = as_free_head;

+ 2 - 0
include/linux/gfp.h

@@ -57,6 +57,8 @@ struct vm_area_struct;
 			__GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
 			__GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
 			__GFP_NOMEMALLOC|__GFP_HARDWALL)
 			__GFP_NOMEMALLOC|__GFP_HARDWALL)
 
 
+/* This equals 0, but use constants in case they ever change */
+#define GFP_NOWAIT	(GFP_ATOMIC & ~__GFP_HIGH)
 /* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
 /* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
 #define GFP_ATOMIC	(__GFP_HIGH)
 #define GFP_ATOMIC	(__GFP_HIGH)
 #define GFP_NOIO	(__GFP_WAIT)
 #define GFP_NOIO	(__GFP_WAIT)