Commit 833cb2a6 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Remove PF_NOWARN

We keep getting in a mess with the current->flags setting and
unsetting.

Remove current->flags:PF_NOWARN and create __GFP_NOWARN instead.
parent 72c36b7d
...@@ -137,12 +137,10 @@ inline void bio_init(struct bio *bio) ...@@ -137,12 +137,10 @@ inline void bio_init(struct bio *bio)
**/ **/
struct bio *bio_alloc(int gfp_mask, int nr_iovecs) struct bio *bio_alloc(int gfp_mask, int nr_iovecs)
{ {
int pf_flags = current->flags;
struct bio_vec *bvl = NULL; struct bio_vec *bvl = NULL;
unsigned long idx; unsigned long idx;
struct bio *bio; struct bio *bio;
current->flags |= PF_NOWARN;
bio = mempool_alloc(bio_pool, gfp_mask); bio = mempool_alloc(bio_pool, gfp_mask);
if (unlikely(!bio)) if (unlikely(!bio))
goto out; goto out;
...@@ -160,7 +158,6 @@ struct bio *bio_alloc(int gfp_mask, int nr_iovecs) ...@@ -160,7 +158,6 @@ struct bio *bio_alloc(int gfp_mask, int nr_iovecs)
bio->bi_io_vec = bvl; bio->bi_io_vec = bvl;
bio->bi_destructor = bio_destructor; bio->bi_destructor = bio_destructor;
out: out:
current->flags = pf_flags;
return bio; return bio;
} }
......
...@@ -923,11 +923,7 @@ create_buffers(struct page * page, unsigned long size, int retry) ...@@ -923,11 +923,7 @@ create_buffers(struct page * page, unsigned long size, int retry)
head = NULL; head = NULL;
offset = PAGE_SIZE; offset = PAGE_SIZE;
while ((offset -= size) >= 0) { while ((offset -= size) >= 0) {
int pf_flags = current->flags;
current->flags |= PF_NOWARN;
bh = alloc_buffer_head(); bh = alloc_buffer_head();
current->flags = pf_flags;
if (!bh) if (!bh)
goto no_grow; goto no_grow;
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#define BN_ALIGN_MASK ((1 << (PAGE_CACHE_SHIFT - BBSHIFT)) - 1) #define BN_ALIGN_MASK ((1 << (PAGE_CACHE_SHIFT - BBSHIFT)) - 1)
#ifndef GFP_READAHEAD #ifndef GFP_READAHEAD
#define GFP_READAHEAD 0 #define GFP_READAHEAD __GFP_NOWARN
#endif #endif
/* /*
...@@ -806,11 +806,7 @@ pagebuf_readahead( ...@@ -806,11 +806,7 @@ pagebuf_readahead(
return; return;
flags |= (PBF_TRYLOCK|PBF_READ|PBF_ASYNC|PBF_MAPPABLE|PBF_READ_AHEAD); flags |= (PBF_TRYLOCK|PBF_READ|PBF_ASYNC|PBF_MAPPABLE|PBF_READ_AHEAD);
/* don't complain on allocation failure, it's fine with us */
current->flags |= PF_NOWARN;
pagebuf_get(target, ioff, isize, flags); pagebuf_get(target, ioff, isize, flags);
current->flags &= ~PF_NOWARN;
} }
page_buf_t * page_buf_t *
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */ #define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */
#define __GFP_FS 0x100 /* Can call down to low-level FS? */ #define __GFP_FS 0x100 /* Can call down to low-level FS? */
#define __GFP_COLD 0x200 /* Cache-cold page required */ #define __GFP_COLD 0x200 /* Cache-cold page required */
#define __GFP_NOWARN 0x400 /* Suppress page allocation failure warning */
#define GFP_NOHIGHIO ( __GFP_WAIT | __GFP_IO) #define GFP_NOHIGHIO ( __GFP_WAIT | __GFP_IO)
#define GFP_NOIO ( __GFP_WAIT) #define GFP_NOIO ( __GFP_WAIT)
......
...@@ -419,13 +419,12 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) ...@@ -419,13 +419,12 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
#define PF_MEMALLOC 0x00000800 /* Allocating memory */ #define PF_MEMALLOC 0x00000800 /* Allocating memory */
#define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */ #define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */
#define PF_FLUSHER 0x00002000 /* responsible for disk writeback */ #define PF_FLUSHER 0x00002000 /* responsible for disk writeback */
#define PF_NOWARN 0x00004000 /* debug: don't warn if alloc fails */
#define PF_FREEZE 0x00008000 /* this task should be frozen for suspend */ #define PF_FREEZE 0x00004000 /* this task should be frozen for suspend */
#define PF_IOTHREAD 0x00010000 /* this thread is needed for doing I/O to swap */ #define PF_IOTHREAD 0x00008000 /* this thread is needed for doing I/O to swap */
#define PF_FROZEN 0x00020000 /* frozen for system suspend */ #define PF_FROZEN 0x00010000 /* frozen for system suspend */
#define PF_FSTRANS 0x00040000 /* inside a filesystem transaction */ #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
#define PF_KSWAPD 0x00080000 /* I am kswapd */ #define PF_KSWAPD 0x00040000 /* I am kswapd */
/* /*
* Ptrace flags * Ptrace flags
......
...@@ -23,7 +23,7 @@ typedef struct kmem_cache_s kmem_cache_t; ...@@ -23,7 +23,7 @@ typedef struct kmem_cache_s kmem_cache_t;
#define SLAB_KERNEL GFP_KERNEL #define SLAB_KERNEL GFP_KERNEL
#define SLAB_DMA GFP_DMA #define SLAB_DMA GFP_DMA
#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS) #define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHIO|__GFP_FS|__GFP_COLD|__GFP_NOWARN)
#define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */ #define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */
/* flags to pass to kmem_cache_create(). /* flags to pass to kmem_cache_create().
......
...@@ -187,12 +187,9 @@ void * mempool_alloc(mempool_t *pool, int gfp_mask) ...@@ -187,12 +187,9 @@ void * mempool_alloc(mempool_t *pool, int gfp_mask)
unsigned long flags; unsigned long flags;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO); int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO);
int pf_flags = current->flags;
repeat_alloc: repeat_alloc:
current->flags |= PF_NOWARN; element = pool->alloc(gfp_nowait|__GFP_NOWARN, pool->pool_data);
element = pool->alloc(gfp_nowait, pool->pool_data);
current->flags = pf_flags;
if (likely(element != NULL)) if (likely(element != NULL))
return element; return element;
......
...@@ -543,7 +543,7 @@ __alloc_pages(unsigned int gfp_mask, unsigned int order, ...@@ -543,7 +543,7 @@ __alloc_pages(unsigned int gfp_mask, unsigned int order,
} }
nopage: nopage:
if (!(current->flags & PF_NOWARN)) { if (!(gfp_mask & __GFP_NOWARN)) {
printk("%s: page allocation failure." printk("%s: page allocation failure."
" order:%d, mode:0x%x\n", " order:%d, mode:0x%x\n",
current->comm, order, gfp_mask); current->comm, order, gfp_mask);
......
...@@ -145,15 +145,12 @@ int add_to_swap(struct page * page) ...@@ -145,15 +145,12 @@ int add_to_swap(struct page * page)
pf_flags = current->flags; pf_flags = current->flags;
current->flags &= ~PF_MEMALLOC; current->flags &= ~PF_MEMALLOC;
current->flags |= PF_NOWARN;
/* /*
* Add it to the swap cache and mark it dirty * Add it to the swap cache and mark it dirty
*/ */
err = add_to_page_cache(page, &swapper_space, entry.val); err = add_to_page_cache(page, &swapper_space, entry.val);
if (!(pf_flags & PF_NOWARN))
current->flags &= ~PF_NOWARN;
if (pf_flags & PF_MEMALLOC) if (pf_flags & PF_MEMALLOC)
current->flags |= PF_MEMALLOC; current->flags |= PF_MEMALLOC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment